From 95fff5876532d25d32f520d923116b07d5be65fa Mon Sep 17 00:00:00 2001 From: Viachaslau Date: Mon, 23 Feb 2026 11:58:35 +0400 Subject: [PATCH 1/5] chore: initialize workflow skip-checks:true --- .brightsec/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .brightsec/.gitkeep diff --git a/.brightsec/.gitkeep b/.brightsec/.gitkeep new file mode 100644 index 0000000..e69de29 From a0a745248cffa6bf43898ef2bd73e163314f4c6f Mon Sep 17 00:00:00 2001 From: Viachaslau Date: Mon, 23 Feb 2026 12:00:16 +0400 Subject: [PATCH 2/5] ci: temporarily disable workflows while addressing security issues skip-checks:true From 47066a606c712b07fc036bf1eed7d1d105c0aedd Mon Sep 17 00:00:00 2001 From: Viachaslau Date: Mon, 23 Feb 2026 12:00:27 +0400 Subject: [PATCH 3/5] test: add auto-generated e2e security tests skip-checks:true --- .brightsec/tests/get-posts-search.test.ts | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .brightsec/tests/get-posts-search.test.ts diff --git a/.brightsec/tests/get-posts-search.test.ts b/.brightsec/tests/get-posts-search.test.ts new file mode 100644 index 0000000..f9f1549 --- /dev/null +++ b/.brightsec/tests/get-posts-search.test.ts @@ -0,0 +1,41 @@ +import { test, before, after } from 'node:test'; +import { SecRunner } from '@sectester/runner'; +import { AttackParamLocation, HttpMethod } from '@sectester/scan'; + +const timeout = 40 * 60 * 1000; +const baseUrl = process.env.BRIGHT_TARGET_URL!; + +let runner!: SecRunner; + +before(async () => { + runner = new SecRunner({ + hostname: process.env.BRIGHT_HOSTNAME!, + projectId: process.env.BRIGHT_PROJECT_ID! + }); + + await runner.init(); +}); + +after(() => runner.clear()); + +test('GET /posts/search', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'xss', 'csrf', 'id_enumeration'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { + code_source: 'NeuraLegion/ruby-example-app:chore/docker', + databases: ['PostgreSQL'], + user_roles: [] + }, + poolSize: +process.env.SECTESTER_SCAN_POOL_SIZE || undefined + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/posts/search?search_term=example`, + headers: { 'Content-Type': 'application/json' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file From 6bc782c51961270c7864f84bc9bdc28f290dfaf3 Mon Sep 17 00:00:00 2001 From: Viachaslau Date: Mon, 23 Feb 2026 12:00:38 +0400 Subject: [PATCH 4/5] ci: add CI workflow to run e2e security tests --- .github/workflows/bright.yml | 61 +++++++++++++++++++ .../configure-bright-credentials/action.yaml | 53 ++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 .github/workflows/bright.yml create mode 100644 .github/workflows/composite/configure-bright-credentials/action.yaml diff --git a/.github/workflows/bright.yml b/.github/workflows/bright.yml new file mode 100644 index 0000000..85d3e00 --- /dev/null +++ b/.github/workflows/bright.yml @@ -0,0 +1,61 @@ +name: Bright + +on: + pull_request: + branches: + - '**' + +permissions: + checks: write + contents: read + id-token: write + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.x' + + - name: Start application + env: + PGDATABASE: blog_development + PGHOST: db + PGPASSWORD: postgres + PGPORT: 5432 + PGUSER: postgres + RAILS_ENV: development + run: | + docker compose up --wait + + - name: Probe application readiness + run: | + i=1; while [ "$i" -le 30 ]; do curl -sS -o /dev/null http://127.0.0.1:3000 && exit 0; sleep 5; i=$((i + 1)); done; exit 1 + + - name: Install SecTesterJS dependencies + run: | + npm i --save=false --prefix .brightsec @sectester/core@0.49.0 @sectester/repeater@0.49.0 @sectester/scan@0.49.0 @sectester/runner@0.49.0 @sectester/reporter@0.49.0 + + - name: Authenticate with Bright + uses: ./.github/workflows/composite/configure-bright-credentials + with: + BRIGHT_HOSTNAME: development.playground.brightsec.com + BRIGHT_PROJECT_ID: 5naKKxNc3e4Akp1GuEdmiK + BRIGHT_TOKEN: ${{ secrets.BRIGHT_TOKEN }} + + - name: Run security tests + env: + BRIGHT_HOSTNAME: development.playground.brightsec.com + BRIGHT_PROJECT_ID: 5naKKxNc3e4Akp1GuEdmiK + BRIGHT_AUTH_ID: m8XBzLrw8pWSjHQDhKQgCr + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRIGHT_TOKEN: ${{ env.BRIGHT_TOKEN }} + BRIGHT_TARGET_URL: http://127.0.0.1:3000 + SECTESTER_SCAN_POOL_SIZE: ${{ vars.SECTESTER_SCAN_POOL_SIZE }} + run: | + node --experimental-transform-types --experimental-strip-types --experimental-detect-module --disable-warning=MODULE_TYPELESS_PACKAGE_JSON --disable-warning=ExperimentalWarning --test-force-exit --test-concurrency=4 --test .brightsec/tests/*.test.ts \ No newline at end of file diff --git a/.github/workflows/composite/configure-bright-credentials/action.yaml b/.github/workflows/composite/configure-bright-credentials/action.yaml new file mode 100644 index 0000000..8498384 --- /dev/null +++ b/.github/workflows/composite/configure-bright-credentials/action.yaml @@ -0,0 +1,53 @@ +name: 'Configure BrightSec credentials' + +inputs: + BRIGHT_HOSTNAME: + description: 'Hostname for the BrightSec environment' + required: true + BRIGHT_PROJECT_ID: + description: 'Project ID for BrightSec' + required: true + BRIGHT_TOKEN: + description: 'Pre-configured token' + required: false + +runs: + using: 'composite' + steps: + - id: configure_env_from_input + name: 'Set existing token in env' + shell: bash + if: ${{ inputs.BRIGHT_TOKEN != '' }} + env: + BRIGHT_TOKEN: ${{ inputs.BRIGHT_TOKEN }} + run: | + echo "BRIGHT_TOKEN=${BRIGHT_TOKEN}" >> $GITHUB_ENV + + - id: configure_bright_credentials_through_oidc + name: 'Exchange OIDC credentials for Bright token' + shell: bash + if: ${{ inputs.BRIGHT_TOKEN == '' }} + env: + BRIGHT_HOSTNAME: ${{ inputs.BRIGHT_HOSTNAME }} + BRIGHT_PROJECT_ID: ${{ inputs.BRIGHT_PROJECT_ID }} + run: | + # Retrieve OIDC token from GitHub + OIDC_TOKEN=$(curl -sS -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ + "${ACTIONS_ID_TOKEN_REQUEST_URL}" | jq -r '.value') + + # Post the token to BrightSec + RESPONSE=$(curl -s -X POST "https://${BRIGHT_HOSTNAME}/api/v1/projects/${BRIGHT_PROJECT_ID}/api-keys/oidc" \ + -H "Content-Type: application/json" \ + -d "{\"token\": \"${OIDC_TOKEN}\"}") + + if ! echo "$RESPONSE" | jq -e . > /dev/null 2>&1; then + echo "Error: $RESPONSE" 1>&2 + exit 1 + fi + + # Extract the pureKey + PURE_KEY=$(echo "$RESPONSE" | jq -r '.pureKey') + + # Mask and store in environment + echo "::add-mask::$PURE_KEY" + echo "BRIGHT_TOKEN=$PURE_KEY" >> $GITHUB_ENV From c985f2535d45f7d331b8e34f615904b766bf1742 Mon Sep 17 00:00:00 2001 From: Viachaslau Date: Mon, 23 Feb 2026 12:08:10 +0400 Subject: [PATCH 5/5] revert: restore original workflow files and remove temporary one --- .brightsec/tests/get-posts-search.test.ts | 41 ------------- .github/workflows/bright.yml | 61 ------------------- .../configure-bright-credentials/action.yaml | 53 ---------------- 3 files changed, 155 deletions(-) delete mode 100644 .brightsec/tests/get-posts-search.test.ts delete mode 100644 .github/workflows/bright.yml delete mode 100644 .github/workflows/composite/configure-bright-credentials/action.yaml diff --git a/.brightsec/tests/get-posts-search.test.ts b/.brightsec/tests/get-posts-search.test.ts deleted file mode 100644 index f9f1549..0000000 --- a/.brightsec/tests/get-posts-search.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { test, before, after } from 'node:test'; -import { SecRunner } from '@sectester/runner'; -import { AttackParamLocation, HttpMethod } from '@sectester/scan'; - -const timeout = 40 * 60 * 1000; -const baseUrl = process.env.BRIGHT_TARGET_URL!; - -let runner!: SecRunner; - -before(async () => { - runner = new SecRunner({ - hostname: process.env.BRIGHT_HOSTNAME!, - projectId: process.env.BRIGHT_PROJECT_ID! - }); - - await runner.init(); -}); - -after(() => runner.clear()); - -test('GET /posts/search', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['sqli', 'xss', 'csrf', 'id_enumeration'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { - code_source: 'NeuraLegion/ruby-example-app:chore/docker', - databases: ['PostgreSQL'], - user_roles: [] - }, - poolSize: +process.env.SECTESTER_SCAN_POOL_SIZE || undefined - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/posts/search?search_term=example`, - headers: { 'Content-Type': 'application/json' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.github/workflows/bright.yml b/.github/workflows/bright.yml deleted file mode 100644 index 85d3e00..0000000 --- a/.github/workflows/bright.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Bright - -on: - pull_request: - branches: - - '**' - -permissions: - checks: write - contents: read - id-token: write - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '22.x' - - - name: Start application - env: - PGDATABASE: blog_development - PGHOST: db - PGPASSWORD: postgres - PGPORT: 5432 - PGUSER: postgres - RAILS_ENV: development - run: | - docker compose up --wait - - - name: Probe application readiness - run: | - i=1; while [ "$i" -le 30 ]; do curl -sS -o /dev/null http://127.0.0.1:3000 && exit 0; sleep 5; i=$((i + 1)); done; exit 1 - - - name: Install SecTesterJS dependencies - run: | - npm i --save=false --prefix .brightsec @sectester/core@0.49.0 @sectester/repeater@0.49.0 @sectester/scan@0.49.0 @sectester/runner@0.49.0 @sectester/reporter@0.49.0 - - - name: Authenticate with Bright - uses: ./.github/workflows/composite/configure-bright-credentials - with: - BRIGHT_HOSTNAME: development.playground.brightsec.com - BRIGHT_PROJECT_ID: 5naKKxNc3e4Akp1GuEdmiK - BRIGHT_TOKEN: ${{ secrets.BRIGHT_TOKEN }} - - - name: Run security tests - env: - BRIGHT_HOSTNAME: development.playground.brightsec.com - BRIGHT_PROJECT_ID: 5naKKxNc3e4Akp1GuEdmiK - BRIGHT_AUTH_ID: m8XBzLrw8pWSjHQDhKQgCr - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRIGHT_TOKEN: ${{ env.BRIGHT_TOKEN }} - BRIGHT_TARGET_URL: http://127.0.0.1:3000 - SECTESTER_SCAN_POOL_SIZE: ${{ vars.SECTESTER_SCAN_POOL_SIZE }} - run: | - node --experimental-transform-types --experimental-strip-types --experimental-detect-module --disable-warning=MODULE_TYPELESS_PACKAGE_JSON --disable-warning=ExperimentalWarning --test-force-exit --test-concurrency=4 --test .brightsec/tests/*.test.ts \ No newline at end of file diff --git a/.github/workflows/composite/configure-bright-credentials/action.yaml b/.github/workflows/composite/configure-bright-credentials/action.yaml deleted file mode 100644 index 8498384..0000000 --- a/.github/workflows/composite/configure-bright-credentials/action.yaml +++ /dev/null @@ -1,53 +0,0 @@ -name: 'Configure BrightSec credentials' - -inputs: - BRIGHT_HOSTNAME: - description: 'Hostname for the BrightSec environment' - required: true - BRIGHT_PROJECT_ID: - description: 'Project ID for BrightSec' - required: true - BRIGHT_TOKEN: - description: 'Pre-configured token' - required: false - -runs: - using: 'composite' - steps: - - id: configure_env_from_input - name: 'Set existing token in env' - shell: bash - if: ${{ inputs.BRIGHT_TOKEN != '' }} - env: - BRIGHT_TOKEN: ${{ inputs.BRIGHT_TOKEN }} - run: | - echo "BRIGHT_TOKEN=${BRIGHT_TOKEN}" >> $GITHUB_ENV - - - id: configure_bright_credentials_through_oidc - name: 'Exchange OIDC credentials for Bright token' - shell: bash - if: ${{ inputs.BRIGHT_TOKEN == '' }} - env: - BRIGHT_HOSTNAME: ${{ inputs.BRIGHT_HOSTNAME }} - BRIGHT_PROJECT_ID: ${{ inputs.BRIGHT_PROJECT_ID }} - run: | - # Retrieve OIDC token from GitHub - OIDC_TOKEN=$(curl -sS -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ - "${ACTIONS_ID_TOKEN_REQUEST_URL}" | jq -r '.value') - - # Post the token to BrightSec - RESPONSE=$(curl -s -X POST "https://${BRIGHT_HOSTNAME}/api/v1/projects/${BRIGHT_PROJECT_ID}/api-keys/oidc" \ - -H "Content-Type: application/json" \ - -d "{\"token\": \"${OIDC_TOKEN}\"}") - - if ! echo "$RESPONSE" | jq -e . > /dev/null 2>&1; then - echo "Error: $RESPONSE" 1>&2 - exit 1 - fi - - # Extract the pureKey - PURE_KEY=$(echo "$RESPONSE" | jq -r '.pureKey') - - # Mask and store in environment - echo "::add-mask::$PURE_KEY" - echo "BRIGHT_TOKEN=$PURE_KEY" >> $GITHUB_ENV