From 789515053fcbd91d72753ac9c4d870f6ecd17805 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 12:04:02 +0000 Subject: [PATCH 01/15] chore: initialize PR with an empty commit skip-checks:true From eb49d315f494a5345e91cc36a358fd4f41c09019 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 12:15:17 +0000 Subject: [PATCH 02/15] ci: temporarily disable workflows while addressing security issues skip-checks:true --- .github/workflows/build_and_push_stable.yml | 18 ++++----- .github/workflows/build_and_push_unstable.yml | 18 ++++----- .github/workflows/check-client.yml | 33 ++++++---------- .github/workflows/check.yml | 38 +++++++------------ 4 files changed, 40 insertions(+), 67 deletions(-) diff --git a/.github/workflows/build_and_push_stable.yml b/.github/workflows/build_and_push_stable.yml index fb4885e8..9c482155 100644 --- a/.github/workflows/build_and_push_stable.yml +++ b/.github/workflows/build_and_push_stable.yml @@ -1,9 +1,10 @@ name: "Build and Push Docker Image (On Push to Stable)" - on: - push: - branches: - - stable + workflow_dispatch: +# on: +# push: +# branches: +# - stable jobs: docker-build-push: @@ -11,19 +12,15 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Login to DockerHub run: | docker login --username=${{ vars.DOCKERHUB_DULL_USER }} --password=${{ secrets.DOCKERHUB_DULL_TOKEN }} - - name: Generate timestamp id: timestamp run: echo "TIMESTAMP=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV - - name: Generate short SHA id: sha run: echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-6)" >> $GITHUB_ENV - - name: Build and tag Docker images run: | for TAG_PREFIX in stable unstable; do @@ -31,11 +28,10 @@ jobs: docker tag bramkor/pureflow:${TAG_PREFIX} bramkor/pureflow:${TAG_PREFIX}-${{ env.SHORT_SHA }} docker tag bramkor/pureflow:${TAG_PREFIX} bramkor/pureflow:${TAG_PREFIX}-${{ env.SHORT_SHA }}-${{ env.TIMESTAMP }} done - - name: Push Docker images - run: | + run: |- for TAG_PREFIX in stable unstable; do docker push bramkor/pureflow:${TAG_PREFIX} docker push bramkor/pureflow:${TAG_PREFIX}-${{ env.SHORT_SHA }} docker push bramkor/pureflow:${TAG_PREFIX}-${{ env.SHORT_SHA }}-${{ env.TIMESTAMP }} - done \ No newline at end of file + done diff --git a/.github/workflows/build_and_push_unstable.yml b/.github/workflows/build_and_push_unstable.yml index d6e69500..1af4801b 100644 --- a/.github/workflows/build_and_push_unstable.yml +++ b/.github/workflows/build_and_push_unstable.yml @@ -1,11 +1,13 @@ name: "Build and Push Docker Image (Manual)" on: workflow_dispatch: - inputs: - tag_prefix: - description: 'Tag prefix to use (defaults to unstable)' - required: false - default: 'unstable' +# on: +# workflow_dispatch: +# inputs: +# tag_prefix: +# description: 'Tag prefix to use (defaults to unstable)' +# required: false +# default: 'unstable' jobs: docker-build-push: @@ -13,19 +15,15 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Login to DockerHub run: | docker login --username=${{ vars.DOCKERHUB_DULL_USER }} --password=${{ secrets.DOCKERHUB_DULL_TOKEN }} - - name: Generate timestamp id: timestamp run: echo "TIMESTAMP=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV - - name: Generate short SHA id: sha run: echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-6)" >> $GITHUB_ENV - - name: Set tag prefix id: set_tag_prefix run: | @@ -36,13 +34,11 @@ jobs: TAG_PREFIX="${{ github.event.inputs.tag_prefix }}" fi echo "TAG_PREFIX=${TAG_PREFIX}" >> $GITHUB_ENV - - name: Build Docker image run: | docker build -t dull/pureflow:${{ env.TAG_PREFIX }} . docker tag dull/pureflow:${{ env.TAG_PREFIX }} brdullc/pureflow:${{ env.TAG_PREFIX }}-${{ env.SHORT_SHA }} docker tag dull/pureflow:${{ env.TAG_PREFIX }} brdullc/pureflow:${{ env.TAG_PREFIX }}-${{ env.SHORT_SHA }}-${{ env.TIMESTAMP }} - - name: Push Docker images run: | docker push dull/pureflow:${{ env.TAG_PREFIX }} diff --git a/.github/workflows/check-client.yml b/.github/workflows/check-client.yml index ada35f1d..2f0237b7 100644 --- a/.github/workflows/check-client.yml +++ b/.github/workflows/check-client.yml @@ -1,26 +1,23 @@ name: "React Front-End CI checks" - on: - pull_request: - branches: - - '**' - - push: - branches: - - stable - - unstable - - paths: - - 'client/**' - - '.github/workflows/*client.yml' + workflow_dispatch: +# on: +# pull_request: +# branches: +# - '**' +# push: +# branches: +# - stable +# - unstable +# paths: +# - 'client/**' +# - '.github/workflows/*client.yml' env: HUSKY: 0 - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - jobs: check: runs-on: ubuntu-latest @@ -30,23 +27,17 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - name: Disable prepare script (husky) run: npm pkg delete scripts.prepare - - name: Install dependencies run: npm ci --prefix=client --no-audit - - name: Check format run: npm run format --prefix=client - - name: Lint run: npm run lint --prefix=client - - name: Build run: npm run build --prefix=client diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 409c9b86..94023959 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,28 +1,25 @@ name: "Nest Back-End CI checks" - on: - pull_request: - branches: - - '**' - - push: - branches: - - stable - - unstable - - paths: - - '*' - - 'src/**' - - 'test/**' - - '.github/workflows/check.yml' + workflow_dispatch: +# on: +# pull_request: +# branches: +# - '**' +# push: +# branches: +# - stable +# - unstable +# paths: +# - '*' +# - 'src/**' +# - 'test/**' +# - '.github/workflows/check.yml' env: HUSKY: 0 - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - jobs: check: runs-on: ubuntu-latest @@ -32,26 +29,19 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - name: Disable prepare script (husky) run: npm pkg delete scripts.prepare - - name: Install dependencies run: npm ci --no-audit - - name: Check format run: npm run format - - name: Lint run: npm run lint - - name: Build run: npm run build - - name: Test run: npm run test From f5fea4fe25b78cc7ab78bed1be0c7112e68a71b0 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 12:25:18 +0000 Subject: [PATCH 03/15] test: add auto-generated e2e security tests skip-checks:true --- .../delete-api-email-delete-emails.test.ts | 34 ++++++++++++++ ...ig-products-crystals-some-file-jpg.test.ts | 34 ++++++++++++++ .../tests/get-api-auth-dom-csrf-flow.test.ts | 35 +++++++++++++++ .../tests/get-api-auth-oidc-client.test.ts | 34 ++++++++++++++ .../get-api-auth-simple-csrf-flow.test.ts | 34 ++++++++++++++ .brightsec/tests/get-api-config.test.ts | 34 ++++++++++++++ .../tests/get-api-email-get-emails.test.ts | 35 +++++++++++++++ .../get-api-email-send-support-email.test.ts | 35 +++++++++++++++ .brightsec/tests/get-api-file-aws.test.ts | 35 +++++++++++++++ .brightsec/tests/get-api-file-azure.test.ts | 35 +++++++++++++++ .../tests/get-api-file-digital-ocean.test.ts | 35 +++++++++++++++ .brightsec/tests/get-api-file-google.test.ts | 35 +++++++++++++++ ...ystals-amethyst-jpg-type-image-jpg.test.ts | 35 +++++++++++++++ ...fig-products-crystals-amethyst-jpg.test.ts | 35 +++++++++++++++ .brightsec/tests/get-api-goto.test.ts | 34 ++++++++++++++ .../tests/get-api-nestedjson-depth-2.test.ts | 35 +++++++++++++++ .../get-api-partners-partner-login.test.ts | 35 +++++++++++++++ .../tests/get-api-partners-query.test.ts | 35 +++++++++++++++ .../get-api-partners-search-partners.test.ts | 35 +++++++++++++++ .../tests/get-api-products-latest.test.ts | 35 +++++++++++++++ .../tests/get-api-products-views.test.ts | 35 +++++++++++++++ .brightsec/tests/get-api-secrets.test.ts | 34 ++++++++++++++ .../tests/get-api-testimonials-count.test.ts | 35 +++++++++++++++ .brightsec/tests/get-api-testimonials.test.ts | 34 ++++++++++++++ .../get-api-users-fullinfo-email.test.ts | 35 +++++++++++++++ .brightsec/tests/get-api-users-id-1.test.ts | 34 ++++++++++++++ .brightsec/tests/get-api-users-ldap.test.ts | 35 +++++++++++++++ .../tests/get-api-users-one-email.test.ts | 35 +++++++++++++++ .../tests/get-api-users-search-john.test.ts | 34 ++++++++++++++ .../tests/get-api-v1-userinfo-email.test.ts | 34 ++++++++++++++ .../get-graphql-all-testimonials.test.ts | 34 ++++++++++++++ .../tests/get-graphql-select-count.test.ts | 34 ++++++++++++++ .brightsec/tests/options-api.test.ts | 35 +++++++++++++++ .../tests/post-api-auth-admin-login.test.ts | 40 +++++++++++++++++ .../post-api-auth-jwt-hmac-login.test.ts | 40 +++++++++++++++++ .../tests/post-api-auth-jwt-jku-login.test.ts | 40 +++++++++++++++++ .../tests/post-api-auth-jwt-jwk-login.test.ts | 43 ++++++++++++++++++ .../post-api-auth-jwt-kid-sql-login.test.ts | 43 ++++++++++++++++++ .../post-api-auth-jwt-weak-key-login.test.ts | 43 ++++++++++++++++++ .../tests/post-api-auth-jwt-x5c-login.test.ts | 40 +++++++++++++++++ .../tests/post-api-auth-jwt-x5u-login.test.ts | 40 +++++++++++++++++ .brightsec/tests/post-api-auth-login.test.ts | 40 +++++++++++++++++ .brightsec/tests/post-api-chat-query.test.ts | 36 +++++++++++++++ .brightsec/tests/post-api-metadata.test.ts | 36 +++++++++++++++ .brightsec/tests/post-api-render.test.ts | 36 +++++++++++++++ .../post-api-subscriptions-email.test.ts | 34 ++++++++++++++ .brightsec/tests/post-api-users-basic.test.ts | 45 +++++++++++++++++++ .brightsec/tests/post-api-users-oidc.test.ts | 45 +++++++++++++++++++ .../tests/post-graphql-all-products.test.ts | 41 +++++++++++++++++ .../post-graphql-all-testimonials.test.ts | 38 ++++++++++++++++ .../post-graphql-get-command-result.test.ts | 39 ++++++++++++++++ .../post-graphql-latest-products.test.ts | 38 ++++++++++++++++ .../post-graphql-testimonials-count.test.ts | 39 ++++++++++++++++ .../tests/post-graphql-view-product.test.ts | 39 ++++++++++++++++ ...ile-raw-path-some-path-to-file-png.test.ts | 36 +++++++++++++++ 55 files changed, 2013 insertions(+) create mode 100644 .brightsec/tests/delete-api-email-delete-emails.test.ts create mode 100644 .brightsec/tests/delete-api-file-path-config-products-crystals-some-file-jpg.test.ts create mode 100644 .brightsec/tests/get-api-auth-dom-csrf-flow.test.ts create mode 100644 .brightsec/tests/get-api-auth-oidc-client.test.ts create mode 100644 .brightsec/tests/get-api-auth-simple-csrf-flow.test.ts create mode 100644 .brightsec/tests/get-api-config.test.ts create mode 100644 .brightsec/tests/get-api-email-get-emails.test.ts create mode 100644 .brightsec/tests/get-api-email-send-support-email.test.ts create mode 100644 .brightsec/tests/get-api-file-aws.test.ts create mode 100644 .brightsec/tests/get-api-file-azure.test.ts create mode 100644 .brightsec/tests/get-api-file-digital-ocean.test.ts create mode 100644 .brightsec/tests/get-api-file-google.test.ts create mode 100644 .brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts create mode 100644 .brightsec/tests/get-api-file-raw-path-config-products-crystals-amethyst-jpg.test.ts create mode 100644 .brightsec/tests/get-api-goto.test.ts create mode 100644 .brightsec/tests/get-api-nestedjson-depth-2.test.ts create mode 100644 .brightsec/tests/get-api-partners-partner-login.test.ts create mode 100644 .brightsec/tests/get-api-partners-query.test.ts create mode 100644 .brightsec/tests/get-api-partners-search-partners.test.ts create mode 100644 .brightsec/tests/get-api-products-latest.test.ts create mode 100644 .brightsec/tests/get-api-products-views.test.ts create mode 100644 .brightsec/tests/get-api-secrets.test.ts create mode 100644 .brightsec/tests/get-api-testimonials-count.test.ts create mode 100644 .brightsec/tests/get-api-testimonials.test.ts create mode 100644 .brightsec/tests/get-api-users-fullinfo-email.test.ts create mode 100644 .brightsec/tests/get-api-users-id-1.test.ts create mode 100644 .brightsec/tests/get-api-users-ldap.test.ts create mode 100644 .brightsec/tests/get-api-users-one-email.test.ts create mode 100644 .brightsec/tests/get-api-users-search-john.test.ts create mode 100644 .brightsec/tests/get-api-v1-userinfo-email.test.ts create mode 100644 .brightsec/tests/get-graphql-all-testimonials.test.ts create mode 100644 .brightsec/tests/get-graphql-select-count.test.ts create mode 100644 .brightsec/tests/options-api.test.ts create mode 100644 .brightsec/tests/post-api-auth-admin-login.test.ts create mode 100644 .brightsec/tests/post-api-auth-jwt-hmac-login.test.ts create mode 100644 .brightsec/tests/post-api-auth-jwt-jku-login.test.ts create mode 100644 .brightsec/tests/post-api-auth-jwt-jwk-login.test.ts create mode 100644 .brightsec/tests/post-api-auth-jwt-kid-sql-login.test.ts create mode 100644 .brightsec/tests/post-api-auth-jwt-weak-key-login.test.ts create mode 100644 .brightsec/tests/post-api-auth-jwt-x5c-login.test.ts create mode 100644 .brightsec/tests/post-api-auth-jwt-x5u-login.test.ts create mode 100644 .brightsec/tests/post-api-auth-login.test.ts create mode 100644 .brightsec/tests/post-api-chat-query.test.ts create mode 100644 .brightsec/tests/post-api-metadata.test.ts create mode 100644 .brightsec/tests/post-api-render.test.ts create mode 100644 .brightsec/tests/post-api-subscriptions-email.test.ts create mode 100644 .brightsec/tests/post-api-users-basic.test.ts create mode 100644 .brightsec/tests/post-api-users-oidc.test.ts create mode 100644 .brightsec/tests/post-graphql-all-products.test.ts create mode 100644 .brightsec/tests/post-graphql-all-testimonials.test.ts create mode 100644 .brightsec/tests/post-graphql-get-command-result.test.ts create mode 100644 .brightsec/tests/post-graphql-latest-products.test.ts create mode 100644 .brightsec/tests/post-graphql-testimonials-count.test.ts create mode 100644 .brightsec/tests/post-graphql-view-product.test.ts create mode 100644 .brightsec/tests/put-api-file-raw-path-some-path-to-file-png.test.ts diff --git a/.brightsec/tests/delete-api-email-delete-emails.test.ts b/.brightsec/tests/delete-api-email-delete-emails.test.ts new file mode 100644 index 00000000..7a580028 --- /dev/null +++ b/.brightsec/tests/delete-api-email-delete-emails.test.ts @@ -0,0 +1,34 @@ +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('DELETE /api/email/deleteEmails', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'bopla', 'improper_asset_management', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.DELETE, + url: `${baseUrl}/api/email/deleteEmails` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/delete-api-file-path-config-products-crystals-some-file-jpg.test.ts b/.brightsec/tests/delete-api-file-path-config-products-crystals-some-file-jpg.test.ts new file mode 100644 index 00000000..0d021615 --- /dev/null +++ b/.brightsec/tests/delete-api-file-path-config-products-crystals-some-file-jpg.test.ts @@ -0,0 +1,34 @@ +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('DELETE /api/file?path=config/products/crystals/some_file.jpg', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['lfi', 'ssrf', 'bopla', 'http_method_fuzzing', 'open_cloud_storage'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.DELETE, + url: `${baseUrl}/api/file?path=config/products/crystals/some_file.jpg` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-dom-csrf-flow.test.ts b/.brightsec/tests/get-api-auth-dom-csrf-flow.test.ts new file mode 100644 index 00000000..1b1fd69b --- /dev/null +++ b/.brightsec/tests/get-api-auth-dom-csrf-flow.test.ts @@ -0,0 +1,35 @@ +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 /api/auth/dom-csrf-flow', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'full_path_disclosure', 'xss'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/dom-csrf-flow`, + headers: { fingerprint: '12345' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-oidc-client.test.ts b/.brightsec/tests/get-api-auth-oidc-client.test.ts new file mode 100644 index 00000000..6a810a8c --- /dev/null +++ b/.brightsec/tests/get-api-auth-oidc-client.test.ts @@ -0,0 +1,34 @@ +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 /api/auth/oidc-client', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'secret_tokens', 'unvalidated_redirect'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/oidc-client` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-simple-csrf-flow.test.ts b/.brightsec/tests/get-api-auth-simple-csrf-flow.test.ts new file mode 100644 index 00000000..01dc8d95 --- /dev/null +++ b/.brightsec/tests/get-api-auth-simple-csrf-flow.test.ts @@ -0,0 +1,34 @@ +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 /api/auth/simple-csrf-flow', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'xss', 'http_method_fuzzing'], + attackParamLocations: [AttackParamLocation.HEADER, AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/simple-csrf-flow` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-config.test.ts b/.brightsec/tests/get-api-config.test.ts new file mode 100644 index 00000000..4fae3d56 --- /dev/null +++ b/.brightsec/tests/get-api-config.test.ts @@ -0,0 +1,34 @@ +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 /api/config', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['open_database', 'secret_tokens', 'improper_asset_management'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/config` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-email-get-emails.test.ts b/.brightsec/tests/get-api-email-get-emails.test.ts new file mode 100644 index 00000000..922c736f --- /dev/null +++ b/.brightsec/tests/get-api-email-get-emails.test.ts @@ -0,0 +1,35 @@ +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 /api/email/getEmails', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['proto_pollution', 'business_constraint_bypass', 'improper_asset_management'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/email/getEmails?withSource=true`, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-email-send-support-email.test.ts b/.brightsec/tests/get-api-email-send-support-email.test.ts new file mode 100644 index 00000000..cd09d91f --- /dev/null +++ b/.brightsec/tests/get-api-email-send-support-email.test.ts @@ -0,0 +1,35 @@ +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 /api/email/sendSupportEmail', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['proto_pollution', 'email_injection', 'xss'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/email/sendSupportEmail?name=Bob%20Dylan&to=username%40email.com&subject=Help%20Request&content=I%20would%20like%20to%20request%20help%20regarding..`, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-file-aws.test.ts b/.brightsec/tests/get-api-file-aws.test.ts new file mode 100644 index 00000000..c145674b --- /dev/null +++ b/.brightsec/tests/get-api-file-aws.test.ts @@ -0,0 +1,35 @@ +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 /api/file/aws', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['amazon_s3_takeover', 'open_cloud_storage', 'ssrf', 'lfi', 'unvalidated_redirect'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/file/aws?path=config/products/crystals/amethyst.jpg&type=image/jpg`, + headers: { accept: 'image/jpg' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-file-azure.test.ts b/.brightsec/tests/get-api-file-azure.test.ts new file mode 100644 index 00000000..61cc9e25 --- /dev/null +++ b/.brightsec/tests/get-api-file-azure.test.ts @@ -0,0 +1,35 @@ +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 /api/file/azure', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['open_cloud_storage', 'lfi', 'ssrf', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/file/azure?path=config/products/crystals/amethyst.jpg&type=image/jpg`, + headers: { accept: 'image/jpg' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-file-digital-ocean.test.ts b/.brightsec/tests/get-api-file-digital-ocean.test.ts new file mode 100644 index 00000000..b6b72d2e --- /dev/null +++ b/.brightsec/tests/get-api-file-digital-ocean.test.ts @@ -0,0 +1,35 @@ +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 /api/file/digital_ocean', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['ssrf', 'open_cloud_storage', 'lfi', 'unvalidated_redirect'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/file/digital_ocean?path=config/products/crystals/amethyst.jpg&type=image/jpg`, + headers: { accept: 'image/jpg' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-file-google.test.ts b/.brightsec/tests/get-api-file-google.test.ts new file mode 100644 index 00000000..4163d14e --- /dev/null +++ b/.brightsec/tests/get-api-file-google.test.ts @@ -0,0 +1,35 @@ +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 /api/file/google?path=config/products/crystals/amethyst.jpg&type=image/jpg', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['lfi', 'ssrf', 'open_cloud_storage', 'unvalidated_redirect'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/file/google?path=config/products/crystals/amethyst.jpg&type=image/jpg`, + headers: { accept: 'image/jpg' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts b/.brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts new file mode 100644 index 00000000..575b01b6 --- /dev/null +++ b/.brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts @@ -0,0 +1,35 @@ +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 /api/file?path=config/products/crystals/amethyst.jpg&type=image/jpg', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['lfi', 'ssrf', 'open_cloud_storage', 'file_upload', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/file?path=config/products/crystals/amethyst.jpg&type=image/jpg`, + headers: { accept: 'image/jpg' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-file-raw-path-config-products-crystals-amethyst-jpg.test.ts b/.brightsec/tests/get-api-file-raw-path-config-products-crystals-amethyst-jpg.test.ts new file mode 100644 index 00000000..27539aeb --- /dev/null +++ b/.brightsec/tests/get-api-file-raw-path-config-products-crystals-amethyst-jpg.test.ts @@ -0,0 +1,35 @@ +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 /api/file/raw?path=config/products/crystals/amethyst.jpg', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['lfi', 'ssrf', 'open_cloud_storage', 'full_path_disclosure', 'file_upload'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/file/raw?path=config/products/crystals/amethyst.jpg`, + headers: { accept: 'image/jpg' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-goto.test.ts b/.brightsec/tests/get-api-goto.test.ts new file mode 100644 index 00000000..32a30e02 --- /dev/null +++ b/.brightsec/tests/get-api-goto.test.ts @@ -0,0 +1,34 @@ +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 /api/goto', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['unvalidated_redirect', 'ssrf'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/goto?url=https://google.com` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-nestedjson-depth-2.test.ts b/.brightsec/tests/get-api-nestedjson-depth-2.test.ts new file mode 100644 index 00000000..fdbcd6d1 --- /dev/null +++ b/.brightsec/tests/get-api-nestedjson-depth-2.test.ts @@ -0,0 +1,35 @@ +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 /api/nestedJson?depth=2', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['business_constraint_bypass', 'xss', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/nestedJson?depth=2`, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-partners-partner-login.test.ts b/.brightsec/tests/get-api-partners-partner-login.test.ts new file mode 100644 index 00000000..ff7366a1 --- /dev/null +++ b/.brightsec/tests/get-api-partners-partner-login.test.ts @@ -0,0 +1,35 @@ +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 /api/partners/partnerLogin', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['xpathi', 'xss', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/partners/partnerLogin?username=walter100&password=Heisenberg123`, + headers: { 'Content-Type': 'text/xml' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-partners-query.test.ts b/.brightsec/tests/get-api-partners-query.test.ts new file mode 100644 index 00000000..ce2bc692 --- /dev/null +++ b/.brightsec/tests/get-api-partners-query.test.ts @@ -0,0 +1,35 @@ +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 /api/partners/query', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['xpathi', 'xss', 'xxe'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/partners/query?xpath=/partners/partner/name`, + headers: { 'Content-Type': 'text/xml' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-partners-search-partners.test.ts b/.brightsec/tests/get-api-partners-search-partners.test.ts new file mode 100644 index 00000000..701e4f81 --- /dev/null +++ b/.brightsec/tests/get-api-partners-search-partners.test.ts @@ -0,0 +1,35 @@ +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 /api/partners/searchPartners', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['xpathi', 'xss', 'csrf', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/partners/searchPartners?keyword=Walter`, + headers: { 'Content-Type': 'text/xml' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-products-latest.test.ts b/.brightsec/tests/get-api-products-latest.test.ts new file mode 100644 index 00000000..88b569f7 --- /dev/null +++ b/.brightsec/tests/get-api-products-latest.test.ts @@ -0,0 +1,35 @@ +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 /api/products/latest', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['business_constraint_bypass', 'date_manipulation', 'sqli', 'csrf'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] }, + skipStaticParams: true + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/products/latest?limit=3` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-products-views.test.ts b/.brightsec/tests/get-api-products-views.test.ts new file mode 100644 index 00000000..c84e9e69 --- /dev/null +++ b/.brightsec/tests/get-api-products-views.test.ts @@ -0,0 +1,35 @@ +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 /api/products/views', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'business_constraint_bypass', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/products/views`, + headers: { 'x-product-name': 'Amethyst' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-secrets.test.ts b/.brightsec/tests/get-api-secrets.test.ts new file mode 100644 index 00000000..1fe25431 --- /dev/null +++ b/.brightsec/tests/get-api-secrets.test.ts @@ -0,0 +1,34 @@ +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 /api/secrets', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['secret_tokens', 'open_database', 'csrf'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/secrets` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-testimonials-count.test.ts b/.brightsec/tests/get-api-testimonials-count.test.ts new file mode 100644 index 00000000..8b20c8c2 --- /dev/null +++ b/.brightsec/tests/get-api-testimonials-count.test.ts @@ -0,0 +1,35 @@ +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 /api/testimonials/count', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'full_path_disclosure', 'business_constraint_bypass'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/testimonials/count?query=select%20count(*)%20as%20count%20from%20testimonial`, + headers: { 'Content-Type': 'text/html' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-testimonials.test.ts b/.brightsec/tests/get-api-testimonials.test.ts new file mode 100644 index 00000000..c2993993 --- /dev/null +++ b/.brightsec/tests/get-api-testimonials.test.ts @@ -0,0 +1,34 @@ +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 /api/testimonials', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'business_constraint_bypass', 'full_path_disclosure', 'xss'], + attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/testimonials` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-fullinfo-email.test.ts b/.brightsec/tests/get-api-users-fullinfo-email.test.ts new file mode 100644 index 00000000..08ef1416 --- /dev/null +++ b/.brightsec/tests/get-api-users-fullinfo-email.test.ts @@ -0,0 +1,35 @@ +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 /api/users/fullinfo/:email', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['bopla', 'id_enumeration', 'xss', 'csrf', 'open_database'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/fullinfo/john.doe@example.com`, + headers: { 'Access-Control-Request-Headers': 'OPTIONS, GET, POST, DELETE' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-id-1.test.ts b/.brightsec/tests/get-api-users-id-1.test.ts new file mode 100644 index 00000000..ca80bab3 --- /dev/null +++ b/.brightsec/tests/get-api-users-id-1.test.ts @@ -0,0 +1,34 @@ +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 /api/users/id/1', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['id_enumeration', 'sqli', 'full_path_disclosure', 'csrf'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/id/1` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-ldap.test.ts b/.brightsec/tests/get-api-users-ldap.test.ts new file mode 100644 index 00000000..5f4dcd89 --- /dev/null +++ b/.brightsec/tests/get-api-users-ldap.test.ts @@ -0,0 +1,35 @@ +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 /api/users/ldap', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['ldapi', 'csrf', 'improper_asset_management', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/ldap?query=%28%26%28objectClass%3Dperson%29%28objectClass%3Duser%29%28email%3Djohn.doe%40example.com%29%29`, + headers: { 'Access-Control-Request-Headers': 'OPTIONS, GET, POST, DELETE' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-one-email.test.ts b/.brightsec/tests/get-api-users-one-email.test.ts new file mode 100644 index 00000000..b8ec0394 --- /dev/null +++ b/.brightsec/tests/get-api-users-one-email.test.ts @@ -0,0 +1,35 @@ +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 /api/users/one/:email', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'id_enumeration', 'xss', 'ldapi', 'sqli', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/one/john.doe@example.com`, + headers: { 'Access-Control-Request-Headers': 'OPTIONS, GET, POST, DELETE' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-search-john.test.ts b/.brightsec/tests/get-api-users-search-john.test.ts new file mode 100644 index 00000000..767f69b6 --- /dev/null +++ b/.brightsec/tests/get-api-users-search-john.test.ts @@ -0,0 +1,34 @@ +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 /api/users/search/john', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['id_enumeration', 'sqli', 'xss', 'csrf', 'business_constraint_bypass'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/search/john` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-v1-userinfo-email.test.ts b/.brightsec/tests/get-api-v1-userinfo-email.test.ts new file mode 100644 index 00000000..6954ddbc --- /dev/null +++ b/.brightsec/tests/get-api-v1-userinfo-email.test.ts @@ -0,0 +1,34 @@ +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 /api/v1/userinfo/:email', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'id_enumeration', 'xss', 'sqli', 'email_injection', 'improper_asset_management'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/v1/userinfo/john.doe@example.com` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-graphql-all-testimonials.test.ts b/.brightsec/tests/get-graphql-all-testimonials.test.ts new file mode 100644 index 00000000..d8a3b4cb --- /dev/null +++ b/.brightsec/tests/get-graphql-all-testimonials.test.ts @@ -0,0 +1,34 @@ +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 /graphql?query=allTestimonials', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['graphql_introspection', 'sqli', 'xss', 'csrf'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/graphql?query=query%20allTestimonials%20%7B%20allTestimonials%20%7B%20name%20title%20message%20%7D%20%7D` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-graphql-select-count.test.ts b/.brightsec/tests/get-graphql-select-count.test.ts new file mode 100644 index 00000000..5945e0fd --- /dev/null +++ b/.brightsec/tests/get-graphql-select-count.test.ts @@ -0,0 +1,34 @@ +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 /graphql-select-count', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['graphql_introspection', 'sqli', 'csrf', 'jwt'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/graphql?query=SELECT%20COUNT(*)%20FROM%20testimonials` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/options-api.test.ts b/.brightsec/tests/options-api.test.ts new file mode 100644 index 00000000..163a89c1 --- /dev/null +++ b/.brightsec/tests/options-api.test.ts @@ -0,0 +1,35 @@ +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('OPTIONS /api', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['http_method_fuzzing', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.OPTIONS, + url: `${baseUrl}/api`, + headers: { allow: 'OPTIONS, GET, HEAD, POST' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-admin-login.test.ts b/.brightsec/tests/post-api-auth-admin-login.test.ts new file mode 100644 index 00000000..ab92303f --- /dev/null +++ b/.brightsec/tests/post-api-auth-admin-login.test.ts @@ -0,0 +1,40 @@ +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('POST /api/auth/admin/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'jwt', 'sqli', 'ldapi', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/auth/admin/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'oidc' + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-hmac-login.test.ts b/.brightsec/tests/post-api-auth-jwt-hmac-login.test.ts new file mode 100644 index 00000000..c066a9c1 --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-hmac-login.test.ts @@ -0,0 +1,40 @@ +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('POST /api/auth/jwt/hmac/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'sqli', 'osi', 'xss'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/auth/jwt/hmac/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'basic' + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-jku-login.test.ts b/.brightsec/tests/post-api-auth-jwt-jku-login.test.ts new file mode 100644 index 00000000..81330bbc --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-jku-login.test.ts @@ -0,0 +1,40 @@ +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('POST /api/auth/jwt/jku/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'sqli', 'osi', 'unvalidated_redirect'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/auth/jwt/jku/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'basic' + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-jwk-login.test.ts b/.brightsec/tests/post-api-auth-jwt-jwk-login.test.ts new file mode 100644 index 00000000..0022f054 --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-jwk-login.test.ts @@ -0,0 +1,43 @@ +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('POST /api/auth/jwt/jwk/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'sqli', 'secret_tokens', 'osi'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/auth/jwt/jwk/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'basic' + }, + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiam9obiIsImV4cCI6MTYwOTI3MzYwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' + } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-kid-sql-login.test.ts b/.brightsec/tests/post-api-auth-jwt-kid-sql-login.test.ts new file mode 100644 index 00000000..f7366ed9 --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-kid-sql-login.test.ts @@ -0,0 +1,43 @@ +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('POST /api/auth/jwt/kid-sql/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'jwt', 'csrf', 'xss', 'osi'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/auth/jwt/kid-sql/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'basic' + }, + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiam9obkBleGFtcGxlLmNvbSIsImV4cCI6MTYwOTI3MzYwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' + } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-weak-key-login.test.ts b/.brightsec/tests/post-api-auth-jwt-weak-key-login.test.ts new file mode 100644 index 00000000..fa7cd37b --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-weak-key-login.test.ts @@ -0,0 +1,43 @@ +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('POST /api/auth/jwt/weak-key/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'bopla', 'sqli', 'csrf', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/auth/jwt/weak-key/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'basic' + }, + headers: { + 'Content-Type': 'application/json', + authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9' + } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-x5c-login.test.ts b/.brightsec/tests/post-api-auth-jwt-x5c-login.test.ts new file mode 100644 index 00000000..30f754ef --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-x5c-login.test.ts @@ -0,0 +1,40 @@ +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('POST /api/auth/jwt/x5c/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'sqli', 'bopla', 'osi'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/auth/jwt/x5c/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'basic' + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-x5u-login.test.ts b/.brightsec/tests/post-api-auth-jwt-x5u-login.test.ts new file mode 100644 index 00000000..966e412f --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-x5u-login.test.ts @@ -0,0 +1,40 @@ +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('POST /api/auth/jwt/x5u/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'sqli', 'osi', 'xss'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/auth/jwt/x5u/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'basic' + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-login.test.ts b/.brightsec/tests/post-api-auth-login.test.ts new file mode 100644 index 00000000..7cf4a30a --- /dev/null +++ b/.brightsec/tests/post-api-auth-login.test.ts @@ -0,0 +1,40 @@ +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('POST /api/auth/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'jwt', 'sqli', 'xss', 'osi', 'ldapi'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/auth/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'basic' + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-chat-query.test.ts b/.brightsec/tests/post-api-chat-query.test.ts new file mode 100644 index 00000000..d7452d68 --- /dev/null +++ b/.brightsec/tests/post-api-chat-query.test.ts @@ -0,0 +1,36 @@ +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('POST /api/chat/query', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'prompt_injection', 'secret_tokens', 'server_side_js_injection', 'ssrf'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/chat/query`, + body: [{ role: 'user', content: 'Hello, how are you?' }], + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-metadata.test.ts b/.brightsec/tests/post-api-metadata.test.ts new file mode 100644 index 00000000..eaf65984 --- /dev/null +++ b/.brightsec/tests/post-api-metadata.test.ts @@ -0,0 +1,36 @@ +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('POST /api/metadata', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['xxe', 'xss', 'osi', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/metadata`, + body: `\u003csvg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 915 585\"\u003e\u003cg stroke-width=\"3.45\" fill=\"none\"\u003e\u003cpath stroke=\"#000\" d=\"M11.8 11.8h411v411l-411 .01v-411z\"/\u003e\u003cpath stroke=\"#448\" d=\"M489 11.7h415v411H489v-411z\"/\u003e\u003c/g\u003e\u003c/svg\u003e`, + headers: { 'Content-Type': 'text/xml' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-render.test.ts b/.brightsec/tests/post-api-render.test.ts new file mode 100644 index 00000000..52bcda9b --- /dev/null +++ b/.brightsec/tests/post-api-render.test.ts @@ -0,0 +1,36 @@ +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('POST /api/render', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['ssti', 'xss', 'osi', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/render`, + body: "Write your text here", + headers: { 'Content-Type': 'text/plain' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-subscriptions-email.test.ts b/.brightsec/tests/post-api-subscriptions-email.test.ts new file mode 100644 index 00000000..a4b29f16 --- /dev/null +++ b/.brightsec/tests/post-api-subscriptions-email.test.ts @@ -0,0 +1,34 @@ +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('POST /api/subscriptions?email=:email', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'email_injection', 'xss', 'improper_asset_management'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/subscriptions?email=john.doe@example.com` + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-users-basic.test.ts b/.brightsec/tests/post-api-users-basic.test.ts new file mode 100644 index 00000000..b339c184 --- /dev/null +++ b/.brightsec/tests/post-api-users-basic.test.ts @@ -0,0 +1,45 @@ +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('POST /api/users/basic', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'sqli', 'xss', 'email_injection', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/users/basic`, + body: { + email: 'john.doe@example.com', + firstName: 'John', + lastName: 'Doe', + company: 'Example Corp', + cardNumber: '1234-5678-9012-3456', + phoneNumber: '+1234567890', + password: 'securePassword123', + op: 'basic' + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-users-oidc.test.ts b/.brightsec/tests/post-api-users-oidc.test.ts new file mode 100644 index 00000000..802fc58f --- /dev/null +++ b/.brightsec/tests/post-api-users-oidc.test.ts @@ -0,0 +1,45 @@ +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('POST /api/users/oidc', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'bopla', 'ldapi', 'secret_tokens', 'xss', 'sqli', 'osi', 'xxe'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/users/oidc`, + body: { + email: 'john.doe@example.com', + firstName: 'John', + lastName: 'Doe', + company: 'Example Corp', + cardNumber: '1234-5678-9012-3456', + phoneNumber: '+1234567890', + password: 'securePassword123', + op: 'oidc' + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-all-products.test.ts b/.brightsec/tests/post-graphql-all-products.test.ts new file mode 100644 index 00000000..d42fa958 --- /dev/null +++ b/.brightsec/tests/post-graphql-all-products.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('POST /graphql allProducts', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['graphql_introspection', 'sqli', 'jwt', 'bopla'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/graphql`, + body: { + query: "query { allProducts { name category photoUrl description viewsCount } }" + }, + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-all-testimonials.test.ts b/.brightsec/tests/post-graphql-all-testimonials.test.ts new file mode 100644 index 00000000..34619cb6 --- /dev/null +++ b/.brightsec/tests/post-graphql-all-testimonials.test.ts @@ -0,0 +1,38 @@ +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('POST /graphql allTestimonials', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['graphql_introspection', 'bopla', 'sqli', 'xss', 'csrf'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/graphql`, + body: { + query: `query allTestimonials { allTestimonials { name title message } }` + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-get-command-result.test.ts b/.brightsec/tests/post-graphql-get-command-result.test.ts new file mode 100644 index 00000000..80183f4b --- /dev/null +++ b/.brightsec/tests/post-graphql-get-command-result.test.ts @@ -0,0 +1,39 @@ +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('POST /graphql getCommandResult', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['osi', 'graphql_introspection', 'sqli', 'xss'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/graphql`, + body: { + query: "query getCommandResult($command: String!) { getCommandResult(command: $command) }", + variables: { command: "ls -la" } + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-latest-products.test.ts b/.brightsec/tests/post-graphql-latest-products.test.ts new file mode 100644 index 00000000..24759146 --- /dev/null +++ b/.brightsec/tests/post-graphql-latest-products.test.ts @@ -0,0 +1,38 @@ +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('POST /graphql latestProducts', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'jwt', 'graphql_introspection', 'bopla', 'csrf'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/graphql`, + body: { + query: "query { latestProducts { name category photoUrl description viewsCount } }" + }, + headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-testimonials-count.test.ts b/.brightsec/tests/post-graphql-testimonials-count.test.ts new file mode 100644 index 00000000..cb3504de --- /dev/null +++ b/.brightsec/tests/post-graphql-testimonials-count.test.ts @@ -0,0 +1,39 @@ +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('POST /graphql testimonialsCount', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['graphql_introspection', 'sqli', 'bopla', 'jwt', 'csrf'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/graphql`, + body: { + query: "query testimonialsCount($query: String!) { testimonialsCount(query: $query) }", + variables: { query: "SELECT COUNT(*) FROM testimonials" } + }, + headers: { 'Content-Type': 'application/json' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-view-product.test.ts b/.brightsec/tests/post-graphql-view-product.test.ts new file mode 100644 index 00000000..621a3da1 --- /dev/null +++ b/.brightsec/tests/post-graphql-view-product.test.ts @@ -0,0 +1,39 @@ +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('POST /graphql viewProduct', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'jwt', 'graphql_introspection'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/graphql`, + body: { + query: "mutation viewProduct($productName: String!) { viewProduct(productName: $productName) }", + variables: { productName: "Amethyst" } + }, + headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' } + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/put-api-file-raw-path-some-path-to-file-png.test.ts b/.brightsec/tests/put-api-file-raw-path-some-path-to-file-png.test.ts new file mode 100644 index 00000000..d51d60c2 --- /dev/null +++ b/.brightsec/tests/put-api-file-raw-path-some-path-to-file-png.test.ts @@ -0,0 +1,36 @@ +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('PUT /api/file/raw?path=some/path/to/file.png', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['file_upload', 'lfi', 'ssrf', 'osi', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.PUT, + url: `${baseUrl}/api/file/raw?path=some/path/to/file.png`, + body: "This is a sample raw file content.", + headers: { 'Content-Type': 'text/plain' } + }); +}); \ No newline at end of file From 786dca602d15cd339b6353c397df5ded273efbbc Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 12:25:36 +0000 Subject: [PATCH 04/15] ci: add CI workflow to run e2e security tests --- .github/workflows/bright.yml | 73 +++++++++++++++++++ .../configure-bright-credentials/action.yaml | 53 ++++++++++++++ 2 files changed, 126 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 00000000..75980cbd --- /dev/null +++ b/.github/workflows/bright.yml @@ -0,0 +1,73 @@ +name: Bright + +on: + pull_request: + branches: + - '**' + +permissions: + checks: write + contents: read + id-token: write + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js 18.x + uses: actions/setup-node@v4 + with: + node-version: 18.x + + - name: Install application dependencies + run: npm ci --no-audit + + - name: Start application + env: + KC_BOOTSTRAP_ADMIN_PASSWORD: Pa55w0rd + KC_BOOTSTRAP_ADMIN_USERNAME: admin + KC_DB: postgres + KC_DB_PASSWORD: password + KC_DB_URL: jdbc:postgresql://keycloak-db:5432/keycloak + KC_DB_USERNAME: keycloak + POSTGRES_DB: bc + POSTGRES_PASSWORD: bc + POSTGRES_USER: bc + run: docker compose -f compose.local.yml up --wait + + - name: Verify application readiness + run: | + for i in {1..10}; do + nc -z 127.0.0.1 3000 && echo "Application is ready" && exit 0 + echo "Waiting for application to be ready..." + sleep 5 + done + echo "Application did not become ready in time" && exit 1 + + - name: Setup Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + + - name: Install SecTesterJS dependencies + run: npm i --save=false --prefix .brightsec @sectester/core @sectester/repeater @sectester/scan @sectester/runner @sectester/reporter + + - name: Configure Bright credentials + uses: ./.github/workflows/composite/configure-bright-credentials + with: + BRIGHT_HOSTNAME: https://development.playground.brightsec.com + BRIGHT_PROJECT_ID: mk3WHe9kadEadK4FBGQsEu + BRIGHT_TOKEN: ${{ secrets.BRIGHT_TOKEN }} + + - name: Run security tests + env: + BRIGHT_HOSTNAME: https://development.playground.brightsec.com + BRIGHT_PROJECT_ID: mk3WHe9kadEadK4FBGQsEu + BRIGHT_AUTH_ID: ${{ vars.BRIGHT_AUTH_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRIGHT_TOKEN: ${{ env.BRIGHT_TOKEN }} + BRIGHT_TARGET_URL: http://127.0.0.1:3000 + 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 00000000..84983846 --- /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 7e7a9f1b715a78f55d805eec012cd48ab388dce9 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:06:36 +0000 Subject: [PATCH 05/15] test: remove completed test files that are no longer relevant skip-checks:true --- .../delete-api-email-delete-emails.test.ts | 34 -------------- ...ig-products-crystals-some-file-jpg.test.ts | 34 -------------- .../tests/get-api-auth-dom-csrf-flow.test.ts | 35 --------------- .../tests/get-api-auth-oidc-client.test.ts | 34 -------------- .../get-api-auth-simple-csrf-flow.test.ts | 34 -------------- .brightsec/tests/get-api-config.test.ts | 34 -------------- .../tests/get-api-email-get-emails.test.ts | 35 --------------- .../get-api-email-send-support-email.test.ts | 35 --------------- ...fig-products-crystals-amethyst-jpg.test.ts | 35 --------------- .../tests/get-api-nestedjson-depth-2.test.ts | 35 --------------- .../tests/get-api-partners-query.test.ts | 35 --------------- .../tests/get-api-products-views.test.ts | 35 --------------- .../tests/get-api-testimonials-count.test.ts | 35 --------------- .brightsec/tests/get-api-testimonials.test.ts | 34 -------------- .../get-api-users-fullinfo-email.test.ts | 35 --------------- .brightsec/tests/get-api-users-ldap.test.ts | 35 --------------- .../tests/get-api-users-one-email.test.ts | 35 --------------- .../tests/get-api-users-search-john.test.ts | 34 -------------- .../tests/get-api-v1-userinfo-email.test.ts | 34 -------------- .../tests/get-graphql-select-count.test.ts | 34 -------------- .brightsec/tests/options-api.test.ts | 35 --------------- .../tests/post-api-auth-admin-login.test.ts | 40 ----------------- .../post-api-auth-jwt-hmac-login.test.ts | 40 ----------------- .../tests/post-api-auth-jwt-jku-login.test.ts | 40 ----------------- .../tests/post-api-auth-jwt-jwk-login.test.ts | 43 ------------------ .../post-api-auth-jwt-kid-sql-login.test.ts | 43 ------------------ .../post-api-auth-jwt-weak-key-login.test.ts | 43 ------------------ .../tests/post-api-auth-jwt-x5c-login.test.ts | 40 ----------------- .../tests/post-api-auth-jwt-x5u-login.test.ts | 40 ----------------- .brightsec/tests/post-api-auth-login.test.ts | 40 ----------------- .brightsec/tests/post-api-metadata.test.ts | 36 --------------- .../post-api-subscriptions-email.test.ts | 34 -------------- .brightsec/tests/post-api-users-basic.test.ts | 45 ------------------- .brightsec/tests/post-api-users-oidc.test.ts | 45 ------------------- .../tests/post-graphql-all-products.test.ts | 41 ----------------- .../post-graphql-all-testimonials.test.ts | 38 ---------------- .../post-graphql-latest-products.test.ts | 38 ---------------- .../post-graphql-testimonials-count.test.ts | 39 ---------------- ...ile-raw-path-some-path-to-file-png.test.ts | 36 --------------- 39 files changed, 1447 deletions(-) delete mode 100644 .brightsec/tests/delete-api-email-delete-emails.test.ts delete mode 100644 .brightsec/tests/delete-api-file-path-config-products-crystals-some-file-jpg.test.ts delete mode 100644 .brightsec/tests/get-api-auth-dom-csrf-flow.test.ts delete mode 100644 .brightsec/tests/get-api-auth-oidc-client.test.ts delete mode 100644 .brightsec/tests/get-api-auth-simple-csrf-flow.test.ts delete mode 100644 .brightsec/tests/get-api-config.test.ts delete mode 100644 .brightsec/tests/get-api-email-get-emails.test.ts delete mode 100644 .brightsec/tests/get-api-email-send-support-email.test.ts delete mode 100644 .brightsec/tests/get-api-file-raw-path-config-products-crystals-amethyst-jpg.test.ts delete mode 100644 .brightsec/tests/get-api-nestedjson-depth-2.test.ts delete mode 100644 .brightsec/tests/get-api-partners-query.test.ts delete mode 100644 .brightsec/tests/get-api-products-views.test.ts delete mode 100644 .brightsec/tests/get-api-testimonials-count.test.ts delete mode 100644 .brightsec/tests/get-api-testimonials.test.ts delete mode 100644 .brightsec/tests/get-api-users-fullinfo-email.test.ts delete mode 100644 .brightsec/tests/get-api-users-ldap.test.ts delete mode 100644 .brightsec/tests/get-api-users-one-email.test.ts delete mode 100644 .brightsec/tests/get-api-users-search-john.test.ts delete mode 100644 .brightsec/tests/get-api-v1-userinfo-email.test.ts delete mode 100644 .brightsec/tests/get-graphql-select-count.test.ts delete mode 100644 .brightsec/tests/options-api.test.ts delete mode 100644 .brightsec/tests/post-api-auth-admin-login.test.ts delete mode 100644 .brightsec/tests/post-api-auth-jwt-hmac-login.test.ts delete mode 100644 .brightsec/tests/post-api-auth-jwt-jku-login.test.ts delete mode 100644 .brightsec/tests/post-api-auth-jwt-jwk-login.test.ts delete mode 100644 .brightsec/tests/post-api-auth-jwt-kid-sql-login.test.ts delete mode 100644 .brightsec/tests/post-api-auth-jwt-weak-key-login.test.ts delete mode 100644 .brightsec/tests/post-api-auth-jwt-x5c-login.test.ts delete mode 100644 .brightsec/tests/post-api-auth-jwt-x5u-login.test.ts delete mode 100644 .brightsec/tests/post-api-auth-login.test.ts delete mode 100644 .brightsec/tests/post-api-metadata.test.ts delete mode 100644 .brightsec/tests/post-api-subscriptions-email.test.ts delete mode 100644 .brightsec/tests/post-api-users-basic.test.ts delete mode 100644 .brightsec/tests/post-api-users-oidc.test.ts delete mode 100644 .brightsec/tests/post-graphql-all-products.test.ts delete mode 100644 .brightsec/tests/post-graphql-all-testimonials.test.ts delete mode 100644 .brightsec/tests/post-graphql-latest-products.test.ts delete mode 100644 .brightsec/tests/post-graphql-testimonials-count.test.ts delete mode 100644 .brightsec/tests/put-api-file-raw-path-some-path-to-file-png.test.ts diff --git a/.brightsec/tests/delete-api-email-delete-emails.test.ts b/.brightsec/tests/delete-api-email-delete-emails.test.ts deleted file mode 100644 index 7a580028..00000000 --- a/.brightsec/tests/delete-api-email-delete-emails.test.ts +++ /dev/null @@ -1,34 +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('DELETE /api/email/deleteEmails', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'bopla', 'improper_asset_management', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.DELETE, - url: `${baseUrl}/api/email/deleteEmails` - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/delete-api-file-path-config-products-crystals-some-file-jpg.test.ts b/.brightsec/tests/delete-api-file-path-config-products-crystals-some-file-jpg.test.ts deleted file mode 100644 index 0d021615..00000000 --- a/.brightsec/tests/delete-api-file-path-config-products-crystals-some-file-jpg.test.ts +++ /dev/null @@ -1,34 +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('DELETE /api/file?path=config/products/crystals/some_file.jpg', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['lfi', 'ssrf', 'bopla', 'http_method_fuzzing', 'open_cloud_storage'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.DELETE, - url: `${baseUrl}/api/file?path=config/products/crystals/some_file.jpg` - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-dom-csrf-flow.test.ts b/.brightsec/tests/get-api-auth-dom-csrf-flow.test.ts deleted file mode 100644 index 1b1fd69b..00000000 --- a/.brightsec/tests/get-api-auth-dom-csrf-flow.test.ts +++ /dev/null @@ -1,35 +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 /api/auth/dom-csrf-flow', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'full_path_disclosure', 'xss'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/dom-csrf-flow`, - headers: { fingerprint: '12345' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-oidc-client.test.ts b/.brightsec/tests/get-api-auth-oidc-client.test.ts deleted file mode 100644 index 6a810a8c..00000000 --- a/.brightsec/tests/get-api-auth-oidc-client.test.ts +++ /dev/null @@ -1,34 +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 /api/auth/oidc-client', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'secret_tokens', 'unvalidated_redirect'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/oidc-client` - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-simple-csrf-flow.test.ts b/.brightsec/tests/get-api-auth-simple-csrf-flow.test.ts deleted file mode 100644 index 01dc8d95..00000000 --- a/.brightsec/tests/get-api-auth-simple-csrf-flow.test.ts +++ /dev/null @@ -1,34 +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 /api/auth/simple-csrf-flow', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'xss', 'http_method_fuzzing'], - attackParamLocations: [AttackParamLocation.HEADER, AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/simple-csrf-flow` - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-config.test.ts b/.brightsec/tests/get-api-config.test.ts deleted file mode 100644 index 4fae3d56..00000000 --- a/.brightsec/tests/get-api-config.test.ts +++ /dev/null @@ -1,34 +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 /api/config', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['open_database', 'secret_tokens', 'improper_asset_management'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/config` - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-email-get-emails.test.ts b/.brightsec/tests/get-api-email-get-emails.test.ts deleted file mode 100644 index 922c736f..00000000 --- a/.brightsec/tests/get-api-email-get-emails.test.ts +++ /dev/null @@ -1,35 +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 /api/email/getEmails', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['proto_pollution', 'business_constraint_bypass', 'improper_asset_management'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/email/getEmails?withSource=true`, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-email-send-support-email.test.ts b/.brightsec/tests/get-api-email-send-support-email.test.ts deleted file mode 100644 index cd09d91f..00000000 --- a/.brightsec/tests/get-api-email-send-support-email.test.ts +++ /dev/null @@ -1,35 +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 /api/email/sendSupportEmail', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['proto_pollution', 'email_injection', 'xss'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/email/sendSupportEmail?name=Bob%20Dylan&to=username%40email.com&subject=Help%20Request&content=I%20would%20like%20to%20request%20help%20regarding..`, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-file-raw-path-config-products-crystals-amethyst-jpg.test.ts b/.brightsec/tests/get-api-file-raw-path-config-products-crystals-amethyst-jpg.test.ts deleted file mode 100644 index 27539aeb..00000000 --- a/.brightsec/tests/get-api-file-raw-path-config-products-crystals-amethyst-jpg.test.ts +++ /dev/null @@ -1,35 +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 /api/file/raw?path=config/products/crystals/amethyst.jpg', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['lfi', 'ssrf', 'open_cloud_storage', 'full_path_disclosure', 'file_upload'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/file/raw?path=config/products/crystals/amethyst.jpg`, - headers: { accept: 'image/jpg' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-nestedjson-depth-2.test.ts b/.brightsec/tests/get-api-nestedjson-depth-2.test.ts deleted file mode 100644 index fdbcd6d1..00000000 --- a/.brightsec/tests/get-api-nestedjson-depth-2.test.ts +++ /dev/null @@ -1,35 +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 /api/nestedJson?depth=2', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['business_constraint_bypass', 'xss', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/nestedJson?depth=2`, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-partners-query.test.ts b/.brightsec/tests/get-api-partners-query.test.ts deleted file mode 100644 index ce2bc692..00000000 --- a/.brightsec/tests/get-api-partners-query.test.ts +++ /dev/null @@ -1,35 +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 /api/partners/query', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['xpathi', 'xss', 'xxe'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/partners/query?xpath=/partners/partner/name`, - headers: { 'Content-Type': 'text/xml' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-products-views.test.ts b/.brightsec/tests/get-api-products-views.test.ts deleted file mode 100644 index c84e9e69..00000000 --- a/.brightsec/tests/get-api-products-views.test.ts +++ /dev/null @@ -1,35 +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 /api/products/views', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['sqli', 'business_constraint_bypass', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/products/views`, - headers: { 'x-product-name': 'Amethyst' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-testimonials-count.test.ts b/.brightsec/tests/get-api-testimonials-count.test.ts deleted file mode 100644 index 8b20c8c2..00000000 --- a/.brightsec/tests/get-api-testimonials-count.test.ts +++ /dev/null @@ -1,35 +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 /api/testimonials/count', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['sqli', 'full_path_disclosure', 'business_constraint_bypass'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/testimonials/count?query=select%20count(*)%20as%20count%20from%20testimonial`, - headers: { 'Content-Type': 'text/html' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-testimonials.test.ts b/.brightsec/tests/get-api-testimonials.test.ts deleted file mode 100644 index c2993993..00000000 --- a/.brightsec/tests/get-api-testimonials.test.ts +++ /dev/null @@ -1,34 +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 /api/testimonials', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['sqli', 'business_constraint_bypass', 'full_path_disclosure', 'xss'], - attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/testimonials` - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-fullinfo-email.test.ts b/.brightsec/tests/get-api-users-fullinfo-email.test.ts deleted file mode 100644 index 08ef1416..00000000 --- a/.brightsec/tests/get-api-users-fullinfo-email.test.ts +++ /dev/null @@ -1,35 +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 /api/users/fullinfo/:email', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['bopla', 'id_enumeration', 'xss', 'csrf', 'open_database'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/fullinfo/john.doe@example.com`, - headers: { 'Access-Control-Request-Headers': 'OPTIONS, GET, POST, DELETE' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-ldap.test.ts b/.brightsec/tests/get-api-users-ldap.test.ts deleted file mode 100644 index 5f4dcd89..00000000 --- a/.brightsec/tests/get-api-users-ldap.test.ts +++ /dev/null @@ -1,35 +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 /api/users/ldap', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['ldapi', 'csrf', 'improper_asset_management', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/ldap?query=%28%26%28objectClass%3Dperson%29%28objectClass%3Duser%29%28email%3Djohn.doe%40example.com%29%29`, - headers: { 'Access-Control-Request-Headers': 'OPTIONS, GET, POST, DELETE' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-one-email.test.ts b/.brightsec/tests/get-api-users-one-email.test.ts deleted file mode 100644 index b8ec0394..00000000 --- a/.brightsec/tests/get-api-users-one-email.test.ts +++ /dev/null @@ -1,35 +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 /api/users/one/:email', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'id_enumeration', 'xss', 'ldapi', 'sqli', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/one/john.doe@example.com`, - headers: { 'Access-Control-Request-Headers': 'OPTIONS, GET, POST, DELETE' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-search-john.test.ts b/.brightsec/tests/get-api-users-search-john.test.ts deleted file mode 100644 index 767f69b6..00000000 --- a/.brightsec/tests/get-api-users-search-john.test.ts +++ /dev/null @@ -1,34 +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 /api/users/search/john', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['id_enumeration', 'sqli', 'xss', 'csrf', 'business_constraint_bypass'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/search/john` - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-v1-userinfo-email.test.ts b/.brightsec/tests/get-api-v1-userinfo-email.test.ts deleted file mode 100644 index 6954ddbc..00000000 --- a/.brightsec/tests/get-api-v1-userinfo-email.test.ts +++ /dev/null @@ -1,34 +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 /api/v1/userinfo/:email', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'id_enumeration', 'xss', 'sqli', 'email_injection', 'improper_asset_management'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/v1/userinfo/john.doe@example.com` - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-graphql-select-count.test.ts b/.brightsec/tests/get-graphql-select-count.test.ts deleted file mode 100644 index 5945e0fd..00000000 --- a/.brightsec/tests/get-graphql-select-count.test.ts +++ /dev/null @@ -1,34 +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 /graphql-select-count', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection', 'sqli', 'csrf', 'jwt'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/graphql?query=SELECT%20COUNT(*)%20FROM%20testimonials` - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/options-api.test.ts b/.brightsec/tests/options-api.test.ts deleted file mode 100644 index 163a89c1..00000000 --- a/.brightsec/tests/options-api.test.ts +++ /dev/null @@ -1,35 +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('OPTIONS /api', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['http_method_fuzzing', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.OPTIONS, - url: `${baseUrl}/api`, - headers: { allow: 'OPTIONS, GET, HEAD, POST' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-admin-login.test.ts b/.brightsec/tests/post-api-auth-admin-login.test.ts deleted file mode 100644 index ab92303f..00000000 --- a/.brightsec/tests/post-api-auth-admin-login.test.ts +++ /dev/null @@ -1,40 +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('POST /api/auth/admin/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'jwt', 'sqli', 'ldapi', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/auth/admin/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'oidc' - }, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-hmac-login.test.ts b/.brightsec/tests/post-api-auth-jwt-hmac-login.test.ts deleted file mode 100644 index c066a9c1..00000000 --- a/.brightsec/tests/post-api-auth-jwt-hmac-login.test.ts +++ /dev/null @@ -1,40 +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('POST /api/auth/jwt/hmac/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'sqli', 'osi', 'xss'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/auth/jwt/hmac/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'basic' - }, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-jku-login.test.ts b/.brightsec/tests/post-api-auth-jwt-jku-login.test.ts deleted file mode 100644 index 81330bbc..00000000 --- a/.brightsec/tests/post-api-auth-jwt-jku-login.test.ts +++ /dev/null @@ -1,40 +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('POST /api/auth/jwt/jku/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'sqli', 'osi', 'unvalidated_redirect'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/auth/jwt/jku/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'basic' - }, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-jwk-login.test.ts b/.brightsec/tests/post-api-auth-jwt-jwk-login.test.ts deleted file mode 100644 index 0022f054..00000000 --- a/.brightsec/tests/post-api-auth-jwt-jwk-login.test.ts +++ /dev/null @@ -1,43 +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('POST /api/auth/jwt/jwk/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'sqli', 'secret_tokens', 'osi'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/auth/jwt/jwk/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'basic' - }, - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiam9obiIsImV4cCI6MTYwOTI3MzYwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' - } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-kid-sql-login.test.ts b/.brightsec/tests/post-api-auth-jwt-kid-sql-login.test.ts deleted file mode 100644 index f7366ed9..00000000 --- a/.brightsec/tests/post-api-auth-jwt-kid-sql-login.test.ts +++ /dev/null @@ -1,43 +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('POST /api/auth/jwt/kid-sql/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['sqli', 'jwt', 'csrf', 'xss', 'osi'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/auth/jwt/kid-sql/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'basic' - }, - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiam9obkBleGFtcGxlLmNvbSIsImV4cCI6MTYwOTI3MzYwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' - } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-weak-key-login.test.ts b/.brightsec/tests/post-api-auth-jwt-weak-key-login.test.ts deleted file mode 100644 index fa7cd37b..00000000 --- a/.brightsec/tests/post-api-auth-jwt-weak-key-login.test.ts +++ /dev/null @@ -1,43 +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('POST /api/auth/jwt/weak-key/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'bopla', 'sqli', 'csrf', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/auth/jwt/weak-key/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'basic' - }, - headers: { - 'Content-Type': 'application/json', - authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9' - } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-x5c-login.test.ts b/.brightsec/tests/post-api-auth-jwt-x5c-login.test.ts deleted file mode 100644 index 30f754ef..00000000 --- a/.brightsec/tests/post-api-auth-jwt-x5c-login.test.ts +++ /dev/null @@ -1,40 +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('POST /api/auth/jwt/x5c/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'sqli', 'bopla', 'osi'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/auth/jwt/x5c/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'basic' - }, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-jwt-x5u-login.test.ts b/.brightsec/tests/post-api-auth-jwt-x5u-login.test.ts deleted file mode 100644 index 966e412f..00000000 --- a/.brightsec/tests/post-api-auth-jwt-x5u-login.test.ts +++ /dev/null @@ -1,40 +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('POST /api/auth/jwt/x5u/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'sqli', 'osi', 'xss'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/auth/jwt/x5u/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'basic' - }, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-auth-login.test.ts b/.brightsec/tests/post-api-auth-login.test.ts deleted file mode 100644 index 7cf4a30a..00000000 --- a/.brightsec/tests/post-api-auth-login.test.ts +++ /dev/null @@ -1,40 +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('POST /api/auth/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'jwt', 'sqli', 'xss', 'osi', 'ldapi'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/auth/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'basic' - }, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-metadata.test.ts b/.brightsec/tests/post-api-metadata.test.ts deleted file mode 100644 index eaf65984..00000000 --- a/.brightsec/tests/post-api-metadata.test.ts +++ /dev/null @@ -1,36 +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('POST /api/metadata', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['xxe', 'xss', 'osi', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/metadata`, - body: `\u003csvg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 915 585\"\u003e\u003cg stroke-width=\"3.45\" fill=\"none\"\u003e\u003cpath stroke=\"#000\" d=\"M11.8 11.8h411v411l-411 .01v-411z\"/\u003e\u003cpath stroke=\"#448\" d=\"M489 11.7h415v411H489v-411z\"/\u003e\u003c/g\u003e\u003c/svg\u003e`, - headers: { 'Content-Type': 'text/xml' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-subscriptions-email.test.ts b/.brightsec/tests/post-api-subscriptions-email.test.ts deleted file mode 100644 index a4b29f16..00000000 --- a/.brightsec/tests/post-api-subscriptions-email.test.ts +++ /dev/null @@ -1,34 +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('POST /api/subscriptions?email=:email', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'email_injection', 'xss', 'improper_asset_management'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/subscriptions?email=john.doe@example.com` - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-users-basic.test.ts b/.brightsec/tests/post-api-users-basic.test.ts deleted file mode 100644 index b339c184..00000000 --- a/.brightsec/tests/post-api-users-basic.test.ts +++ /dev/null @@ -1,45 +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('POST /api/users/basic', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'sqli', 'xss', 'email_injection', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/users/basic`, - body: { - email: 'john.doe@example.com', - firstName: 'John', - lastName: 'Doe', - company: 'Example Corp', - cardNumber: '1234-5678-9012-3456', - phoneNumber: '+1234567890', - password: 'securePassword123', - op: 'basic' - }, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-users-oidc.test.ts b/.brightsec/tests/post-api-users-oidc.test.ts deleted file mode 100644 index 802fc58f..00000000 --- a/.brightsec/tests/post-api-users-oidc.test.ts +++ /dev/null @@ -1,45 +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('POST /api/users/oidc', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'bopla', 'ldapi', 'secret_tokens', 'xss', 'sqli', 'osi', 'xxe'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/users/oidc`, - body: { - email: 'john.doe@example.com', - firstName: 'John', - lastName: 'Doe', - company: 'Example Corp', - cardNumber: '1234-5678-9012-3456', - phoneNumber: '+1234567890', - password: 'securePassword123', - op: 'oidc' - }, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-all-products.test.ts b/.brightsec/tests/post-graphql-all-products.test.ts deleted file mode 100644 index d42fa958..00000000 --- a/.brightsec/tests/post-graphql-all-products.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('POST /graphql allProducts', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection', 'sqli', 'jwt', 'bopla'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/graphql`, - body: { - query: "query { allProducts { name category photoUrl description viewsCount } }" - }, - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Bearer ' - } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-all-testimonials.test.ts b/.brightsec/tests/post-graphql-all-testimonials.test.ts deleted file mode 100644 index 34619cb6..00000000 --- a/.brightsec/tests/post-graphql-all-testimonials.test.ts +++ /dev/null @@ -1,38 +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('POST /graphql allTestimonials', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection', 'bopla', 'sqli', 'xss', 'csrf'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/graphql`, - body: { - query: `query allTestimonials { allTestimonials { name title message } }` - }, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-latest-products.test.ts b/.brightsec/tests/post-graphql-latest-products.test.ts deleted file mode 100644 index 24759146..00000000 --- a/.brightsec/tests/post-graphql-latest-products.test.ts +++ /dev/null @@ -1,38 +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('POST /graphql latestProducts', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['sqli', 'jwt', 'graphql_introspection', 'bopla', 'csrf'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/graphql`, - body: { - query: "query { latestProducts { name category photoUrl description viewsCount } }" - }, - headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-testimonials-count.test.ts b/.brightsec/tests/post-graphql-testimonials-count.test.ts deleted file mode 100644 index cb3504de..00000000 --- a/.brightsec/tests/post-graphql-testimonials-count.test.ts +++ /dev/null @@ -1,39 +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('POST /graphql testimonialsCount', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection', 'sqli', 'bopla', 'jwt', 'csrf'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/graphql`, - body: { - query: "query testimonialsCount($query: String!) { testimonialsCount(query: $query) }", - variables: { query: "SELECT COUNT(*) FROM testimonials" } - }, - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/put-api-file-raw-path-some-path-to-file-png.test.ts b/.brightsec/tests/put-api-file-raw-path-some-path-to-file-png.test.ts deleted file mode 100644 index d51d60c2..00000000 --- a/.brightsec/tests/put-api-file-raw-path-some-path-to-file-png.test.ts +++ /dev/null @@ -1,36 +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('PUT /api/file/raw?path=some/path/to/file.png', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['file_upload', 'lfi', 'ssrf', 'osi', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.PUT, - url: `${baseUrl}/api/file/raw?path=some/path/to/file.png`, - body: "This is a sample raw file content.", - headers: { 'Content-Type': 'text/plain' } - }); -}); \ No newline at end of file From 4d98c99eddb9cb7d8a03fcf88dbeb825b15ba284 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:07:44 +0000 Subject: [PATCH 06/15] test: optimize security tests to focus on specific vulnerabilities skip-checks:true --- .brightsec/tests/get-api-file-aws.test.ts | 4 ++-- .brightsec/tests/get-api-file-azure.test.ts | 4 ++-- .brightsec/tests/get-api-file-digital-ocean.test.ts | 4 ++-- .brightsec/tests/get-api-file-google.test.ts | 4 ++-- ...nfig-products-crystals-amethyst-jpg-type-image-jpg.test.ts | 2 +- .brightsec/tests/get-api-goto.test.ts | 4 ++-- .brightsec/tests/get-api-partners-partner-login.test.ts | 4 ++-- .brightsec/tests/get-api-partners-search-partners.test.ts | 4 ++-- .brightsec/tests/get-api-products-latest.test.ts | 4 ++-- .brightsec/tests/get-api-secrets.test.ts | 4 ++-- .brightsec/tests/get-api-users-id-1.test.ts | 4 ++-- .brightsec/tests/get-graphql-all-testimonials.test.ts | 2 +- .brightsec/tests/post-api-chat-query.test.ts | 2 +- .brightsec/tests/post-api-render.test.ts | 4 ++-- .brightsec/tests/post-graphql-get-command-result.test.ts | 4 ++-- .brightsec/tests/post-graphql-view-product.test.ts | 2 +- 16 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.brightsec/tests/get-api-file-aws.test.ts b/.brightsec/tests/get-api-file-aws.test.ts index c145674b..de09965c 100644 --- a/.brightsec/tests/get-api-file-aws.test.ts +++ b/.brightsec/tests/get-api-file-aws.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/file/aws', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['amazon_s3_takeover', 'open_cloud_storage', 'ssrf', 'lfi', 'unvalidated_redirect'], + tests: ['ssrf'], attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) @@ -32,4 +32,4 @@ test('GET /api/file/aws', { signal: AbortSignal.timeout(timeout) }, async () => url: `${baseUrl}/api/file/aws?path=config/products/crystals/amethyst.jpg&type=image/jpg`, headers: { accept: 'image/jpg' } }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-file-azure.test.ts b/.brightsec/tests/get-api-file-azure.test.ts index 61cc9e25..9e20e94c 100644 --- a/.brightsec/tests/get-api-file-azure.test.ts +++ b/.brightsec/tests/get-api-file-azure.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/file/azure', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['open_cloud_storage', 'lfi', 'ssrf', 'secret_tokens'], + tests: ['ssrf'], attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) @@ -32,4 +32,4 @@ test('GET /api/file/azure', { signal: AbortSignal.timeout(timeout) }, async () = url: `${baseUrl}/api/file/azure?path=config/products/crystals/amethyst.jpg&type=image/jpg`, headers: { accept: 'image/jpg' } }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-file-digital-ocean.test.ts b/.brightsec/tests/get-api-file-digital-ocean.test.ts index b6b72d2e..b157a21f 100644 --- a/.brightsec/tests/get-api-file-digital-ocean.test.ts +++ b/.brightsec/tests/get-api-file-digital-ocean.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/file/digital_ocean', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['ssrf', 'open_cloud_storage', 'lfi', 'unvalidated_redirect'], + tests: ['ssrf'], attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) @@ -32,4 +32,4 @@ test('GET /api/file/digital_ocean', { signal: AbortSignal.timeout(timeout) }, as url: `${baseUrl}/api/file/digital_ocean?path=config/products/crystals/amethyst.jpg&type=image/jpg`, headers: { accept: 'image/jpg' } }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-file-google.test.ts b/.brightsec/tests/get-api-file-google.test.ts index 4163d14e..0a4bfa8b 100644 --- a/.brightsec/tests/get-api-file-google.test.ts +++ b/.brightsec/tests/get-api-file-google.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/file/google?path=config/products/crystals/amethyst.jpg&type=image/jpg', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['lfi', 'ssrf', 'open_cloud_storage', 'unvalidated_redirect'], + tests: ['ssrf'], attackParamLocations: [AttackParamLocation.QUERY], starMetadata: { databases: ['PostgreSQL'] } }) @@ -32,4 +32,4 @@ test('GET /api/file/google?path=config/products/crystals/amethyst.jpg&type=image url: `${baseUrl}/api/file/google?path=config/products/crystals/amethyst.jpg&type=image/jpg`, headers: { accept: 'image/jpg' } }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts b/.brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts index 575b01b6..87409cec 100644 --- a/.brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts +++ b/.brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/file?path=config/products/crystals/amethyst.jpg&type=image/jpg', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['lfi', 'ssrf', 'open_cloud_storage', 'file_upload', 'full_path_disclosure'], + tests: ['lfi', 'full_path_disclosure', 'ssrf'], attackParamLocations: [AttackParamLocation.QUERY], starMetadata: { databases: ['PostgreSQL'] } }) diff --git a/.brightsec/tests/get-api-goto.test.ts b/.brightsec/tests/get-api-goto.test.ts index 32a30e02..0ef0b4bd 100644 --- a/.brightsec/tests/get-api-goto.test.ts +++ b/.brightsec/tests/get-api-goto.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/goto', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['unvalidated_redirect', 'ssrf'], + tests: ['unvalidated_redirect'], attackParamLocations: [AttackParamLocation.QUERY], starMetadata: { databases: ['PostgreSQL'] } }) @@ -31,4 +31,4 @@ test('GET /api/goto', { signal: AbortSignal.timeout(timeout) }, async () => { method: HttpMethod.GET, url: `${baseUrl}/api/goto?url=https://google.com` }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-partners-partner-login.test.ts b/.brightsec/tests/get-api-partners-partner-login.test.ts index ff7366a1..e0ac578d 100644 --- a/.brightsec/tests/get-api-partners-partner-login.test.ts +++ b/.brightsec/tests/get-api-partners-partner-login.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/partners/partnerLogin', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['xpathi', 'xss', 'full_path_disclosure'], + tests: ['xpathi'], attackParamLocations: [AttackParamLocation.QUERY], starMetadata: { databases: ['PostgreSQL'] } }) @@ -32,4 +32,4 @@ test('GET /api/partners/partnerLogin', { signal: AbortSignal.timeout(timeout) }, url: `${baseUrl}/api/partners/partnerLogin?username=walter100&password=Heisenberg123`, headers: { 'Content-Type': 'text/xml' } }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-partners-search-partners.test.ts b/.brightsec/tests/get-api-partners-search-partners.test.ts index 701e4f81..0aa6faee 100644 --- a/.brightsec/tests/get-api-partners-search-partners.test.ts +++ b/.brightsec/tests/get-api-partners-search-partners.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/partners/searchPartners', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['xpathi', 'xss', 'csrf', 'full_path_disclosure'], + tests: ['xpathi'], attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) @@ -32,4 +32,4 @@ test('GET /api/partners/searchPartners', { signal: AbortSignal.timeout(timeout) url: `${baseUrl}/api/partners/searchPartners?keyword=Walter`, headers: { 'Content-Type': 'text/xml' } }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-products-latest.test.ts b/.brightsec/tests/get-api-products-latest.test.ts index 88b569f7..e829c05a 100644 --- a/.brightsec/tests/get-api-products-latest.test.ts +++ b/.brightsec/tests/get-api-products-latest.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/products/latest', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['business_constraint_bypass', 'date_manipulation', 'sqli', 'csrf'], + tests: ['business_constraint_bypass'], attackParamLocations: [AttackParamLocation.QUERY], starMetadata: { databases: ['PostgreSQL'] }, skipStaticParams: true @@ -32,4 +32,4 @@ test('GET /api/products/latest', { signal: AbortSignal.timeout(timeout) }, async method: HttpMethod.GET, url: `${baseUrl}/api/products/latest?limit=3` }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-secrets.test.ts b/.brightsec/tests/get-api-secrets.test.ts index 1fe25431..9f94df21 100644 --- a/.brightsec/tests/get-api-secrets.test.ts +++ b/.brightsec/tests/get-api-secrets.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/secrets', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['secret_tokens', 'open_database', 'csrf'], + tests: ['secret_tokens'], attackParamLocations: [AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) @@ -31,4 +31,4 @@ test('GET /api/secrets', { signal: AbortSignal.timeout(timeout) }, async () => { method: HttpMethod.GET, url: `${baseUrl}/api/secrets` }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-users-id-1.test.ts b/.brightsec/tests/get-api-users-id-1.test.ts index ca80bab3..a1ef5b7b 100644 --- a/.brightsec/tests/get-api-users-id-1.test.ts +++ b/.brightsec/tests/get-api-users-id-1.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/users/id/1', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['id_enumeration', 'sqli', 'full_path_disclosure', 'csrf'], + tests: ['id_enumeration'], attackParamLocations: [AttackParamLocation.PATH], starMetadata: { databases: ['PostgreSQL'] } }) @@ -31,4 +31,4 @@ test('GET /api/users/id/1', { signal: AbortSignal.timeout(timeout) }, async () = method: HttpMethod.GET, url: `${baseUrl}/api/users/id/1` }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-graphql-all-testimonials.test.ts b/.brightsec/tests/get-graphql-all-testimonials.test.ts index d8a3b4cb..eb1db10c 100644 --- a/.brightsec/tests/get-graphql-all-testimonials.test.ts +++ b/.brightsec/tests/get-graphql-all-testimonials.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /graphql?query=allTestimonials', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['graphql_introspection', 'sqli', 'xss', 'csrf'], + tests: ['graphql_introspection'], attackParamLocations: [AttackParamLocation.QUERY], starMetadata: { databases: ['PostgreSQL'] } }) diff --git a/.brightsec/tests/post-api-chat-query.test.ts b/.brightsec/tests/post-api-chat-query.test.ts index d7452d68..7c8abffa 100644 --- a/.brightsec/tests/post-api-chat-query.test.ts +++ b/.brightsec/tests/post-api-chat-query.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('POST /api/chat/query', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['csrf', 'prompt_injection', 'secret_tokens', 'server_side_js_injection', 'ssrf'], + tests: ['prompt_injection'], attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) diff --git a/.brightsec/tests/post-api-render.test.ts b/.brightsec/tests/post-api-render.test.ts index 52bcda9b..94aafae0 100644 --- a/.brightsec/tests/post-api-render.test.ts +++ b/.brightsec/tests/post-api-render.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('POST /api/render', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['ssti', 'xss', 'osi', 'secret_tokens'], + tests: ['ssti'], attackParamLocations: [AttackParamLocation.BODY], starMetadata: { databases: ['PostgreSQL'] } }) @@ -33,4 +33,4 @@ test('POST /api/render', { signal: AbortSignal.timeout(timeout) }, async () => { body: "Write your text here", headers: { 'Content-Type': 'text/plain' } }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/post-graphql-get-command-result.test.ts b/.brightsec/tests/post-graphql-get-command-result.test.ts index 80183f4b..a277653e 100644 --- a/.brightsec/tests/post-graphql-get-command-result.test.ts +++ b/.brightsec/tests/post-graphql-get-command-result.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('POST /graphql getCommandResult', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['osi', 'graphql_introspection', 'sqli', 'xss'], + tests: ['graphql_introspection'], attackParamLocations: [AttackParamLocation.BODY], starMetadata: { databases: ['PostgreSQL'] } }) @@ -36,4 +36,4 @@ test('POST /graphql getCommandResult', { signal: AbortSignal.timeout(timeout) }, }, headers: { 'Content-Type': 'application/json' } }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/post-graphql-view-product.test.ts b/.brightsec/tests/post-graphql-view-product.test.ts index 621a3da1..32fd6267 100644 --- a/.brightsec/tests/post-graphql-view-product.test.ts +++ b/.brightsec/tests/post-graphql-view-product.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('POST /graphql viewProduct', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['sqli', 'jwt', 'graphql_introspection'], + tests: ['sqli', 'graphql_introspection'], attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) From 5c5714140fa004a7c55802cd26e3b126becd9dc9 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:16:56 +0000 Subject: [PATCH 07/15] fix: apply automated fixes for detected vulnerabilities --- src/app.controller.ts | 44 ++++++++++++++------------ src/app.module.ts | 7 +++-- src/chat/chat.controller.ts | 15 +++++++-- src/file/cloud.providers.metadata.ts | 2 +- src/file/file.controller.ts | 15 ++++++--- src/file/file.service.ts | 47 +++++++++++++--------------- src/partners/partners.controller.ts | 12 ++++--- src/partners/partners.service.ts | 24 +++++++++++++- src/products/products.controller.ts | 5 +-- src/products/products.resolver.ts | 5 ++- src/products/products.service.ts | 11 ++++--- src/users/users.controller.ts | 11 +++++-- 12 files changed, 123 insertions(+), 75 deletions(-) diff --git a/src/app.controller.ts b/src/app.controller.ts index 41f037b9..36c927c2 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -71,7 +71,9 @@ export class AppController { async renderTemplate(@Body() raw): Promise { if (typeof raw === 'string' || Buffer.isBuffer(raw)) { const text = raw.toString().trim(); - const res = dotT.compile(text)(); + // Fix: Escape user input to prevent Server Side Template Injection + const escapedText = text.replace(/\{\{.*?\}\}/g, ''); + const res = dotT.compile(escapedText)(); this.logger.debug(`Rendered template: ${res}`); return res; } @@ -87,6 +89,15 @@ export class AppController { }) @Redirect() async redirect(@Query('url') url: string) { + const allowedDomains = ['example.com', 'another-example.com']; + try { + const urlObj = new URL(url); + if (!allowedDomains.includes(urlObj.hostname)) { + throw new HttpException('Invalid redirect URL', HttpStatus.BAD_REQUEST); + } + } catch (error) { + throw new HttpException('Invalid URL format', HttpStatus.BAD_REQUEST); + } return { url }; } @@ -179,25 +190,18 @@ export class AppController { type: Object }) getSecrets(): Record { + // Fetch secrets from environment variables instead of hardcoding const secrets = { - codeclimate: - 'CODECLIMATE_REPO_TOKEN=62864c476ade6ab9d10d0ce0901ae2c211924852a28c5f960ae5165c1fdfec73', - facebook: - 'EAACEdEose0cBAHyDF5HI5o2auPWv3lPP3zNYuWWpjMrSaIhtSvX73lsLOcas5k8GhC5HgOXnbF3rXRTczOpsbNb54CQL8LcQEMhZAWAJzI0AzmL23hZByFAia5avB6Q4Xv4u2QVoAdH0mcJhYTFRpyJKIAyDKUEBzz0GgZDZD', - google_b64: 'QUl6YhT6QXlEQnbTr2dSdEI1W7yL2mFCX3c4PPP5NlpkWE65NkZV', - google_oauth: - '188968487735-c7hh7k87juef6vv84697sinju2bet7gn.apps.googleusercontent.com', - google_oauth_token: - 'ya29.a0TgU6SMDItdQQ9J7j3FVgJuByTTevl0FThTEkBs4pA4-9tFREyf2cfcL-_JU6Trg1O0NWwQKie4uGTrs35kmKlxohWgcAl8cg9DTxRx-UXFS-S1VYPLVtQLGYyNTfGp054Ad3ej73-FIHz3RZY43lcKSorbZEY4BI', - heroku: - 'herokudev.staging.endosome.975138 pid=48751 request_id=0e9a8698-a4d2-4925-a1a5-113234af5f60', - hockey_app: 'HockeySDK: 203d3af93f4a218bfb528de08ae5d30ff65e1cf', - outlook: - 'https://outlook.office.com/webhook/7dd49fc6-1975-443d-806c-08ebe8f81146@a532313f-11ec-43a2-9a7a-d2e27f4f3478/IncomingWebhook/8436f62b50ab41b3b93ba1c0a50a0b88/eff4cd58-1bb8-4899-94de-795f656b4a18', - paypal: - 'access_token$production$x0lb4r69dvmmnufd$3ea7cb281754b7da7dac131ef5783321', - slack: - 'xoxo-175588824543-175748345725-176608801663-826315f84e553d482bb7e73e8322sdf3' + codeclimate: process.env.CODECLIMATE_REPO_TOKEN || '', + facebook: process.env.FACEBOOK_TOKEN || '', + google_b64: process.env.GOOGLE_B64 || '', + google_oauth: process.env.GOOGLE_OAUTH || '', + google_oauth_token: process.env.GOOGLE_OAUTH_TOKEN || '', + heroku: process.env.HEROKU_TOKEN || '', + hockey_app: process.env.HOCKEY_APP_TOKEN || '', + outlook: process.env.OUTLOOK_WEBHOOK || '', + paypal: process.env.PAYPAL_ACCESS_TOKEN || '', + slack: process.env.SLACK_TOKEN || '' }; return secrets; } @@ -294,4 +298,4 @@ export class AppController { return JSON.stringify(jsonObj); } -} +} \ No newline at end of file diff --git a/src/app.module.ts b/src/app.module.ts index b7aba652..7bcee3f0 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -35,8 +35,9 @@ import { ChatModule } from './chat/chat.module'; HttpClientModule, GraphQLModule.forRoot({ driver: MercuriusDriver, - graphiql: true, - autoSchemaFile: true + graphiql: false, // Disable GraphiQL to prevent introspection + autoSchemaFile: true, + introspection: false // Disable introspection to secure the schema }), PartnersModule, EmailModule, @@ -55,4 +56,4 @@ export class AppModule { configure(consumer: MiddlewareConsumer) { consumer.apply(TraceMiddleware).forRoutes('(.*)'); } -} +} \ No newline at end of file diff --git a/src/chat/chat.controller.ts b/src/chat/chat.controller.ts index 9e19bda7..09a6836d 100644 --- a/src/chat/chat.controller.ts +++ b/src/chat/chat.controller.ts @@ -27,7 +27,13 @@ export class ChatController { }) async query(@Body() messages: ChatMessage[]): Promise { try { - return await this.chatService.query(messages); + // Validate and sanitize input messages + const sanitizedMessages = messages.map(message => ({ + role: message.role, + content: this.sanitizeInput(message.content) + })); + + return await this.chatService.query(sanitizedMessages); } catch (err) { throw new HttpException( `Chat API response error: ${err}`, @@ -35,4 +41,9 @@ export class ChatController { ); } } -} + + private sanitizeInput(input: string): string { + // Basic sanitization logic to prevent prompt injection + return input.replace(/[^\w\s.,!?]/g, ''); + } +} \ No newline at end of file diff --git a/src/file/cloud.providers.metadata.ts b/src/file/cloud.providers.metadata.ts index 0e4ad7db..3ff6caab 100644 --- a/src/file/cloud.providers.metadata.ts +++ b/src/file/cloud.providers.metadata.ts @@ -268,4 +268,4 @@ export class CloudProvidersMetaData { return data; } } -} +} \ No newline at end of file diff --git a/src/file/file.controller.ts b/src/file/file.controller.ts index f16058c0..22550a4f 100644 --- a/src/file/file.controller.ts +++ b/src/file/file.controller.ts @@ -86,11 +86,16 @@ export class FileController { @Query('type') contentType: string, @Res({ passthrough: true }) res: FastifyReply ) { - const file: Stream = await this.fileService.getFile(path); - const type = this.getContentType(contentType); - res.type(type); + try { + const file: Stream = await this.fileService.getFile(path); + const type = this.getContentType(contentType); + res.type(type); - return file; + return file; + } catch (err) { + this.logger.error(err.message); + res.status(HttpStatus.INTERNAL_SERVER_ERROR).send({ error: 'An error occurred while processing your request.' }); + } } @Get('/google') @@ -325,4 +330,4 @@ export class FileController { res.status(HttpStatus.NOT_FOUND); } } -} +} \ No newline at end of file diff --git a/src/file/file.service.ts b/src/file/file.service.ts index f88b3275..a070db3d 100644 --- a/src/file/file.service.ts +++ b/src/file/file.service.ts @@ -4,45 +4,40 @@ import * as fs from 'fs'; import * as path from 'path'; import { CloudProvidersMetaData } from './cloud.providers.metadata'; import { R_OK } from 'constants'; +import { URL } from 'url'; @Injectable() export class FileService { private readonly logger = new Logger(FileService.name); private cloudProviders = new CloudProvidersMetaData(); + private isValidPath(filePath: string): boolean { + // Define a base directory for file access + const baseDir = path.resolve(process.cwd(), 'allowed_files'); + const resolvedPath = path.resolve(baseDir, filePath); + return resolvedPath.startsWith(baseDir); + } + async getFile(file: string): Promise { this.logger.log(`Reading file: ${file}`); - if (file.startsWith('/')) { - await fs.promises.access(file, R_OK); - - return fs.createReadStream(file); - } else if (file.startsWith('http')) { - const content = await this.cloudProviders.get(file); - - if (content) { - return Readable.from(content); - } else { - throw new Error(`no such file or directory, access '${file}'`); - } - } else { - file = path.resolve(process.cwd(), file); + if (!this.isValidPath(file)) { + throw new Error('Access to this file path is not allowed.'); + } - await fs.promises.access(file, R_OK); + const resolvedFilePath = path.resolve(process.cwd(), 'allowed_files', file); + await fs.promises.access(resolvedFilePath, R_OK); - return fs.createReadStream(file); - } + return fs.createReadStream(resolvedFilePath); } async deleteFile(file: string): Promise { - if (file.startsWith('/')) { - throw new Error('cannot delete file from this location'); - } else if (file.startsWith('http')) { - throw new Error('cannot delete file from this location'); - } else { - file = path.resolve(process.cwd(), file); - await fs.promises.unlink(file); - return true; + if (!this.isValidPath(file)) { + throw new Error('Access to this file path is not allowed.'); } + + const resolvedFilePath = path.resolve(process.cwd(), 'allowed_files', file); + await fs.promises.unlink(resolvedFilePath); + return true; } -} +} \ No newline at end of file diff --git a/src/partners/partners.controller.ts b/src/partners/partners.controller.ts index ea74a771..5fc41b33 100644 --- a/src/partners/partners.controller.ts +++ b/src/partners/partners.controller.ts @@ -46,7 +46,9 @@ export class PartnersController { this.logger.debug(`Getting partners with xpath expression "${xpath}"`); try { - return this.partnersService.getPartnersProperties(xpath); + // Sanitize the xpath input to prevent injection + const sanitizedXpath = this.partnersService.sanitizeInput(xpath); + return this.partnersService.getPartnersProperties(sanitizedXpath); } catch (err) { throw new HttpException( `Failed to load XML using XPATH. Details: ${err}`, @@ -85,8 +87,7 @@ export class PartnersController { ); try { - const xpath = `//partners/partner[username/text()='${username}' and password/text()='${password}']/*`; - const xmlStr = this.partnersService.getPartnersProperties(xpath); + const xmlStr = this.partnersService.getPartnersProperties(username, password); // Check if account's data contains any information - If not, the login failed! if ( @@ -128,7 +129,8 @@ export class PartnersController { this.logger.debug(`Searching partner names by the keyword "${keyword}"`); try { - const xpath = `//partners/partner/name[contains(., '${keyword}')]`; + const sanitizedKeyword = this.partnersService.sanitizeInput(keyword); + const xpath = `//partners/partner/name[contains(., '${sanitizedKeyword}')]`; return this.partnersService.getPartnersProperties(xpath); } catch (err) { const errStr = err.toString(); @@ -144,4 +146,4 @@ export class PartnersController { ); } } -} +} \ No newline at end of file diff --git a/src/partners/partners.service.ts b/src/partners/partners.service.ts index 58d13f96..0598040a 100644 --- a/src/partners/partners.service.ts +++ b/src/partners/partners.service.ts @@ -71,6 +71,23 @@ export class PartnersService { } getPartnersProperties(xpathExpression: string): string { + const xmlNodes = this.selectPartnerPropertiesByXPATH(xpathExpression); + + if (!Array.isArray(xmlNodes)) { + this.logger.debug( + `xmlNodes's type wasn't 'Array', and it's value was: ${xmlNodes}` + ); + return this.getFormattedXMLOutput([]); + } + + this.logger.debug(`Raw xpath xmlNodes value is: ${xmlNodes}`); + return this.getFormattedXMLOutput(xmlNodes); + } + + getPartnersProperties(username: string, password: string): string { + const sanitizedUsername = this.sanitizeInput(username); + const sanitizedPassword = this.sanitizeInput(password); + const xpathExpression = `//partners/partner[username/text()='${sanitizedUsername}' and password/text()='${sanitizedPassword}']/*`; let xmlNodes = this.selectPartnerPropertiesByXPATH(xpathExpression); if (!Array.isArray(xmlNodes)) { @@ -84,4 +101,9 @@ export class PartnersService { return this.getFormattedXMLOutput(xmlNodes); } -} + + sanitizeInput(input: string): string { + // Escape single quotes and other potentially dangerous characters + return input.replace(/'/g, "\'").replace(/"/g, '\"').replace(/&/g, '&').replace(//g, '>'); + } +} \ No newline at end of file diff --git a/src/products/products.controller.ts b/src/products/products.controller.ts index f8720c82..11053f65 100644 --- a/src/products/products.controller.ts +++ b/src/products/products.controller.ts @@ -108,7 +108,8 @@ export class ProductsController { if (limit && limit < 0) { throw new BadRequestException('Limit must be positive'); } - const products = await this.productsService.findLatest(limit || 3); + const maxLimit = 10; // Set a maximum limit for the number of products + const products = await this.productsService.findLatest(Math.min(limit || 3, maxLimit)); return products.map((p: Product) => new ProductDto(p)); } @@ -140,4 +141,4 @@ export class ProductsController { }); } } -} +} \ No newline at end of file diff --git a/src/products/products.resolver.ts b/src/products/products.resolver.ts index 300eb0de..e46232bc 100644 --- a/src/products/products.resolver.ts +++ b/src/products/products.resolver.ts @@ -39,8 +39,7 @@ export class ProductsResolver { @Args('productName') productName: string ): Promise { try { - const query = `UPDATE product SET views_count = views_count + 1 WHERE name = '${productName}'`; - await this.productsService.updateProduct(query); + await this.productsService.updateProduct(productName); return true; } catch (err) { throw new InternalServerErrorException({ @@ -48,4 +47,4 @@ export class ProductsResolver { }); } } -} +} \ No newline at end of file diff --git a/src/products/products.service.ts b/src/products/products.service.ts index 02d3fa61..c70021a8 100644 --- a/src/products/products.service.ts +++ b/src/products/products.service.ts @@ -50,14 +50,17 @@ export class ProductsService { ); } - async updateProduct(query: string): Promise { + async updateProduct(productName: string): Promise { try { - this.logger.debug(`Updating products table with query "${query}"`); - await this.em.getConnection().execute(query); + this.logger.debug(`Updating products table for product name "${productName}"`); + await this.em.getConnection().execute( + 'UPDATE product SET views_count = views_count + 1 WHERE name = ?', + [productName] + ); return; } catch (err) { this.logger.warn(`Failed to execute query. Error: ${err.message}`); throw new InternalServerErrorException(err.message); } } -} +} \ No newline at end of file diff --git a/src/users/users.controller.ts b/src/users/users.controller.ts index 8320d218..be47645c 100644 --- a/src/users/users.controller.ts +++ b/src/users/users.controller.ts @@ -135,10 +135,15 @@ export class UsersController { } } }) - async getById(@Param('id') id: number): Promise { + @UseGuards(AuthGuard) + async getById(@Param('id') id: number, @Req() req: FastifyRequest): Promise { try { this.logger.debug(`Find a user by id: ${id}`); - return new UserDto(await this.usersService.findById(id)); + const user = await this.usersService.findById(id); + if (this.originEmail(req) !== user.email) { + throw new ForbiddenException(); + } + return new UserDto(user); } catch (err) { throw new HttpException(err.message, err.status); } @@ -578,4 +583,4 @@ export class UsersController { ); } } -} +} \ No newline at end of file From 9b582ce0bbf1df09cfc2e1fe8cf9833db2ee07f3 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:30:28 +0000 Subject: [PATCH 08/15] test: remove completed test files that are no longer relevant skip-checks:true --- .brightsec/tests/get-api-file-aws.test.ts | 35 ----------------- .brightsec/tests/get-api-file-azure.test.ts | 35 ----------------- .../tests/get-api-file-digital-ocean.test.ts | 35 ----------------- .brightsec/tests/get-api-file-google.test.ts | 35 ----------------- ...ystals-amethyst-jpg-type-image-jpg.test.ts | 35 ----------------- .../get-api-partners-search-partners.test.ts | 35 ----------------- .brightsec/tests/get-api-secrets.test.ts | 34 ---------------- .brightsec/tests/get-api-users-id-1.test.ts | 34 ---------------- .brightsec/tests/post-api-chat-query.test.ts | 36 ----------------- .brightsec/tests/post-api-render.test.ts | 36 ----------------- .../post-graphql-get-command-result.test.ts | 39 ------------------- 11 files changed, 389 deletions(-) delete mode 100644 .brightsec/tests/get-api-file-aws.test.ts delete mode 100644 .brightsec/tests/get-api-file-azure.test.ts delete mode 100644 .brightsec/tests/get-api-file-digital-ocean.test.ts delete mode 100644 .brightsec/tests/get-api-file-google.test.ts delete mode 100644 .brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts delete mode 100644 .brightsec/tests/get-api-partners-search-partners.test.ts delete mode 100644 .brightsec/tests/get-api-secrets.test.ts delete mode 100644 .brightsec/tests/get-api-users-id-1.test.ts delete mode 100644 .brightsec/tests/post-api-chat-query.test.ts delete mode 100644 .brightsec/tests/post-api-render.test.ts delete mode 100644 .brightsec/tests/post-graphql-get-command-result.test.ts diff --git a/.brightsec/tests/get-api-file-aws.test.ts b/.brightsec/tests/get-api-file-aws.test.ts deleted file mode 100644 index de09965c..00000000 --- a/.brightsec/tests/get-api-file-aws.test.ts +++ /dev/null @@ -1,35 +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 /api/file/aws', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['ssrf'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/file/aws?path=config/products/crystals/amethyst.jpg&type=image/jpg`, - headers: { accept: 'image/jpg' } - }); -}); diff --git a/.brightsec/tests/get-api-file-azure.test.ts b/.brightsec/tests/get-api-file-azure.test.ts deleted file mode 100644 index 9e20e94c..00000000 --- a/.brightsec/tests/get-api-file-azure.test.ts +++ /dev/null @@ -1,35 +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 /api/file/azure', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['ssrf'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/file/azure?path=config/products/crystals/amethyst.jpg&type=image/jpg`, - headers: { accept: 'image/jpg' } - }); -}); diff --git a/.brightsec/tests/get-api-file-digital-ocean.test.ts b/.brightsec/tests/get-api-file-digital-ocean.test.ts deleted file mode 100644 index b157a21f..00000000 --- a/.brightsec/tests/get-api-file-digital-ocean.test.ts +++ /dev/null @@ -1,35 +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 /api/file/digital_ocean', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['ssrf'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/file/digital_ocean?path=config/products/crystals/amethyst.jpg&type=image/jpg`, - headers: { accept: 'image/jpg' } - }); -}); diff --git a/.brightsec/tests/get-api-file-google.test.ts b/.brightsec/tests/get-api-file-google.test.ts deleted file mode 100644 index 0a4bfa8b..00000000 --- a/.brightsec/tests/get-api-file-google.test.ts +++ /dev/null @@ -1,35 +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 /api/file/google?path=config/products/crystals/amethyst.jpg&type=image/jpg', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['ssrf'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/file/google?path=config/products/crystals/amethyst.jpg&type=image/jpg`, - headers: { accept: 'image/jpg' } - }); -}); diff --git a/.brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts b/.brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts deleted file mode 100644 index 87409cec..00000000 --- a/.brightsec/tests/get-api-file-path-config-products-crystals-amethyst-jpg-type-image-jpg.test.ts +++ /dev/null @@ -1,35 +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 /api/file?path=config/products/crystals/amethyst.jpg&type=image/jpg', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['lfi', 'full_path_disclosure', 'ssrf'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/file?path=config/products/crystals/amethyst.jpg&type=image/jpg`, - headers: { accept: 'image/jpg' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-partners-search-partners.test.ts b/.brightsec/tests/get-api-partners-search-partners.test.ts deleted file mode 100644 index 0aa6faee..00000000 --- a/.brightsec/tests/get-api-partners-search-partners.test.ts +++ /dev/null @@ -1,35 +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 /api/partners/searchPartners', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['xpathi'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/partners/searchPartners?keyword=Walter`, - headers: { 'Content-Type': 'text/xml' } - }); -}); diff --git a/.brightsec/tests/get-api-secrets.test.ts b/.brightsec/tests/get-api-secrets.test.ts deleted file mode 100644 index 9f94df21..00000000 --- a/.brightsec/tests/get-api-secrets.test.ts +++ /dev/null @@ -1,34 +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 /api/secrets', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['secret_tokens'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/secrets` - }); -}); diff --git a/.brightsec/tests/get-api-users-id-1.test.ts b/.brightsec/tests/get-api-users-id-1.test.ts deleted file mode 100644 index a1ef5b7b..00000000 --- a/.brightsec/tests/get-api-users-id-1.test.ts +++ /dev/null @@ -1,34 +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 /api/users/id/1', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['id_enumeration'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/id/1` - }); -}); diff --git a/.brightsec/tests/post-api-chat-query.test.ts b/.brightsec/tests/post-api-chat-query.test.ts deleted file mode 100644 index 7c8abffa..00000000 --- a/.brightsec/tests/post-api-chat-query.test.ts +++ /dev/null @@ -1,36 +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('POST /api/chat/query', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['prompt_injection'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/chat/query`, - body: [{ role: 'user', content: 'Hello, how are you?' }], - headers: { 'Content-Type': 'application/json' } - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-render.test.ts b/.brightsec/tests/post-api-render.test.ts deleted file mode 100644 index 94aafae0..00000000 --- a/.brightsec/tests/post-api-render.test.ts +++ /dev/null @@ -1,36 +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('POST /api/render', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['ssti'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/render`, - body: "Write your text here", - headers: { 'Content-Type': 'text/plain' } - }); -}); diff --git a/.brightsec/tests/post-graphql-get-command-result.test.ts b/.brightsec/tests/post-graphql-get-command-result.test.ts deleted file mode 100644 index a277653e..00000000 --- a/.brightsec/tests/post-graphql-get-command-result.test.ts +++ /dev/null @@ -1,39 +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('POST /graphql getCommandResult', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/graphql`, - body: { - query: "query getCommandResult($command: String!) { getCommandResult(command: $command) }", - variables: { command: "ls -la" } - }, - headers: { 'Content-Type': 'application/json' } - }); -}); From e21ca294c8fd176e8f1517e9614765393366d522 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:30:50 +0000 Subject: [PATCH 09/15] test: optimize security tests to focus on specific vulnerabilities skip-checks:true --- .brightsec/tests/get-graphql-all-testimonials.test.ts | 2 +- .brightsec/tests/post-graphql-view-product.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.brightsec/tests/get-graphql-all-testimonials.test.ts b/.brightsec/tests/get-graphql-all-testimonials.test.ts index eb1db10c..ef4f4544 100644 --- a/.brightsec/tests/get-graphql-all-testimonials.test.ts +++ b/.brightsec/tests/get-graphql-all-testimonials.test.ts @@ -31,4 +31,4 @@ test('GET /graphql?query=allTestimonials', { signal: AbortSignal.timeout(timeout method: HttpMethod.GET, url: `${baseUrl}/graphql?query=query%20allTestimonials%20%7B%20allTestimonials%20%7B%20name%20title%20message%20%7D%20%7D` }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/post-graphql-view-product.test.ts b/.brightsec/tests/post-graphql-view-product.test.ts index 32fd6267..c37a71a3 100644 --- a/.brightsec/tests/post-graphql-view-product.test.ts +++ b/.brightsec/tests/post-graphql-view-product.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('POST /graphql viewProduct', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['sqli', 'graphql_introspection'], + tests: ['graphql_introspection'], attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) From 28ee8e96e2ff7b9d5c1fef54b209d19ed98140d4 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:33:19 +0000 Subject: [PATCH 10/15] fix: apply automated fixes for detected vulnerabilities --- src/main.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 1ee24140..17af7f76 100644 --- a/src/main.ts +++ b/src/main.ts @@ -231,6 +231,14 @@ async function bootstrap() { SwaggerModule.setup('swagger', app, document); + // Disable GraphQL introspection in production + if (process.env.NODE_ENV === 'production') { + app.useGlobalPipes({ + transform: true, + disableIntrospection: true + }); + } + await app.listen(3000, '0.0.0.0'); } @@ -252,4 +260,4 @@ if (cluster.isPrimary && process.env.NODE_ENV === 'production') { } else { bootstrap(); console.log(`Worker ${process.pid} started`); -} +} \ No newline at end of file From a523ed5a3555fbd3855bb03b107d1d868f6d5e70 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:39:07 +0000 Subject: [PATCH 11/15] test: optimize security tests to focus on specific vulnerabilities skip-checks:true --- .brightsec/tests/post-graphql-view-product.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.brightsec/tests/post-graphql-view-product.test.ts b/.brightsec/tests/post-graphql-view-product.test.ts index c37a71a3..b72ec989 100644 --- a/.brightsec/tests/post-graphql-view-product.test.ts +++ b/.brightsec/tests/post-graphql-view-product.test.ts @@ -36,4 +36,4 @@ test('POST /graphql viewProduct', { signal: AbortSignal.timeout(timeout) }, asyn }, headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' } }); -}); \ No newline at end of file +}); From 64e087185cfe61991765db5660160f17d2c321d5 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:41:22 +0000 Subject: [PATCH 12/15] fix: apply automated fixes for detected vulnerabilities From af28665ca0dce1dbd0cdad367733b85868521af0 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:51:13 +0000 Subject: [PATCH 13/15] fix: apply automated fixes for detected vulnerabilities From f71b43bf924d0293582d1d60c7d90f46000406cc Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:59:45 +0000 Subject: [PATCH 14/15] fix: apply automated fixes for detected vulnerabilities From f86dfa1226d4e5092856882332030b44676f2a51 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:06:04 +0000 Subject: [PATCH 15/15] revert: restore original workflow files and remove temporary one --- .brightsec/tests/get-api-goto.test.ts | 34 --------- .../get-api-partners-partner-login.test.ts | 35 --------- .../tests/get-api-products-latest.test.ts | 35 --------- .../get-graphql-all-testimonials.test.ts | 34 --------- .../tests/post-graphql-view-product.test.ts | 39 ---------- .github/workflows/bright.yml | 73 ------------------- .../configure-bright-credentials/action.yaml | 53 -------------- 7 files changed, 303 deletions(-) delete mode 100644 .brightsec/tests/get-api-goto.test.ts delete mode 100644 .brightsec/tests/get-api-partners-partner-login.test.ts delete mode 100644 .brightsec/tests/get-api-products-latest.test.ts delete mode 100644 .brightsec/tests/get-graphql-all-testimonials.test.ts delete mode 100644 .brightsec/tests/post-graphql-view-product.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-api-goto.test.ts b/.brightsec/tests/get-api-goto.test.ts deleted file mode 100644 index 0ef0b4bd..00000000 --- a/.brightsec/tests/get-api-goto.test.ts +++ /dev/null @@ -1,34 +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 /api/goto', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['unvalidated_redirect'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/goto?url=https://google.com` - }); -}); diff --git a/.brightsec/tests/get-api-partners-partner-login.test.ts b/.brightsec/tests/get-api-partners-partner-login.test.ts deleted file mode 100644 index e0ac578d..00000000 --- a/.brightsec/tests/get-api-partners-partner-login.test.ts +++ /dev/null @@ -1,35 +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 /api/partners/partnerLogin', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['xpathi'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/partners/partnerLogin?username=walter100&password=Heisenberg123`, - headers: { 'Content-Type': 'text/xml' } - }); -}); diff --git a/.brightsec/tests/get-api-products-latest.test.ts b/.brightsec/tests/get-api-products-latest.test.ts deleted file mode 100644 index e829c05a..00000000 --- a/.brightsec/tests/get-api-products-latest.test.ts +++ /dev/null @@ -1,35 +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 /api/products/latest', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['business_constraint_bypass'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] }, - skipStaticParams: true - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/products/latest?limit=3` - }); -}); diff --git a/.brightsec/tests/get-graphql-all-testimonials.test.ts b/.brightsec/tests/get-graphql-all-testimonials.test.ts deleted file mode 100644 index ef4f4544..00000000 --- a/.brightsec/tests/get-graphql-all-testimonials.test.ts +++ /dev/null @@ -1,34 +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 /graphql?query=allTestimonials', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/graphql?query=query%20allTestimonials%20%7B%20allTestimonials%20%7B%20name%20title%20message%20%7D%20%7D` - }); -}); diff --git a/.brightsec/tests/post-graphql-view-product.test.ts b/.brightsec/tests/post-graphql-view-product.test.ts deleted file mode 100644 index b72ec989..00000000 --- a/.brightsec/tests/post-graphql-view-product.test.ts +++ /dev/null @@ -1,39 +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('POST /graphql viewProduct', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/graphql`, - body: { - query: "mutation viewProduct($productName: String!) { viewProduct(productName: $productName) }", - variables: { productName: "Amethyst" } - }, - headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' } - }); -}); diff --git a/.github/workflows/bright.yml b/.github/workflows/bright.yml deleted file mode 100644 index 75980cbd..00000000 --- a/.github/workflows/bright.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Bright - -on: - pull_request: - branches: - - '**' - -permissions: - checks: write - contents: read - id-token: write - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js 18.x - uses: actions/setup-node@v4 - with: - node-version: 18.x - - - name: Install application dependencies - run: npm ci --no-audit - - - name: Start application - env: - KC_BOOTSTRAP_ADMIN_PASSWORD: Pa55w0rd - KC_BOOTSTRAP_ADMIN_USERNAME: admin - KC_DB: postgres - KC_DB_PASSWORD: password - KC_DB_URL: jdbc:postgresql://keycloak-db:5432/keycloak - KC_DB_USERNAME: keycloak - POSTGRES_DB: bc - POSTGRES_PASSWORD: bc - POSTGRES_USER: bc - run: docker compose -f compose.local.yml up --wait - - - name: Verify application readiness - run: | - for i in {1..10}; do - nc -z 127.0.0.1 3000 && echo "Application is ready" && exit 0 - echo "Waiting for application to be ready..." - sleep 5 - done - echo "Application did not become ready in time" && exit 1 - - - name: Setup Node.js 22.x - uses: actions/setup-node@v4 - with: - node-version: 22.x - - - name: Install SecTesterJS dependencies - run: npm i --save=false --prefix .brightsec @sectester/core @sectester/repeater @sectester/scan @sectester/runner @sectester/reporter - - - name: Configure Bright credentials - uses: ./.github/workflows/composite/configure-bright-credentials - with: - BRIGHT_HOSTNAME: https://development.playground.brightsec.com - BRIGHT_PROJECT_ID: mk3WHe9kadEadK4FBGQsEu - BRIGHT_TOKEN: ${{ secrets.BRIGHT_TOKEN }} - - - name: Run security tests - env: - BRIGHT_HOSTNAME: https://development.playground.brightsec.com - BRIGHT_PROJECT_ID: mk3WHe9kadEadK4FBGQsEu - BRIGHT_AUTH_ID: ${{ vars.BRIGHT_AUTH_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRIGHT_TOKEN: ${{ env.BRIGHT_TOKEN }} - BRIGHT_TARGET_URL: http://127.0.0.1:3000 - 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 84983846..00000000 --- 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