From a254b930c3f418353d29d299cff8bdc02581f063 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 09:42:29 +0000 Subject: [PATCH 1/8] chore: initialize PR with an empty commit skip-checks:true From 81f41522311d32889c848177e4890e7531ced460 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 10:07:21 +0000 Subject: [PATCH 2/8] 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 c45bcc1046422c154352bb3a4cb4f30ce6af823c Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 10:25:10 +0000 Subject: [PATCH 3/8] test: add auto-generated e2e security tests skip-checks:true --- .../delete-api-email-delete-emails.test.ts | 35 +++++++++++++ ...ig-products-crystals-some-file-jpg.test.ts | 35 +++++++++++++ .../delete-api-users-one-1-photo.test.ts | 36 ++++++++++++++ .../tests/get-api-auth-dom-csrf-flow.test.ts | 36 ++++++++++++++ .../get-api-auth-jwt-hmac-validate.test.ts | 36 ++++++++++++++ .../get-api-auth-jwt-jku-validate.test.ts | 36 ++++++++++++++ .../get-api-auth-jwt-jwk-validate.test.ts | 36 ++++++++++++++ .../get-api-auth-jwt-kid-sql-validate.test.ts | 36 ++++++++++++++ ...pi-auth-jwt-rsa-signature-validate.test.ts | 36 ++++++++++++++ ...get-api-auth-jwt-weak-key-validate.test.ts | 36 ++++++++++++++ .../get-api-auth-jwt-x5c-validate.test.ts | 36 ++++++++++++++ .../get-api-auth-jwt-x5u-validate.test.ts | 36 ++++++++++++++ .../tests/get-api-auth-oidc-client.test.ts | 35 +++++++++++++ .../get-api-auth-simple-csrf-flow.test.ts | 35 +++++++++++++ .brightsec/tests/get-api-config.test.ts | 35 +++++++++++++ .../tests/get-api-email-get-emails.test.ts | 36 ++++++++++++++ .../get-api-email-send-support-email.test.ts | 36 ++++++++++++++ .brightsec/tests/get-api-file-aws.test.ts | 36 ++++++++++++++ .brightsec/tests/get-api-file-azure.test.ts | 36 ++++++++++++++ .../tests/get-api-file-digital-ocean.test.ts | 36 ++++++++++++++ .brightsec/tests/get-api-file-google.test.ts | 36 ++++++++++++++ ...fig-products-crystals-amethyst-jpg.test.ts | 36 ++++++++++++++ .brightsec/tests/get-api-file.test.ts | 36 ++++++++++++++ .brightsec/tests/get-api-goto.test.ts | 35 +++++++++++++ .../tests/get-api-nested-json-depth-1.test.ts | 37 ++++++++++++++ .../get-api-partners-partner-login.test.ts | 36 ++++++++++++++ .../tests/get-api-partners-query.test.ts | 36 ++++++++++++++ .../get-api-partners-search-partners.test.ts | 36 ++++++++++++++ .../tests/get-api-products-latest.test.ts | 37 ++++++++++++++ .../tests/get-api-products-views.test.ts | 36 ++++++++++++++ .brightsec/tests/get-api-products.test.ts | 37 ++++++++++++++ .brightsec/tests/get-api-secrets.test.ts | 35 +++++++++++++ .../tests/get-api-spawn-command.test.ts | 35 +++++++++++++ .../tests/get-api-testimonials-count.test.ts | 36 ++++++++++++++ .brightsec/tests/get-api-testimonials.test.ts | 35 +++++++++++++ .../get-api-users-fullinfo-email.test.ts | 35 +++++++++++++ .brightsec/tests/get-api-users-id-1.test.ts | 35 +++++++++++++ .brightsec/tests/get-api-users-ldap.test.ts | 35 +++++++++++++ ...pi-users-one-email-adminpermission.test.ts | 36 ++++++++++++++ .../get-api-users-one-email-info.test.ts | 36 ++++++++++++++ .../get-api-users-one-email-photo.test.ts | 36 ++++++++++++++ .../tests/get-api-users-one-email.test.ts | 35 +++++++++++++ .../tests/get-api-users-search-john.test.ts | 35 +++++++++++++ .../tests/get-api-v1-userinfo-email.test.ts | 35 +++++++++++++ ...2-userinfo-john-doe-at-example-com.test.ts | 36 ++++++++++++++ .brightsec/tests/options-api-users.test.ts | 36 ++++++++++++++ .brightsec/tests/options-api.test.ts | 36 ++++++++++++++ .../tests/post-api-auth-admin-login.test.ts | 41 ++++++++++++++++ .../post-api-auth-jwt-hmac-login.test.ts | 44 +++++++++++++++++ .../tests/post-api-auth-jwt-jku-login.test.ts | 41 ++++++++++++++++ .../tests/post-api-auth-jwt-jwk-login.test.ts | 41 ++++++++++++++++ .../post-api-auth-jwt-kid-sql-login.test.ts | 41 ++++++++++++++++ .../post-api-auth-jwt-weak-key-login.test.ts | 44 +++++++++++++++++ .../tests/post-api-auth-jwt-x5c-login.test.ts | 41 ++++++++++++++++ .../tests/post-api-auth-jwt-x5u-login.test.ts | 44 +++++++++++++++++ .brightsec/tests/post-api-auth-login.test.ts | 44 +++++++++++++++++ .brightsec/tests/post-api-chat-query.test.ts | 37 ++++++++++++++ .brightsec/tests/post-api-metadata.test.ts | 37 ++++++++++++++ .brightsec/tests/post-api-render.test.ts | 37 ++++++++++++++ .../tests/post-api-subscriptions.test.ts | 35 +++++++++++++ .../tests/post-api-testimonials.test.ts | 44 +++++++++++++++++ .brightsec/tests/post-api-users-basic.test.ts | 44 +++++++++++++++++ .brightsec/tests/post-api-users-oidc.test.ts | 47 ++++++++++++++++++ .../tests/post-graphql-all-products.test.ts | 39 +++++++++++++++ .../post-graphql-all-testimonials.test.ts | 39 +++++++++++++++ .../post-graphql-create-testimonial.test.ts | 49 +++++++++++++++++++ .../post-graphql-get-command-result.test.ts | 40 +++++++++++++++ .../post-graphql-latest-products.test.ts | 39 +++++++++++++++ .../post-graphql-testimonials-count.test.ts | 40 +++++++++++++++ .../tests/post-graphql-view-product.test.ts | 40 +++++++++++++++ ...ile-raw-path-some-path-to-file-png.test.ts | 37 ++++++++++++++ .../put-api-users-one-email-info.test.ts | 44 +++++++++++++++++ .../put-api-users-one-email-photo.test.ts | 36 ++++++++++++++ 73 files changed, 2745 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/delete-api-users-one-1-photo.test.ts create mode 100644 .brightsec/tests/get-api-auth-dom-csrf-flow.test.ts create mode 100644 .brightsec/tests/get-api-auth-jwt-hmac-validate.test.ts create mode 100644 .brightsec/tests/get-api-auth-jwt-jku-validate.test.ts create mode 100644 .brightsec/tests/get-api-auth-jwt-jwk-validate.test.ts create mode 100644 .brightsec/tests/get-api-auth-jwt-kid-sql-validate.test.ts create mode 100644 .brightsec/tests/get-api-auth-jwt-rsa-signature-validate.test.ts create mode 100644 .brightsec/tests/get-api-auth-jwt-weak-key-validate.test.ts create mode 100644 .brightsec/tests/get-api-auth-jwt-x5c-validate.test.ts create mode 100644 .brightsec/tests/get-api-auth-jwt-x5u-validate.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-raw-path-config-products-crystals-amethyst-jpg.test.ts create mode 100644 .brightsec/tests/get-api-file.test.ts create mode 100644 .brightsec/tests/get-api-goto.test.ts create mode 100644 .brightsec/tests/get-api-nested-json-depth-1.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-products.test.ts create mode 100644 .brightsec/tests/get-api-secrets.test.ts create mode 100644 .brightsec/tests/get-api-spawn-command.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-adminpermission.test.ts create mode 100644 .brightsec/tests/get-api-users-one-email-info.test.ts create mode 100644 .brightsec/tests/get-api-users-one-email-photo.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-api-v2-userinfo-john-doe-at-example-com.test.ts create mode 100644 .brightsec/tests/options-api-users.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.test.ts create mode 100644 .brightsec/tests/post-api-testimonials.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-create-testimonial.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 create mode 100644 .brightsec/tests/put-api-users-one-email-info.test.ts create mode 100644 .brightsec/tests/put-api-users-one-email-photo.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..673883c7 --- /dev/null +++ b/.brightsec/tests/delete-api-email-delete-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('DELETE /api/email/deleteEmails', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'bopla', 'improper_asset_management', 'proto_pollution'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.DELETE, + url: `${baseUrl}/api/email/deleteEmails`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..9343890a --- /dev/null +++ b/.brightsec/tests/delete-api-file-path-config-products-crystals-some-file-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('DELETE /api/file?path=config/products/crystals/some_file.jpg', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['lfi', 'ssrf', 'bopla', 'full_path_disclosure', 'unvalidated_redirect'], + 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`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/delete-api-users-one-1-photo.test.ts b/.brightsec/tests/delete-api-users-one-1-photo.test.ts new file mode 100644 index 00000000..273eb8ac --- /dev/null +++ b/.brightsec/tests/delete-api-users-one-1-photo.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('DELETE /api/users/one/1/photo', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'bopla', 'id_enumeration', 'osi'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.DELETE, + url: `${baseUrl}/api/users/one/1/photo?isAdmin=true`, + headers: { 'Access-Control-Request-Headers': 'OPTIONS, GET, POST, DELETE' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..82342187 --- /dev/null +++ b/.brightsec/tests/get-api-auth-dom-csrf-flow.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('GET /api/auth/dom-csrf-flow', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'xss', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/dom-csrf-flow`, + headers: { fingerprint: 'example-fingerprint' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-hmac-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-hmac-validate.test.ts new file mode 100644 index 00000000..aa9c5973 --- /dev/null +++ b/.brightsec/tests/get-api-auth-jwt-hmac-validate.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('GET /api/auth/jwt/hmac/validate', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'sqli', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/jwt/hmac/validate`, + headers: { authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-jku-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-jku-validate.test.ts new file mode 100644 index 00000000..c0df75af --- /dev/null +++ b/.brightsec/tests/get-api-auth-jwt-jku-validate.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('GET /api/auth/jwt/jku/validate', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'ssrf', 'unvalidated_redirect'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/jwt/jku/validate`, + headers: { Authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-jwk-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-jwk-validate.test.ts new file mode 100644 index 00000000..1ac0876d --- /dev/null +++ b/.brightsec/tests/get-api-auth-jwt-jwk-validate.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('GET /api/auth/jwt/jwk/validate', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'sqli', 'open_database', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/jwt/jwk/validate`, + headers: { Authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-kid-sql-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-kid-sql-validate.test.ts new file mode 100644 index 00000000..4e7fd9e8 --- /dev/null +++ b/.brightsec/tests/get-api-auth-jwt-kid-sql-validate.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('GET /api/auth/jwt/kid-sql/validate', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'sqli', 'csrf', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/jwt/kid-sql/validate`, + headers: { 'Authorization': 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-rsa-signature-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-rsa-signature-validate.test.ts new file mode 100644 index 00000000..d1c7f944 --- /dev/null +++ b/.brightsec/tests/get-api-auth-jwt-rsa-signature-validate.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('GET /api/auth/jwt/rsa/signature/validate', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'insecure_tls_configuration', 'unvalidated_redirect'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/jwt/rsa/signature/validate`, + headers: { Authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-weak-key-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-weak-key-validate.test.ts new file mode 100644 index 00000000..552361c4 --- /dev/null +++ b/.brightsec/tests/get-api-auth-jwt-weak-key-validate.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('GET /api/auth/jwt/weak-key/validate', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'sqli', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/jwt/weak-key/validate`, + headers: { Authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-x5c-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-x5c-validate.test.ts new file mode 100644 index 00000000..33b9dbaf --- /dev/null +++ b/.brightsec/tests/get-api-auth-jwt-x5c-validate.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('GET /api/auth/jwt/x5c/validate', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'open_database', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/jwt/x5c/validate`, + headers: { 'Authorization': 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-x5u-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-x5u-validate.test.ts new file mode 100644 index 00000000..c9049111 --- /dev/null +++ b/.brightsec/tests/get-api-auth-jwt-x5u-validate.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('GET /api/auth/jwt/x5u/validate', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'insecure_tls_configuration', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/jwt/x5u/validate`, + headers: { Authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..c1b74aa7 --- /dev/null +++ b/.brightsec/tests/get-api-auth-oidc-client.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/oidc-client', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'secret_tokens', 'open_database', 'unvalidated_redirect'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/oidc-client`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..4bb2ae1a --- /dev/null +++ b/.brightsec/tests/get-api-auth-simple-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/simple-csrf-flow', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'xss', 'http_method_fuzzing', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/auth/simple-csrf-flow`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..43ddf3c3 --- /dev/null +++ b/.brightsec/tests/get-api-config.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-config', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['open_database', 'secret_tokens', 'improper_asset_management', 'csrf', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.HEADER, AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/config`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..ce069b46 --- /dev/null +++ b/.brightsec/tests/get-api-email-get-emails.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('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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..518cdbb5 --- /dev/null +++ b/.brightsec/tests/get-api-email-send-support-email.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('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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..0e0e21e8 --- /dev/null +++ b/.brightsec/tests/get-api-file-aws.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('GET /api/file/aws', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['ssrf', 'lfi', 'open_cloud_storage', 'amazon_s3_takeover', 'file_upload'], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..f64abeaf --- /dev/null +++ b/.brightsec/tests/get-api-file-azure.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('GET /api/file/azure', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['open_cloud_storage', 'lfi', 'ssrf', 'unvalidated_redirect'], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..73d5f967 --- /dev/null +++ b/.brightsec/tests/get-api-file-digital-ocean.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('GET /api/file/digital_ocean', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['ssrf', 'lfi', 'open_cloud_storage', 'file_upload'], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..f2a43776 --- /dev/null +++ b/.brightsec/tests/get-api-file-google.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('GET /api/file/google', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['ssrf', 'lfi', 'open_cloud_storage', 'unvalidated_redirect'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..4667f1d7 --- /dev/null +++ b/.brightsec/tests/get-api-file-raw-path-config-products-crystals-amethyst-jpg.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('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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-file.test.ts b/.brightsec/tests/get-api-file.test.ts new file mode 100644 index 00000000..1c04b0b5 --- /dev/null +++ b/.brightsec/tests/get-api-file.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('GET /api/file', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['lfi', 'ssrf', 'file_upload', 'open_cloud_storage', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..f3b623c3 --- /dev/null +++ b/.brightsec/tests/get-api-goto.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/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`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-nested-json-depth-1.test.ts b/.brightsec/tests/get-api-nested-json-depth-1.test.ts new file mode 100644 index 00000000..8467eeb4 --- /dev/null +++ b/.brightsec/tests/get-api-nested-json-depth-1.test.ts @@ -0,0 +1,37 @@ +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=1', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['business_constraint_bypass', 'date_manipulation', 'full_path_disclosure', 'osi'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] }, + skipStaticParams: false + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/nestedJson?depth=1`, + headers: { 'Content-Type': 'application/json' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..6214e2ab --- /dev/null +++ b/.brightsec/tests/get-api-partners-partner-login.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('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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..8c4834f7 --- /dev/null +++ b/.brightsec/tests/get-api-partners-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('GET /api/partners/query', { 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/query?xpath=%2Fpartners%2Fpartner%2Fname`, + headers: { 'Content-Type': 'text/xml' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..153ed609 --- /dev/null +++ b/.brightsec/tests/get-api-partners-search-partners.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('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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..d774b7af --- /dev/null +++ b/.brightsec/tests/get-api-products-latest.test.ts @@ -0,0 +1,37 @@ +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', 'csrf', 'sqli', 'date_manipulation'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] }, + skipStaticParams: false + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/products/latest?limit=3`, + headers: { authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..46595890 --- /dev/null +++ b/.brightsec/tests/get-api-products-views.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('GET /api/products/views', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'full_path_disclosure', 'business_constraint_bypass'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/products/views`, + headers: { 'x-product-name': 'Amethyst' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-products.test.ts b/.brightsec/tests/get-api-products.test.ts new file mode 100644 index 00000000..c6ce33db --- /dev/null +++ b/.brightsec/tests/get-api-products.test.ts @@ -0,0 +1,37 @@ +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', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'date_manipulation', 'business_constraint_bypass', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] }, + skipStaticParams: false + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/products?date_from=02-05-2001&date_to=02-05-2024`, + headers: { 'x-product-name': 'Amethyst' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..b341696e --- /dev/null +++ b/.brightsec/tests/get-api-secrets.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/secrets', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['secret_tokens', 'csrf', 'improper_asset_management'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/secrets`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-spawn-command.test.ts b/.brightsec/tests/get-api-spawn-command.test.ts new file mode 100644 index 00000000..0f55eaa4 --- /dev/null +++ b/.brightsec/tests/get-api-spawn-command.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/spawn?command=:command', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['osi', 'full_path_disclosure', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/spawn?command=ls%20-la`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..4b8cc5cb --- /dev/null +++ b/.brightsec/tests/get-api-testimonials-count.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('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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..56226da8 --- /dev/null +++ b/.brightsec/tests/get-api-testimonials.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', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'csrf', 'business_constraint_bypass', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/testimonials`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..5c166898 --- /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: ['id_enumeration', 'xss', 'ldapi', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/fullinfo/john.doe@example.com`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..cccd40aa --- /dev/null +++ b/.brightsec/tests/get-api-users-id-1.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/id/1', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['id_enumeration', 'bopla', 'sqli', 'csrf', 'full_path_disclosure'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/id/1`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..69641ea1 --- /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', 'xss', '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`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-one-email-adminpermission.test.ts b/.brightsec/tests/get-api-users-one-email-adminpermission.test.ts new file mode 100644 index 00000000..551ab724 --- /dev/null +++ b/.brightsec/tests/get-api-users-one-email-adminpermission.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('GET /api/users/one/:email/adminpermission', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['bopla', 'csrf', 'id_enumeration', 'jwt'], + attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/one/john.doe@example.com/adminpermission`, + headers: { authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-one-email-info.test.ts b/.brightsec/tests/get-api-users-one-email-info.test.ts new file mode 100644 index 00000000..9f22f20a --- /dev/null +++ b/.brightsec/tests/get-api-users-one-email-info.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('GET /api/users/one/:email/info', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'bopla', 'id_enumeration', 'xss', 'ldapi'], + attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/one/john.doe@example.com/info`, + headers: { Authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-one-email-photo.test.ts b/.brightsec/tests/get-api-users-one-email-photo.test.ts new file mode 100644 index 00000000..87d45169 --- /dev/null +++ b/.brightsec/tests/get-api-users-one-email-photo.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('GET /api/users/one/:email/photo', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['bopla', 'csrf', 'id_enumeration', 'xss', 'xxe'], + attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/one/john.doe@example.com/photo`, + headers: { Authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..8019410f --- /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', 'sqli', 'ldapi', 'osi'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/one/john.doe@example.com`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..f7b0ef2b --- /dev/null +++ b/.brightsec/tests/get-api-users-search-john.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/search/john', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['id_enumeration', 'xss', 'sqli', 'csrf', 'business_constraint_bypass'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/users/search/john`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..4e1c9424 --- /dev/null +++ b/.brightsec/tests/get-api-v1-userinfo-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/v1/userinfo/:email', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['id_enumeration', 'csrf', 'xss', 'open_database', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/v1/userinfo/john.doe@example.com`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-v2-userinfo-john-doe-at-example-com.test.ts b/.brightsec/tests/get-api-v2-userinfo-john-doe-at-example-com.test.ts new file mode 100644 index 00000000..154098a1 --- /dev/null +++ b/.brightsec/tests/get-api-v2-userinfo-john-doe-at-example-com.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('GET /api/v2/userinfo/john.doe@example.com', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['bopla', 'id_enumeration', 'jwt', 'xss', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.GET, + url: `${baseUrl}/api/v2/userinfo/john.doe@example.com?email=john.doe@example.com`, + headers: { authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/options-api-users.test.ts b/.brightsec/tests/options-api-users.test.ts new file mode 100644 index 00000000..a82e7cec --- /dev/null +++ b/.brightsec/tests/options-api-users.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('OPTIONS /api/users', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'http_method_fuzzing', 'insecure_tls_configuration', 'improper_asset_management'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.OPTIONS, + url: `${baseUrl}/api/users`, + headers: { 'Access-Control-Request-Headers': 'OPTIONS, GET, POST, DELETE' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..0db65793 --- /dev/null +++ b/.brightsec/tests/options-api.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('OPTIONS /api', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['http_method_fuzzing', 'improper_asset_management'], + attackParamLocations: [AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.OPTIONS, + url: `${baseUrl}/api`, + headers: { allow: 'OPTIONS, GET, HEAD, POST' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..e01b0204 --- /dev/null +++ b/.brightsec/tests/post-api-auth-admin-login.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 /api/auth/admin/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'sqli', 'jwt', 'osi', 'unvalidated_redirect'], + 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: 'basic' + }, + headers: { 'Content-Type': 'application/json' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..57cd6711 --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-hmac-login.test.ts @@ -0,0 +1,44 @@ +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', 'bopla', 'sqli', 'osi'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + 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', + 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiam9obiIsImV4cCI6MTYwOTI3MzYwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' + }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..ff3e8237 --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-jku-login.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 /api/auth/jwt/jku/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'sqli', 'open_database', 'secret_tokens'], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..2db413a9 --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-jwk-login.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 /api/auth/jwt/jwk/login', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['jwt', 'csrf', 'sqli', 'xss', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.BODY], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..93342e9c --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-kid-sql-login.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 /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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..6d241afc --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-weak-key-login.test.ts @@ -0,0 +1,44 @@ +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', 'csrf', 'sqli', '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' + }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..cbc9000d --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-x5c-login.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 /api/auth/jwt/x5c/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/x5c/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'basic' + }, + headers: { 'Content-Type': 'application/json' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..edd2df16 --- /dev/null +++ b/.brightsec/tests/post-api-auth-jwt-x5u-login.test.ts @@ -0,0 +1,44 @@ +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', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/auth/jwt/x5u/login`, + body: { + user: 'john', + password: 'Pa55w0rd', + op: 'oidc' + }, + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' + }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..c42b23b1 --- /dev/null +++ b/.brightsec/tests/post-api-auth-login.test.ts @@ -0,0 +1,44 @@ +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', 'secret_tokens'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + 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', + authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' + }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..ed05d1e7 --- /dev/null +++ b/.brightsec/tests/post-api-chat-query.test.ts @@ -0,0 +1,37 @@ +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], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..f84ec9fe --- /dev/null +++ b/.brightsec/tests/post-api-metadata.test.ts @@ -0,0 +1,37 @@ +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', '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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..728af38f --- /dev/null +++ b/.brightsec/tests/post-api-render.test.ts @@ -0,0 +1,37 @@ +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'], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-subscriptions.test.ts b/.brightsec/tests/post-api-subscriptions.test.ts new file mode 100644 index 00000000..7c490706 --- /dev/null +++ b/.brightsec/tests/post-api-subscriptions.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('POST /api/subscriptions', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['csrf', 'email_injection', 'xss', 'unvalidated_redirect'], + attackParamLocations: [AttackParamLocation.QUERY], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/subscriptions?email=john.doe@example.com`, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-testimonials.test.ts b/.brightsec/tests/post-api-testimonials.test.ts new file mode 100644 index 00000000..7c7e8d24 --- /dev/null +++ b/.brightsec/tests/post-api-testimonials.test.ts @@ -0,0 +1,44 @@ +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/testimonials', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'stored_xss', 'csrf', 'bopla', 'jwt'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/testimonials`, + body: { + name: 'John Doe', + title: 'Great Service', + message: 'I had an excellent experience with this service.' + }, + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer ' + }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..f12c6761 --- /dev/null +++ b/.brightsec/tests/post-api-users-basic.test.ts @@ -0,0 +1,44 @@ +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: ['bopla', 'csrf', 'sqli', 'xss', 'ldapi', 'osi'], + attackParamLocations: [AttackParamLocation.BODY], + starMetadata: { databases: ['PostgreSQL'] }, + skipStaticParams: false + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/api/users/basic`, + body: { + company: 'Example Company', + cardNumber: '1234-5678-9012-3456', + phoneNumber: '+1234567890', + password: 'SecurePassword123', + op: 'basic' + }, + headers: { 'Content-Type': 'application/json' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..70974122 --- /dev/null +++ b/.brightsec/tests/post-api-users-oidc.test.ts @@ -0,0 +1,47 @@ +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: ['bopla', 'csrf', 'email_injection', 'sqli', 'xss', '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: 'Dull Security', + id: 1, + cardNumber: '4263982640269299', + phoneNumber: '12065550100', + password: 'Pa55w0rd', + op: 'oidc' + }, + headers: { 'Content-Type': 'application/json' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..d93eae30 --- /dev/null +++ b/.brightsec/tests/post-graphql-all-products.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 allProducts', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['graphql_introspection', 'sqli', 'jwt', 'xss'], + 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 ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..fb360b63 --- /dev/null +++ b/.brightsec/tests/post-graphql-all-testimonials.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 allTestimonials', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['graphql_introspection', 'sqli', 'xss', 'csrf', 'jwt'], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-create-testimonial.test.ts b/.brightsec/tests/post-graphql-create-testimonial.test.ts new file mode 100644 index 00000000..54473e85 --- /dev/null +++ b/.brightsec/tests/post-graphql-create-testimonial.test.ts @@ -0,0 +1,49 @@ +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 createTestimonial', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['graphql_introspection', 'jwt', 'sqli', 'xss', 'csrf'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.POST, + url: `${baseUrl}/graphql`, + body: { + query: `mutation createTestimonial($testimonialRequest: CreateTestimonialRequest!) { createTestimonial(testimonialRequest: $testimonialRequest) { id name title message } }`, + variables: { + testimonialRequest: { + name: "John Doe", + title: "Satisfied Customer", + message: "This product exceeded my expectations!" + } + } + }, + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..e70a2293 --- /dev/null +++ b/.brightsec/tests/post-graphql-get-command-result.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 /graphql get-command-result', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['osi', 'graphql_introspection', '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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..09656fdf --- /dev/null +++ b/.brightsec/tests/post-graphql-latest-products.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 latestProducts', { 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 { latestProducts { name category photoUrl description viewsCount } }" + }, + headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..4b60695c --- /dev/null +++ b/.brightsec/tests/post-graphql-testimonials-count.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 /graphql testimonialsCount', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['graphql_introspection', 'sqli', 'bopla', 'xss'], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..88888006 --- /dev/null +++ b/.brightsec/tests/post-graphql-view-product.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 /graphql viewProduct', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['sqli', 'csrf', 'graphql_introspection', 'bopla'], + attackParamLocations: [AttackParamLocation.BODY], + 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' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ 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..80952211 --- /dev/null +++ b/.brightsec/tests/put-api-file-raw-path-some-path-to-file-png.test.ts @@ -0,0 +1,37 @@ +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', 'osi', 'ssrf', 'secret_tokens'], + 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: 'Sample raw file content', + headers: { 'Content-Type': 'text/plain' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/put-api-users-one-email-info.test.ts b/.brightsec/tests/put-api-users-one-email-info.test.ts new file mode 100644 index 00000000..9fc3bda7 --- /dev/null +++ b/.brightsec/tests/put-api-users-one-email-info.test.ts @@ -0,0 +1,44 @@ +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/users/one/:email/info', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['bopla', 'csrf', 'xss', 'sqli', 'ldapi', 'xxe'], + attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.PATH], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.PUT, + url: `${baseUrl}/api/users/one/john.doe@example.com/info`, + body: { + email: 'john.doe@example.com', + firstName: 'John', + lastName: 'Doe', + company: 'Dull Security', + id: 1, + phoneNumber: '12065550100' + }, + headers: { 'Content-Type': 'application/json' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file diff --git a/.brightsec/tests/put-api-users-one-email-photo.test.ts b/.brightsec/tests/put-api-users-one-email-photo.test.ts new file mode 100644 index 00000000..998d8c3f --- /dev/null +++ b/.brightsec/tests/put-api-users-one-email-photo.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/users/one/:email/photo', { signal: AbortSignal.timeout(timeout) }, async () => { + await runner + .createScan({ + tests: ['file_upload', 'xxe', 'jwt', 'csrf', 'osi'], + attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.BODY, AttackParamLocation.HEADER], + starMetadata: { databases: ['PostgreSQL'] } + }) + .setFailFast(false) + .timeout(timeout) + .run({ + method: HttpMethod.PUT, + url: `${baseUrl}/api/users/one/john.doe@example.com/photo`, + headers: { Authorization: 'Bearer ' }, + auth: process.env.BRIGHT_AUTH_ID + }); +}); \ No newline at end of file From cc9af518aca0b19578aabac64f0f424e6e0ce0bb Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 10:25:26 +0000 Subject: [PATCH 4/8] ci: add CI workflow to run e2e security tests --- .github/workflows/bright.yml | 66 +++++++++++++++++++ .../configure-bright-credentials/action.yaml | 53 +++++++++++++++ 2 files changed, 119 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..214ffe19 --- /dev/null +++ b/.github/workflows/bright.yml @@ -0,0 +1,66 @@ +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 -zv 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: Run security tests + env: + BRIGHT_HOSTNAME: ${{ vars.BRIGHT_HOSTNAME }} + BRIGHT_PROJECT_ID: ${{ vars.BRIGHT_PROJECT_ID }} + BRIGHT_AUTH_ID: ${{ vars.BRIGHT_AUTH_ID }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRIGHT_TOKEN: ${{ secrets.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 c099dcd1e1ce17368538b9b042774cb2c6cb2a44 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 11:19:35 +0000 Subject: [PATCH 5/8] test: remove completed test files that are no longer relevant skip-checks:true --- .../delete-api-email-delete-emails.test.ts | 35 ------------- .../delete-api-users-one-1-photo.test.ts | 36 -------------- .../tests/get-api-auth-dom-csrf-flow.test.ts | 36 -------------- .../get-api-auth-jwt-hmac-validate.test.ts | 36 -------------- .../get-api-auth-jwt-jku-validate.test.ts | 36 -------------- .../get-api-auth-jwt-jwk-validate.test.ts | 36 -------------- ...get-api-auth-jwt-weak-key-validate.test.ts | 36 -------------- .../get-api-auth-jwt-x5c-validate.test.ts | 36 -------------- .../get-api-auth-jwt-x5u-validate.test.ts | 36 -------------- .../tests/get-api-auth-oidc-client.test.ts | 35 ------------- .../get-api-auth-simple-csrf-flow.test.ts | 35 ------------- .brightsec/tests/get-api-config.test.ts | 35 ------------- .../tests/get-api-email-get-emails.test.ts | 36 -------------- .../get-api-email-send-support-email.test.ts | 36 -------------- ...fig-products-crystals-amethyst-jpg.test.ts | 36 -------------- .../tests/get-api-nested-json-depth-1.test.ts | 37 -------------- .../get-api-partners-partner-login.test.ts | 36 -------------- .../tests/get-api-partners-query.test.ts | 36 -------------- .../tests/get-api-products-views.test.ts | 36 -------------- .brightsec/tests/get-api-products.test.ts | 37 -------------- .../tests/get-api-spawn-command.test.ts | 35 ------------- .../tests/get-api-testimonials-count.test.ts | 36 -------------- .brightsec/tests/get-api-testimonials.test.ts | 35 ------------- .../get-api-users-fullinfo-email.test.ts | 35 ------------- .brightsec/tests/get-api-users-ldap.test.ts | 35 ------------- ...pi-users-one-email-adminpermission.test.ts | 36 -------------- .../get-api-users-one-email-info.test.ts | 36 -------------- .../get-api-users-one-email-photo.test.ts | 36 -------------- .../tests/get-api-users-one-email.test.ts | 35 ------------- .../tests/get-api-users-search-john.test.ts | 35 ------------- .../tests/get-api-v1-userinfo-email.test.ts | 35 ------------- ...2-userinfo-john-doe-at-example-com.test.ts | 36 -------------- .brightsec/tests/options-api-users.test.ts | 36 -------------- .brightsec/tests/options-api.test.ts | 36 -------------- .../tests/post-api-auth-admin-login.test.ts | 41 ---------------- .../post-api-auth-jwt-hmac-login.test.ts | 44 ----------------- .../tests/post-api-auth-jwt-jku-login.test.ts | 41 ---------------- .../tests/post-api-auth-jwt-jwk-login.test.ts | 41 ---------------- .../post-api-auth-jwt-kid-sql-login.test.ts | 41 ---------------- .../post-api-auth-jwt-weak-key-login.test.ts | 44 ----------------- .../tests/post-api-auth-jwt-x5c-login.test.ts | 41 ---------------- .../tests/post-api-auth-jwt-x5u-login.test.ts | 44 ----------------- .brightsec/tests/post-api-auth-login.test.ts | 44 ----------------- .brightsec/tests/post-api-chat-query.test.ts | 37 -------------- .brightsec/tests/post-api-metadata.test.ts | 37 -------------- .../tests/post-api-subscriptions.test.ts | 35 ------------- .brightsec/tests/post-api-users-basic.test.ts | 44 ----------------- .brightsec/tests/post-api-users-oidc.test.ts | 47 ------------------ .../tests/post-graphql-all-products.test.ts | 39 --------------- .../post-graphql-all-testimonials.test.ts | 39 --------------- .../post-graphql-create-testimonial.test.ts | 49 ------------------- .../post-graphql-get-command-result.test.ts | 40 --------------- .../post-graphql-testimonials-count.test.ts | 40 --------------- ...ile-raw-path-some-path-to-file-png.test.ts | 37 -------------- .../put-api-users-one-email-info.test.ts | 44 ----------------- .../put-api-users-one-email-photo.test.ts | 36 -------------- 56 files changed, 2120 deletions(-) delete mode 100644 .brightsec/tests/delete-api-email-delete-emails.test.ts delete mode 100644 .brightsec/tests/delete-api-users-one-1-photo.test.ts delete mode 100644 .brightsec/tests/get-api-auth-dom-csrf-flow.test.ts delete mode 100644 .brightsec/tests/get-api-auth-jwt-hmac-validate.test.ts delete mode 100644 .brightsec/tests/get-api-auth-jwt-jku-validate.test.ts delete mode 100644 .brightsec/tests/get-api-auth-jwt-jwk-validate.test.ts delete mode 100644 .brightsec/tests/get-api-auth-jwt-weak-key-validate.test.ts delete mode 100644 .brightsec/tests/get-api-auth-jwt-x5c-validate.test.ts delete mode 100644 .brightsec/tests/get-api-auth-jwt-x5u-validate.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-nested-json-depth-1.test.ts delete mode 100644 .brightsec/tests/get-api-partners-partner-login.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-products.test.ts delete mode 100644 .brightsec/tests/get-api-spawn-command.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-adminpermission.test.ts delete mode 100644 .brightsec/tests/get-api-users-one-email-info.test.ts delete mode 100644 .brightsec/tests/get-api-users-one-email-photo.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-api-v2-userinfo-john-doe-at-example-com.test.ts delete mode 100644 .brightsec/tests/options-api-users.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-chat-query.test.ts delete mode 100644 .brightsec/tests/post-api-metadata.test.ts delete mode 100644 .brightsec/tests/post-api-subscriptions.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-create-testimonial.test.ts delete mode 100644 .brightsec/tests/post-graphql-get-command-result.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 delete mode 100644 .brightsec/tests/put-api-users-one-email-info.test.ts delete mode 100644 .brightsec/tests/put-api-users-one-email-photo.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 673883c7..00000000 --- a/.brightsec/tests/delete-api-email-delete-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('DELETE /api/email/deleteEmails', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'bopla', 'improper_asset_management', 'proto_pollution'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.DELETE, - url: `${baseUrl}/api/email/deleteEmails`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/delete-api-users-one-1-photo.test.ts b/.brightsec/tests/delete-api-users-one-1-photo.test.ts deleted file mode 100644 index 273eb8ac..00000000 --- a/.brightsec/tests/delete-api-users-one-1-photo.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('DELETE /api/users/one/1/photo', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'bopla', 'id_enumeration', 'osi'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.DELETE, - url: `${baseUrl}/api/users/one/1/photo?isAdmin=true`, - headers: { 'Access-Control-Request-Headers': 'OPTIONS, GET, POST, DELETE' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 82342187..00000000 --- a/.brightsec/tests/get-api-auth-dom-csrf-flow.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('GET /api/auth/dom-csrf-flow', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'xss', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/dom-csrf-flow`, - headers: { fingerprint: 'example-fingerprint' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-hmac-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-hmac-validate.test.ts deleted file mode 100644 index aa9c5973..00000000 --- a/.brightsec/tests/get-api-auth-jwt-hmac-validate.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('GET /api/auth/jwt/hmac/validate', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'sqli', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/jwt/hmac/validate`, - headers: { authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-jku-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-jku-validate.test.ts deleted file mode 100644 index c0df75af..00000000 --- a/.brightsec/tests/get-api-auth-jwt-jku-validate.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('GET /api/auth/jwt/jku/validate', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'ssrf', 'unvalidated_redirect'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/jwt/jku/validate`, - headers: { Authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-jwk-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-jwk-validate.test.ts deleted file mode 100644 index 1ac0876d..00000000 --- a/.brightsec/tests/get-api-auth-jwt-jwk-validate.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('GET /api/auth/jwt/jwk/validate', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'sqli', 'open_database', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/jwt/jwk/validate`, - headers: { Authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-weak-key-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-weak-key-validate.test.ts deleted file mode 100644 index 552361c4..00000000 --- a/.brightsec/tests/get-api-auth-jwt-weak-key-validate.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('GET /api/auth/jwt/weak-key/validate', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'sqli', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/jwt/weak-key/validate`, - headers: { Authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-x5c-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-x5c-validate.test.ts deleted file mode 100644 index 33b9dbaf..00000000 --- a/.brightsec/tests/get-api-auth-jwt-x5c-validate.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('GET /api/auth/jwt/x5c/validate', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'open_database', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/jwt/x5c/validate`, - headers: { 'Authorization': 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-x5u-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-x5u-validate.test.ts deleted file mode 100644 index c9049111..00000000 --- a/.brightsec/tests/get-api-auth-jwt-x5u-validate.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('GET /api/auth/jwt/x5u/validate', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'insecure_tls_configuration', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/jwt/x5u/validate`, - headers: { Authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 c1b74aa7..00000000 --- a/.brightsec/tests/get-api-auth-oidc-client.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/oidc-client', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'secret_tokens', 'open_database', 'unvalidated_redirect'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/oidc-client`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 4bb2ae1a..00000000 --- a/.brightsec/tests/get-api-auth-simple-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/simple-csrf-flow', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'xss', 'http_method_fuzzing', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/simple-csrf-flow`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 43ddf3c3..00000000 --- a/.brightsec/tests/get-api-config.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-config', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['open_database', 'secret_tokens', 'improper_asset_management', 'csrf', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.HEADER, AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/config`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 ce069b46..00000000 --- a/.brightsec/tests/get-api-email-get-emails.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('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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 518cdbb5..00000000 --- a/.brightsec/tests/get-api-email-send-support-email.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('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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 4667f1d7..00000000 --- a/.brightsec/tests/get-api-file-raw-path-config-products-crystals-amethyst-jpg.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('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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-nested-json-depth-1.test.ts b/.brightsec/tests/get-api-nested-json-depth-1.test.ts deleted file mode 100644 index 8467eeb4..00000000 --- a/.brightsec/tests/get-api-nested-json-depth-1.test.ts +++ /dev/null @@ -1,37 +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=1', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['business_constraint_bypass', 'date_manipulation', 'full_path_disclosure', 'osi'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] }, - skipStaticParams: false - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/nestedJson?depth=1`, - headers: { 'Content-Type': 'application/json' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 deleted file mode 100644 index 6214e2ab..00000000 --- a/.brightsec/tests/get-api-partners-partner-login.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('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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 8c4834f7..00000000 --- a/.brightsec/tests/get-api-partners-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('GET /api/partners/query', { 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/query?xpath=%2Fpartners%2Fpartner%2Fname`, - headers: { 'Content-Type': 'text/xml' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 46595890..00000000 --- a/.brightsec/tests/get-api-products-views.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('GET /api/products/views', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['sqli', 'full_path_disclosure', 'business_constraint_bypass'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/products/views`, - headers: { 'x-product-name': 'Amethyst' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-products.test.ts b/.brightsec/tests/get-api-products.test.ts deleted file mode 100644 index c6ce33db..00000000 --- a/.brightsec/tests/get-api-products.test.ts +++ /dev/null @@ -1,37 +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', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['sqli', 'date_manipulation', 'business_constraint_bypass', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] }, - skipStaticParams: false - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/products?date_from=02-05-2001&date_to=02-05-2024`, - headers: { 'x-product-name': 'Amethyst' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-spawn-command.test.ts b/.brightsec/tests/get-api-spawn-command.test.ts deleted file mode 100644 index 0f55eaa4..00000000 --- a/.brightsec/tests/get-api-spawn-command.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/spawn?command=:command', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['osi', 'full_path_disclosure', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/spawn?command=ls%20-la`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 4b8cc5cb..00000000 --- a/.brightsec/tests/get-api-testimonials-count.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('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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 56226da8..00000000 --- a/.brightsec/tests/get-api-testimonials.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', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['sqli', 'csrf', 'business_constraint_bypass', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/testimonials`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 5c166898..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: ['id_enumeration', 'xss', 'ldapi', 'full_path_disclosure'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/fullinfo/john.doe@example.com`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 69641ea1..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', 'xss', '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`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-one-email-adminpermission.test.ts b/.brightsec/tests/get-api-users-one-email-adminpermission.test.ts deleted file mode 100644 index 551ab724..00000000 --- a/.brightsec/tests/get-api-users-one-email-adminpermission.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('GET /api/users/one/:email/adminpermission', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['bopla', 'csrf', 'id_enumeration', 'jwt'], - attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/one/john.doe@example.com/adminpermission`, - headers: { authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-one-email-info.test.ts b/.brightsec/tests/get-api-users-one-email-info.test.ts deleted file mode 100644 index 9f22f20a..00000000 --- a/.brightsec/tests/get-api-users-one-email-info.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('GET /api/users/one/:email/info', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'bopla', 'id_enumeration', 'xss', 'ldapi'], - attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/one/john.doe@example.com/info`, - headers: { Authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-users-one-email-photo.test.ts b/.brightsec/tests/get-api-users-one-email-photo.test.ts deleted file mode 100644 index 87d45169..00000000 --- a/.brightsec/tests/get-api-users-one-email-photo.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('GET /api/users/one/:email/photo', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['bopla', 'csrf', 'id_enumeration', 'xss', 'xxe'], - attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/one/john.doe@example.com/photo`, - headers: { Authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 8019410f..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', 'sqli', 'ldapi', 'osi'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/one/john.doe@example.com`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 f7b0ef2b..00000000 --- a/.brightsec/tests/get-api-users-search-john.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/search/john', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['id_enumeration', 'xss', 'sqli', 'csrf', 'business_constraint_bypass'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/users/search/john`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 4e1c9424..00000000 --- a/.brightsec/tests/get-api-v1-userinfo-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/v1/userinfo/:email', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['id_enumeration', 'csrf', 'xss', 'open_database', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/v1/userinfo/john.doe@example.com`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-v2-userinfo-john-doe-at-example-com.test.ts b/.brightsec/tests/get-api-v2-userinfo-john-doe-at-example-com.test.ts deleted file mode 100644 index 154098a1..00000000 --- a/.brightsec/tests/get-api-v2-userinfo-john-doe-at-example-com.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('GET /api/v2/userinfo/john.doe@example.com', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['bopla', 'id_enumeration', 'jwt', 'xss', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/v2/userinfo/john.doe@example.com?email=john.doe@example.com`, - headers: { authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/options-api-users.test.ts b/.brightsec/tests/options-api-users.test.ts deleted file mode 100644 index a82e7cec..00000000 --- a/.brightsec/tests/options-api-users.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('OPTIONS /api/users', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'http_method_fuzzing', 'insecure_tls_configuration', 'improper_asset_management'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.OPTIONS, - url: `${baseUrl}/api/users`, - headers: { 'Access-Control-Request-Headers': 'OPTIONS, GET, POST, DELETE' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 0db65793..00000000 --- a/.brightsec/tests/options-api.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('OPTIONS /api', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['http_method_fuzzing', 'improper_asset_management'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.OPTIONS, - url: `${baseUrl}/api`, - headers: { allow: 'OPTIONS, GET, HEAD, POST' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 e01b0204..00000000 --- a/.brightsec/tests/post-api-auth-admin-login.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 /api/auth/admin/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'sqli', 'jwt', 'osi', 'unvalidated_redirect'], - 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: 'basic' - }, - headers: { 'Content-Type': 'application/json' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 57cd6711..00000000 --- a/.brightsec/tests/post-api-auth-jwt-hmac-login.test.ts +++ /dev/null @@ -1,44 +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', 'bopla', 'sqli', 'osi'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - 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', - 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiam9obiIsImV4cCI6MTYwOTI3MzYwMH0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' - }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 ff3e8237..00000000 --- a/.brightsec/tests/post-api-auth-jwt-jku-login.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 /api/auth/jwt/jku/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'sqli', 'open_database', 'secret_tokens'], - 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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 2db413a9..00000000 --- a/.brightsec/tests/post-api-auth-jwt-jwk-login.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 /api/auth/jwt/jwk/login', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt', 'csrf', 'sqli', 'xss', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.BODY], - 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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 93342e9c..00000000 --- a/.brightsec/tests/post-api-auth-jwt-kid-sql-login.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 /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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 6d241afc..00000000 --- a/.brightsec/tests/post-api-auth-jwt-weak-key-login.test.ts +++ /dev/null @@ -1,44 +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', 'csrf', 'sqli', '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' - }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 cbc9000d..00000000 --- a/.brightsec/tests/post-api-auth-jwt-x5c-login.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 /api/auth/jwt/x5c/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/x5c/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'basic' - }, - headers: { 'Content-Type': 'application/json' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 edd2df16..00000000 --- a/.brightsec/tests/post-api-auth-jwt-x5u-login.test.ts +++ /dev/null @@ -1,44 +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', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/auth/jwt/x5u/login`, - body: { - user: 'john', - password: 'Pa55w0rd', - op: 'oidc' - }, - headers: { - 'Content-Type': 'application/json', - Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' - }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 c42b23b1..00000000 --- a/.brightsec/tests/post-api-auth-login.test.ts +++ /dev/null @@ -1,44 +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', 'secret_tokens'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - 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', - authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' - }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 deleted file mode 100644 index ed05d1e7..00000000 --- a/.brightsec/tests/post-api-chat-query.test.ts +++ /dev/null @@ -1,37 +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: ['csrf', 'prompt_injection', 'secret_tokens', 'server_side_js_injection', 'ssrf'], - attackParamLocations: [AttackParamLocation.BODY], - 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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 f84ec9fe..00000000 --- a/.brightsec/tests/post-api-metadata.test.ts +++ /dev/null @@ -1,37 +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', '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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-api-subscriptions.test.ts b/.brightsec/tests/post-api-subscriptions.test.ts deleted file mode 100644 index 7c490706..00000000 --- a/.brightsec/tests/post-api-subscriptions.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('POST /api/subscriptions', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['csrf', 'email_injection', 'xss', 'unvalidated_redirect'], - attackParamLocations: [AttackParamLocation.QUERY], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/subscriptions?email=john.doe@example.com`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 f12c6761..00000000 --- a/.brightsec/tests/post-api-users-basic.test.ts +++ /dev/null @@ -1,44 +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: ['bopla', 'csrf', 'sqli', 'xss', 'ldapi', 'osi'], - attackParamLocations: [AttackParamLocation.BODY], - starMetadata: { databases: ['PostgreSQL'] }, - skipStaticParams: false - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/users/basic`, - body: { - company: 'Example Company', - cardNumber: '1234-5678-9012-3456', - phoneNumber: '+1234567890', - password: 'SecurePassword123', - op: 'basic' - }, - headers: { 'Content-Type': 'application/json' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 70974122..00000000 --- a/.brightsec/tests/post-api-users-oidc.test.ts +++ /dev/null @@ -1,47 +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: ['bopla', 'csrf', 'email_injection', 'sqli', 'xss', '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: 'Dull Security', - id: 1, - cardNumber: '4263982640269299', - phoneNumber: '12065550100', - password: 'Pa55w0rd', - op: 'oidc' - }, - headers: { 'Content-Type': 'application/json' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 d93eae30..00000000 --- a/.brightsec/tests/post-graphql-all-products.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 allProducts', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection', 'sqli', 'jwt', 'xss'], - 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 ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 fb360b63..00000000 --- a/.brightsec/tests/post-graphql-all-testimonials.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 allTestimonials', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection', 'sqli', 'xss', 'csrf', 'jwt'], - 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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/post-graphql-create-testimonial.test.ts b/.brightsec/tests/post-graphql-create-testimonial.test.ts deleted file mode 100644 index 54473e85..00000000 --- a/.brightsec/tests/post-graphql-create-testimonial.test.ts +++ /dev/null @@ -1,49 +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 createTestimonial', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection', 'jwt', 'sqli', 'xss', 'csrf'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/graphql`, - body: { - query: `mutation createTestimonial($testimonialRequest: CreateTestimonialRequest!) { createTestimonial(testimonialRequest: $testimonialRequest) { id name title message } }`, - variables: { - testimonialRequest: { - name: "John Doe", - title: "Satisfied Customer", - message: "This product exceeded my expectations!" - } - } - }, - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'Bearer ' - }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 deleted file mode 100644 index e70a2293..00000000 --- a/.brightsec/tests/post-graphql-get-command-result.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 /graphql get-command-result', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['osi', 'graphql_introspection', '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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 4b60695c..00000000 --- a/.brightsec/tests/post-graphql-testimonials-count.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 /graphql testimonialsCount', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection', 'sqli', 'bopla', 'xss'], - 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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 80952211..00000000 --- a/.brightsec/tests/put-api-file-raw-path-some-path-to-file-png.test.ts +++ /dev/null @@ -1,37 +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', 'osi', 'ssrf', 'secret_tokens'], - 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: 'Sample raw file content', - headers: { 'Content-Type': 'text/plain' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/put-api-users-one-email-info.test.ts b/.brightsec/tests/put-api-users-one-email-info.test.ts deleted file mode 100644 index 9fc3bda7..00000000 --- a/.brightsec/tests/put-api-users-one-email-info.test.ts +++ /dev/null @@ -1,44 +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/users/one/:email/info', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['bopla', 'csrf', 'xss', 'sqli', 'ldapi', 'xxe'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.PATH], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.PUT, - url: `${baseUrl}/api/users/one/john.doe@example.com/info`, - body: { - email: 'john.doe@example.com', - firstName: 'John', - lastName: 'Doe', - company: 'Dull Security', - id: 1, - phoneNumber: '12065550100' - }, - headers: { 'Content-Type': 'application/json' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/put-api-users-one-email-photo.test.ts b/.brightsec/tests/put-api-users-one-email-photo.test.ts deleted file mode 100644 index 998d8c3f..00000000 --- a/.brightsec/tests/put-api-users-one-email-photo.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/users/one/:email/photo', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['file_upload', 'xxe', 'jwt', 'csrf', 'osi'], - attackParamLocations: [AttackParamLocation.PATH, AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.PUT, - url: `${baseUrl}/api/users/one/john.doe@example.com/photo`, - headers: { Authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file From e7cfe080bb7202b2be48b6f6aacb2ab9c526531f Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 11:20:46 +0000 Subject: [PATCH 6/8] test: optimize security tests to focus on specific vulnerabilities skip-checks:true --- ...i-file-path-config-products-crystals-some-file-jpg.test.ts | 4 ++-- .brightsec/tests/get-api-auth-jwt-kid-sql-validate.test.ts | 2 +- .../tests/get-api-auth-jwt-rsa-signature-validate.test.ts | 2 +- .brightsec/tests/get-api-file-aws.test.ts | 4 ++-- .brightsec/tests/get-api-file-azure.test.ts | 2 +- .brightsec/tests/get-api-file-digital-ocean.test.ts | 4 ++-- .brightsec/tests/get-api-file-google.test.ts | 4 ++-- .brightsec/tests/get-api-file.test.ts | 4 ++-- .brightsec/tests/get-api-goto.test.ts | 4 ++-- .brightsec/tests/get-api-partners-search-partners.test.ts | 2 +- .brightsec/tests/get-api-products-latest.test.ts | 4 ++-- .brightsec/tests/get-api-secrets.test.ts | 2 +- .brightsec/tests/get-api-users-id-1.test.ts | 4 ++-- .brightsec/tests/post-api-render.test.ts | 4 ++-- .brightsec/tests/post-api-testimonials.test.ts | 2 +- .brightsec/tests/post-graphql-latest-products.test.ts | 2 +- .brightsec/tests/post-graphql-view-product.test.ts | 2 +- 17 files changed, 26 insertions(+), 26 deletions(-) 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 index 9343890a..dae41b58 100644 --- 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 @@ -21,7 +21,7 @@ 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', 'full_path_disclosure', 'unvalidated_redirect'], + tests: ['full_path_disclosure'], attackParamLocations: [AttackParamLocation.QUERY], starMetadata: { databases: ['PostgreSQL'] } }) @@ -32,4 +32,4 @@ test('DELETE /api/file?path=config/products/crystals/some_file.jpg', { signal: A url: `${baseUrl}/api/file?path=config/products/crystals/some_file.jpg`, auth: process.env.BRIGHT_AUTH_ID }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-auth-jwt-kid-sql-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-kid-sql-validate.test.ts index 4e7fd9e8..517132b3 100644 --- a/.brightsec/tests/get-api-auth-jwt-kid-sql-validate.test.ts +++ b/.brightsec/tests/get-api-auth-jwt-kid-sql-validate.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/auth/jwt/kid-sql/validate', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['jwt', 'sqli', 'csrf', 'full_path_disclosure'], + tests: ['full_path_disclosure'], attackParamLocations: [AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) diff --git a/.brightsec/tests/get-api-auth-jwt-rsa-signature-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-rsa-signature-validate.test.ts index d1c7f944..7cbbf6d1 100644 --- a/.brightsec/tests/get-api-auth-jwt-rsa-signature-validate.test.ts +++ b/.brightsec/tests/get-api-auth-jwt-rsa-signature-validate.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/auth/jwt/rsa/signature/validate', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['jwt', 'csrf', 'insecure_tls_configuration', 'unvalidated_redirect'], + tests: ['jwt'], attackParamLocations: [AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) diff --git a/.brightsec/tests/get-api-file-aws.test.ts b/.brightsec/tests/get-api-file-aws.test.ts index 0e0e21e8..f8a5690c 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: ['ssrf', 'lfi', 'open_cloud_storage', 'amazon_s3_takeover', 'file_upload'], + tests: ['ssrf'], attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) @@ -33,4 +33,4 @@ test('GET /api/file/aws', { signal: AbortSignal.timeout(timeout) }, async () => headers: { accept: 'image/jpg' }, auth: process.env.BRIGHT_AUTH_ID }); -}); \ 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 f64abeaf..399f8769 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', 'unvalidated_redirect'], + tests: ['ssrf'], attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) diff --git a/.brightsec/tests/get-api-file-digital-ocean.test.ts b/.brightsec/tests/get-api-file-digital-ocean.test.ts index 73d5f967..7561fff9 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', 'lfi', 'open_cloud_storage', 'file_upload'], + tests: ['ssrf'], attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) @@ -33,4 +33,4 @@ test('GET /api/file/digital_ocean', { signal: AbortSignal.timeout(timeout) }, as headers: { accept: 'image/jpg' }, auth: process.env.BRIGHT_AUTH_ID }); -}); \ 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 f2a43776..1c1113d0 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', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['ssrf', 'lfi', 'open_cloud_storage', 'unvalidated_redirect'], + tests: ['ssrf'], attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) @@ -33,4 +33,4 @@ test('GET /api/file/google', { signal: AbortSignal.timeout(timeout) }, async () headers: { accept: 'image/jpg' }, auth: process.env.BRIGHT_AUTH_ID }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-file.test.ts b/.brightsec/tests/get-api-file.test.ts index 1c04b0b5..aac0c98b 100644 --- a/.brightsec/tests/get-api-file.test.ts +++ b/.brightsec/tests/get-api-file.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('GET /api/file', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['lfi', 'ssrf', 'file_upload', 'open_cloud_storage', 'full_path_disclosure'], + tests: ['ssrf', 'full_path_disclosure', 'lfi'], attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) @@ -33,4 +33,4 @@ test('GET /api/file', { signal: AbortSignal.timeout(timeout) }, async () => { headers: { accept: 'image/jpg' }, auth: process.env.BRIGHT_AUTH_ID }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/get-api-goto.test.ts b/.brightsec/tests/get-api-goto.test.ts index f3b623c3..d2262881 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'] } }) @@ -32,4 +32,4 @@ test('GET /api/goto', { signal: AbortSignal.timeout(timeout) }, async () => { url: `${baseUrl}/api/goto?url=https://google.com`, auth: process.env.BRIGHT_AUTH_ID }); -}); \ 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 153ed609..000fa933 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'] } }) diff --git a/.brightsec/tests/get-api-products-latest.test.ts b/.brightsec/tests/get-api-products-latest.test.ts index d774b7af..ca1b8d27 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', 'csrf', 'sqli', 'date_manipulation'], + tests: ['business_constraint_bypass'], attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] }, skipStaticParams: false @@ -34,4 +34,4 @@ test('GET /api/products/latest', { signal: AbortSignal.timeout(timeout) }, async headers: { authorization: 'Bearer ' }, auth: process.env.BRIGHT_AUTH_ID }); -}); \ 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 b341696e..786f13be 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', 'csrf', 'improper_asset_management'], + tests: ['secret_tokens'], attackParamLocations: [AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) diff --git a/.brightsec/tests/get-api-users-id-1.test.ts b/.brightsec/tests/get-api-users-id-1.test.ts index cccd40aa..a6804408 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', 'bopla', 'sqli', 'csrf', 'full_path_disclosure'], + tests: ['id_enumeration'], attackParamLocations: [AttackParamLocation.PATH], starMetadata: { databases: ['PostgreSQL'] } }) @@ -32,4 +32,4 @@ test('GET /api/users/id/1', { signal: AbortSignal.timeout(timeout) }, async () = url: `${baseUrl}/api/users/id/1`, auth: process.env.BRIGHT_AUTH_ID }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/post-api-render.test.ts b/.brightsec/tests/post-api-render.test.ts index 728af38f..4b2f9743 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'], + tests: ['ssti'], attackParamLocations: [AttackParamLocation.BODY], starMetadata: { databases: ['PostgreSQL'] } }) @@ -34,4 +34,4 @@ test('POST /api/render', { signal: AbortSignal.timeout(timeout) }, async () => { headers: { 'Content-Type': 'text/plain' }, auth: process.env.BRIGHT_AUTH_ID }); -}); \ No newline at end of file +}); diff --git a/.brightsec/tests/post-api-testimonials.test.ts b/.brightsec/tests/post-api-testimonials.test.ts index 7c7e8d24..ea2eb612 100644 --- a/.brightsec/tests/post-api-testimonials.test.ts +++ b/.brightsec/tests/post-api-testimonials.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('POST /api/testimonials', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['sqli', 'stored_xss', 'csrf', 'bopla', 'jwt'], + tests: ['jwt'], attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) diff --git a/.brightsec/tests/post-graphql-latest-products.test.ts b/.brightsec/tests/post-graphql-latest-products.test.ts index 09656fdf..4949255b 100644 --- a/.brightsec/tests/post-graphql-latest-products.test.ts +++ b/.brightsec/tests/post-graphql-latest-products.test.ts @@ -21,7 +21,7 @@ after(() => runner.clear()); test('POST /graphql latestProducts', { signal: AbortSignal.timeout(timeout) }, async () => { await runner .createScan({ - tests: ['graphql_introspection', 'sqli', 'jwt', 'bopla'], + tests: ['graphql_introspection'], attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], starMetadata: { databases: ['PostgreSQL'] } }) diff --git a/.brightsec/tests/post-graphql-view-product.test.ts b/.brightsec/tests/post-graphql-view-product.test.ts index 88888006..0d43775b 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', 'csrf', 'graphql_introspection', 'bopla'], + tests: ['graphql_introspection', 'sqli'], attackParamLocations: [AttackParamLocation.BODY], starMetadata: { databases: ['PostgreSQL'] } }) From f09a7c84b1df7ec48b9f2391bb53c62ba87c791b Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 11:31:20 +0000 Subject: [PATCH 7/8] fix: apply automated fixes for detected vulnerabilities --- src/app.controller.ts | 46 +++++++------ src/app.module.ts | 5 +- src/auth/auth.guard.ts | 4 +- .../jwt/jwt.token.with.rsa.keys.processor.ts | 4 +- ...token.with.rsa.signature.keys.processor.ts | 9 ++- src/file/cloud.providers.metadata.ts | 57 +++++++++++----- src/file/file.controller.ts | 25 +++++-- src/file/file.service.ts | 65 ++++++++++++------- src/main.ts | 5 +- src/partners/partners.service.ts | 8 ++- src/products/products.controller.ts | 5 +- src/products/products.resolver.ts | 5 +- src/products/products.service.ts | 11 ++-- src/users/users.controller.ts | 14 ++-- 14 files changed, 170 insertions(+), 93 deletions(-) diff --git a/src/app.controller.ts b/src/app.controller.ts index 41f037b9..45cc7427 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,7 +89,16 @@ export class AppController { }) @Redirect() async redirect(@Query('url') url: string) { - return { url }; + 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); + } + return { url }; + } catch (error) { + throw new HttpException('Invalid URL format', HttpStatus.BAD_REQUEST); + } } @Post('metadata') @@ -179,25 +190,18 @@ export class AppController { type: Object }) getSecrets(): Record { + // Fetch secrets from environment variables or a secure vault 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..6a2a5caf 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -36,7 +36,8 @@ import { ChatModule } from './chat/chat.module'; GraphQLModule.forRoot({ driver: MercuriusDriver, graphiql: true, - autoSchemaFile: true + autoSchemaFile: true, + introspection: false // Disable introspection to prevent schema exposure }), 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/auth/auth.guard.ts b/src/auth/auth.guard.ts index 1bd9577e..19772510 100644 --- a/src/auth/auth.guard.ts +++ b/src/auth/auth.guard.ts @@ -37,7 +37,7 @@ export class AuthGuard implements CanActivate { this.logger.debug(`Failed to validate token: ${err.message}`); throw new UnauthorizedException({ error: 'Unauthorized', - line: __filename + // Removed line information to prevent full path disclosure }); } } @@ -87,4 +87,4 @@ export class AuthGuard implements CanActivate { bearer.toLowerCase().startsWith(AuthGuard.BEARER_PREFIX.toLowerCase()) ); } -} +} \ No newline at end of file diff --git a/src/auth/jwt/jwt.token.with.rsa.keys.processor.ts b/src/auth/jwt/jwt.token.with.rsa.keys.processor.ts index 5ee59ef4..ea25809d 100644 --- a/src/auth/jwt/jwt.token.with.rsa.keys.processor.ts +++ b/src/auth/jwt/jwt.token.with.rsa.keys.processor.ts @@ -15,7 +15,7 @@ export class JwtTokenWithRSAKeysProcessor extends JwtTokenProcessor { const [header, payload] = this.parse(token); if (header.alg === 'none') { - return payload; + throw new Error('Invalid token algorithm: none'); } return decode(token, this.publicKey, false, header.alg); } @@ -26,4 +26,4 @@ export class JwtTokenWithRSAKeysProcessor extends JwtTokenProcessor { const token = encode(payload, this.privateKey, 'RS256'); return token; } -} +} \ No newline at end of file diff --git a/src/auth/jwt/jwt.token.with.rsa.signature.keys.processor.ts b/src/auth/jwt/jwt.token.with.rsa.signature.keys.processor.ts index 62534482..58075585 100644 --- a/src/auth/jwt/jwt.token.with.rsa.signature.keys.processor.ts +++ b/src/auth/jwt/jwt.token.with.rsa.signature.keys.processor.ts @@ -13,7 +13,12 @@ export class JwtTokenWithRSASignatureKeysProcessor extends JwtTokenProcessor { async validateToken(token: string): Promise { this.log.debug('Call validateToken'); - return decode(token, this.publicKey, true, 'RS256'); + // Ensure the algorithm is enforced to RS256 + const decoded = decode(token, this.publicKey, true, 'RS256'); + if (decoded.header.alg !== 'RS256') { + throw new Error('Invalid token algorithm'); + } + return decoded; } async createToken(payload: unknown): Promise { @@ -22,4 +27,4 @@ export class JwtTokenWithRSASignatureKeysProcessor extends JwtTokenProcessor { const token = encode(payload, this.privateKey, 'RS256'); return token; } -} +} \ No newline at end of file diff --git a/src/file/cloud.providers.metadata.ts b/src/file/cloud.providers.metadata.ts index 0e4ad7db..6e8a145e 100644 --- a/src/file/cloud.providers.metadata.ts +++ b/src/file/cloud.providers.metadata.ts @@ -1,5 +1,6 @@ import { Injectable } from '@nestjs/common'; import axios from 'axios'; +import { URL } from 'url'; @Injectable() export class CloudProvidersMetaData { @@ -252,20 +253,46 @@ export class CloudProvidersMetaData { } async get(providerUrl: string): Promise { - if (providerUrl.startsWith(CloudProvidersMetaData.GOOGLE)) { - return this.providers.get(CloudProvidersMetaData.GOOGLE); - } else if (providerUrl.startsWith(CloudProvidersMetaData.DIGITAL_OCEAN)) { - return this.providers.get(CloudProvidersMetaData.DIGITAL_OCEAN); - } else if (providerUrl.startsWith(CloudProvidersMetaData.AWS)) { - return this.providers.get(CloudProvidersMetaData.AWS); - } else if (providerUrl.startsWith(CloudProvidersMetaData.AZURE)) { - return this.providers.get(CloudProvidersMetaData.AZURE); - } else { - const { data } = await axios(providerUrl, { - timeout: 5000, - responseType: 'text' - }); - return data; + try { + const url = new URL(providerUrl); + if (!['http:', 'https:'].includes(url.protocol)) { + throw new Error('Invalid URL protocol'); + } + + // Validate the URL against known provider base URLs + if ( + !providerUrl.startsWith(CloudProvidersMetaData.GOOGLE) && + !providerUrl.startsWith(CloudProvidersMetaData.DIGITAL_OCEAN) && + !providerUrl.startsWith(CloudProvidersMetaData.AWS) && + !providerUrl.startsWith(CloudProvidersMetaData.AZURE) + ) { + throw new Error('URL not allowed'); + } + + // Ensure the path is within the allowed metadata paths + const baseUrl = providerUrl.split('?')[0]; + const allowedPaths = this.providers.get(baseUrl); + if (!allowedPaths || !allowedPaths.includes(url.pathname)) { + throw new Error('Path not allowed'); + } + + if (providerUrl.startsWith(CloudProvidersMetaData.GOOGLE)) { + return this.providers.get(CloudProvidersMetaData.GOOGLE); + } else if (providerUrl.startsWith(CloudProvidersMetaData.DIGITAL_OCEAN)) { + return this.providers.get(CloudProvidersMetaData.DIGITAL_OCEAN); + } else if (providerUrl.startsWith(CloudProvidersMetaData.AWS)) { + return this.providers.get(CloudProvidersMetaData.AWS); + } else if (providerUrl.startsWith(CloudProvidersMetaData.AZURE)) { + return this.providers.get(CloudProvidersMetaData.AZURE); + } else { + const { data } = await axios(providerUrl, { + timeout: 5000, + responseType: 'text' + }); + return data; + } + } catch (error) { + throw new Error(`Failed to fetch metadata: ${error.message}`); } } -} +} \ No newline at end of file diff --git a/src/file/file.controller.ts b/src/file/file.controller.ts index f16058c0..a375d66e 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 reading the file' }); + } } @Get('/google') @@ -266,8 +271,14 @@ export class FileController { @ApiOkResponse({ description: 'File deleted successfully' }) - async deleteFile(@Query('path') path: string): Promise { - await this.fileService.deleteFile(path); + async deleteFile(@Query('path') path: string, @Res() res: FastifyReply): Promise { + try { + await this.fileService.deleteFile(path); + res.status(HttpStatus.OK).send({ message: 'File deleted successfully' }); + } catch (err) { + this.logger.error(err.message); + res.status(HttpStatus.INTERNAL_SERVER_ERROR).send({ error: 'An error occurred while deleting the file' }); + } } @Put('raw') @@ -325,4 +336,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..c1292e2b 100644 --- a/src/file/file.service.ts +++ b/src/file/file.service.ts @@ -4,45 +4,60 @@ 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); + } + + private isValidUrl(urlString: string): boolean { + try { + const url = new URL(urlString); + // Allow only specific protocols + if (url.protocol !== 'http:' && url.protocol !== 'https:') { + return false; + } + // Add more validation logic if needed, e.g., hostname whitelist + return true; + } catch (err) { + return false; + } + } + 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 (!this.isValidPath(file) && !this.isValidUrl(file)) { + throw new Error('Access to this file path or URL is not allowed'); + } - 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.isValidUrl(file)) { + // Handle URL fetching logic here + // For example, using axios or another HTTP client to fetch the file + throw new Error('URL fetching is not implemented'); + } - await fs.promises.access(file, R_OK); + const resolvedPath = path.resolve(process.cwd(), file); + await fs.promises.access(resolvedPath, R_OK); - return fs.createReadStream(file); - } + return fs.createReadStream(resolvedPath); } 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 resolvedPath = path.resolve(process.cwd(), file); + await fs.promises.unlink(resolvedPath); + return true; } -} +} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 1ee24140..dae65d2b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,7 @@ import { AppModule } from './app.module'; import { HeadersConfiguratorInterceptor } from './components/headers.configurator.interceptor'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import fastifyCookie from '@fastify/cookie'; -import session from '@fastify/session'; +session from '@fastify/session'; import { GlobalExceptionFilter } from './components/global-exception.filter'; import * as os from 'os'; import { readFileSync, readFile, readdirSync } from 'fs'; @@ -226,6 +226,7 @@ async function bootstrap() { ) .setVersion('1.0') .addServer(process.env.URL) + .setDisableIntrospection() .build(); const document = SwaggerModule.createDocument(app, options); @@ -252,4 +253,4 @@ if (cluster.isPrimary && process.env.NODE_ENV === 'production') { } else { bootstrap(); console.log(`Worker ${process.pid} started`); -} +} \ No newline at end of file diff --git a/src/partners/partners.service.ts b/src/partners/partners.service.ts index 58d13f96..97b73edb 100644 --- a/src/partners/partners.service.ts +++ b/src/partners/partners.service.ts @@ -71,6 +71,12 @@ export class PartnersService { } getPartnersProperties(xpathExpression: string): string { + // Sanitize the input to prevent XPath Injection + if (!/^[a-zA-Z0-9\s\/\[\]\(\)\'\-]+$/.test(xpathExpression)) { + this.logger.warn(`Invalid characters detected in XPath expression: ${xpathExpression}`); + throw new Error('Invalid XPath expression.'); + } + let xmlNodes = this.selectPartnerPropertiesByXPATH(xpathExpression); if (!Array.isArray(xmlNodes)) { @@ -84,4 +90,4 @@ export class PartnersService { return this.getFormattedXMLOutput(xmlNodes); } -} +} \ 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..730ed63b 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 product with 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..bbae09c4 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); } @@ -459,8 +464,7 @@ export class UsersController { type: 'object', properties: { statusCode: { type: 'number' }, - message: { type: 'string' }, - error: { type: 'string' } + message: { type: 'string' } } } }) @@ -578,4 +582,4 @@ export class UsersController { ); } } -} +} \ No newline at end of file From cf8724077b563e2f8f130aac42832a25cfa1a729 Mon Sep 17 00:00:00 2001 From: "bram-star-app[bot]" <203639708+bram-star-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 11:32:30 +0000 Subject: [PATCH 8/8] revert: restore original workflow files and remove temporary one --- ...ig-products-crystals-some-file-jpg.test.ts | 35 ---------- .../get-api-auth-jwt-kid-sql-validate.test.ts | 36 ---------- ...pi-auth-jwt-rsa-signature-validate.test.ts | 36 ---------- .brightsec/tests/get-api-file-aws.test.ts | 36 ---------- .brightsec/tests/get-api-file-azure.test.ts | 36 ---------- .../tests/get-api-file-digital-ocean.test.ts | 36 ---------- .brightsec/tests/get-api-file-google.test.ts | 36 ---------- .brightsec/tests/get-api-file.test.ts | 36 ---------- .brightsec/tests/get-api-goto.test.ts | 35 ---------- .../get-api-partners-search-partners.test.ts | 36 ---------- .../tests/get-api-products-latest.test.ts | 37 ----------- .brightsec/tests/get-api-secrets.test.ts | 35 ---------- .brightsec/tests/get-api-users-id-1.test.ts | 35 ---------- .brightsec/tests/post-api-render.test.ts | 37 ----------- .../tests/post-api-testimonials.test.ts | 44 ------------- .../post-graphql-latest-products.test.ts | 39 ----------- .../tests/post-graphql-view-product.test.ts | 40 ----------- .github/workflows/bright.yml | 66 ------------------- .../configure-bright-credentials/action.yaml | 53 --------------- 19 files changed, 744 deletions(-) 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-jwt-kid-sql-validate.test.ts delete mode 100644 .brightsec/tests/get-api-auth-jwt-rsa-signature-validate.test.ts 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.test.ts delete mode 100644 .brightsec/tests/get-api-goto.test.ts delete mode 100644 .brightsec/tests/get-api-partners-search-partners.test.ts delete mode 100644 .brightsec/tests/get-api-products-latest.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-render.test.ts delete mode 100644 .brightsec/tests/post-api-testimonials.test.ts delete mode 100644 .brightsec/tests/post-graphql-latest-products.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/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 dae41b58..00000000 --- a/.brightsec/tests/delete-api-file-path-config-products-crystals-some-file-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('DELETE /api/file?path=config/products/crystals/some_file.jpg', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['full_path_disclosure'], - 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`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); diff --git a/.brightsec/tests/get-api-auth-jwt-kid-sql-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-kid-sql-validate.test.ts deleted file mode 100644 index 517132b3..00000000 --- a/.brightsec/tests/get-api-auth-jwt-kid-sql-validate.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('GET /api/auth/jwt/kid-sql/validate', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['full_path_disclosure'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/jwt/kid-sql/validate`, - headers: { 'Authorization': 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.brightsec/tests/get-api-auth-jwt-rsa-signature-validate.test.ts b/.brightsec/tests/get-api-auth-jwt-rsa-signature-validate.test.ts deleted file mode 100644 index 7cbbf6d1..00000000 --- a/.brightsec/tests/get-api-auth-jwt-rsa-signature-validate.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('GET /api/auth/jwt/rsa/signature/validate', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt'], - attackParamLocations: [AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/auth/jwt/rsa/signature/validate`, - headers: { Authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 deleted file mode 100644 index f8a5690c..00000000 --- a/.brightsec/tests/get-api-file-aws.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('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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); 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 399f8769..00000000 --- a/.brightsec/tests/get-api-file-azure.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('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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 deleted file mode 100644 index 7561fff9..00000000 --- a/.brightsec/tests/get-api-file-digital-ocean.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('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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); 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 1c1113d0..00000000 --- a/.brightsec/tests/get-api-file-google.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('GET /api/file/google', { 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/google?path=config/products/crystals/amethyst.jpg&type=image/jpg`, - headers: { accept: 'image/jpg' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); diff --git a/.brightsec/tests/get-api-file.test.ts b/.brightsec/tests/get-api-file.test.ts deleted file mode 100644 index aac0c98b..00000000 --- a/.brightsec/tests/get-api-file.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('GET /api/file', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['ssrf', 'full_path_disclosure', 'lfi'], - attackParamLocations: [AttackParamLocation.QUERY, AttackParamLocation.HEADER], - 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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); diff --git a/.brightsec/tests/get-api-goto.test.ts b/.brightsec/tests/get-api-goto.test.ts deleted file mode 100644 index d2262881..00000000 --- a/.brightsec/tests/get-api-goto.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/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`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); 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 000fa933..00000000 --- a/.brightsec/tests/get-api-partners-search-partners.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('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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 deleted file mode 100644 index ca1b8d27..00000000 --- a/.brightsec/tests/get-api-products-latest.test.ts +++ /dev/null @@ -1,37 +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, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] }, - skipStaticParams: false - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.GET, - url: `${baseUrl}/api/products/latest?limit=3`, - headers: { authorization: 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); diff --git a/.brightsec/tests/get-api-secrets.test.ts b/.brightsec/tests/get-api-secrets.test.ts deleted file mode 100644 index 786f13be..00000000 --- a/.brightsec/tests/get-api-secrets.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/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`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 deleted file mode 100644 index a6804408..00000000 --- a/.brightsec/tests/get-api-users-id-1.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/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`, - auth: process.env.BRIGHT_AUTH_ID - }); -}); diff --git a/.brightsec/tests/post-api-render.test.ts b/.brightsec/tests/post-api-render.test.ts deleted file mode 100644 index 4b2f9743..00000000 --- a/.brightsec/tests/post-api-render.test.ts +++ /dev/null @@ -1,37 +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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); diff --git a/.brightsec/tests/post-api-testimonials.test.ts b/.brightsec/tests/post-api-testimonials.test.ts deleted file mode 100644 index ea2eb612..00000000 --- a/.brightsec/tests/post-api-testimonials.test.ts +++ /dev/null @@ -1,44 +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/testimonials', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['jwt'], - attackParamLocations: [AttackParamLocation.BODY, AttackParamLocation.HEADER], - starMetadata: { databases: ['PostgreSQL'] } - }) - .setFailFast(false) - .timeout(timeout) - .run({ - method: HttpMethod.POST, - url: `${baseUrl}/api/testimonials`, - body: { - name: 'John Doe', - title: 'Great Service', - message: 'I had an excellent experience with this service.' - }, - headers: { - 'Content-Type': 'application/json', - Authorization: 'Bearer ' - }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 4949255b..00000000 --- a/.brightsec/tests/post-graphql-latest-products.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 latestProducts', { 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: "query { latestProducts { name category photoUrl description viewsCount } }" - }, - headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ 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 deleted file mode 100644 index 0d43775b..00000000 --- a/.brightsec/tests/post-graphql-view-product.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 /graphql viewProduct', { signal: AbortSignal.timeout(timeout) }, async () => { - await runner - .createScan({ - tests: ['graphql_introspection', 'sqli'], - attackParamLocations: [AttackParamLocation.BODY], - 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' }, - auth: process.env.BRIGHT_AUTH_ID - }); -}); \ No newline at end of file diff --git a/.github/workflows/bright.yml b/.github/workflows/bright.yml deleted file mode 100644 index 214ffe19..00000000 --- a/.github/workflows/bright.yml +++ /dev/null @@ -1,66 +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 -zv 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: Run security tests - env: - BRIGHT_HOSTNAME: ${{ vars.BRIGHT_HOSTNAME }} - BRIGHT_PROJECT_ID: ${{ vars.BRIGHT_PROJECT_ID }} - BRIGHT_AUTH_ID: ${{ vars.BRIGHT_AUTH_ID }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRIGHT_TOKEN: ${{ secrets.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