Skip to content

Configuration Override

Override your application's configuration by providing a partial JSON configuration. This configuration merges with your existing Escape settings using the deepmerge algorithm.

Info

For detailed configuration options, see Parameters Reference.

Implementation Examples

name: Post Deploy
on:
  push:
    branches:
      - staging
jobs:
  Escape:
    runs-on: ubuntu-latest
    steps:
      - name: Escape Scan
        uses: Escape-Technologies/action@v0
        with:
          application_id: ${{ secrets.ESCAPE_APPLICATION_ID }}
          api_key: ${{ secrets.ESCAPE_API_KEY }}
          configuration_override: '{"users":{"user1":{"auth":"schema1","headers":{"Authorization":"<YOUR_AUTH>"}}},"auth":{"schema1":{"tech":"manual"}}}'
          # Optional: Use configuration file instead
          # configuration_override_path: ./configuration_override.json
Escape:
  stage: post-deploy
  needs:
    - deploy # name of your deployment job
  variables:
    - ESCAPE_APPLICATION_ID: $ESCAPE_APPLICATION_ID
    - ESCAPE_API_KEY: $ESCAPE_API_KEY
    - CONFIGURATION_OVERRIDE: '{"users":{"user1":{"auth":"schema1","headers":{"Authorization":"<YOUR_AUTH>"}}},"auth":{"schema1":{"tech":"manual"}}}'
    # Optional: Use configuration file instead
    # - CONFIGURATION_OVERRIDE_PATH: ./configuration_override.json
  image: node:alpine
  before_script:
    - npm install -g @escape.tech/action
    - npm show @escape.tech/action version
  script:
    - escape-action
  allow_failure: true
  only:
    refs:
      - staging
image: node:alpine

pipelines:
  default:
    - step:
        name: Deploy
        script:
          # Your deployment scripts here

    - step:
        name: Escape
        trigger: manual  # Set to manual if you wish to run this step manually
        after-script:   # Similar to post-deploy in GitLab
          - npm install -g @escape.tech/action
          - npm show @escape.tech/action version
          - escape-action
        deployment: staging  # Assuming staging environment for deployment
        script:
          - echo "Starting Escape scan..."
        services:
          - docker
        caches:
          - node
        size: 2x
        max-time: 10
        variables:
          ESCAPE_APPLICATION_ID: $ESCAPE_APPLICATION_ID
          ESCAPE_API_KEY: $ESCAPE_API_KEY
          CONFIGURATION_OVERRIDE: '{"users":{"user1":{"auth":"schema1","headers":{"Authorization":"<YOUR_AUTH>"}}},"auth":{"schema1":{"tech":"manual"}}}'
          # Optional: Use configuration file instead
          # CONFIGURATION_OVERRIDE_PATH: ./configuration_override.json
version: 2.1

jobs:
  deploy:
    docker:
      - image: node:alpine
    steps:
      - checkout
      # Your deployment steps here

  escape_scan:
    docker:
      - image: node:alpine
    steps:
      - checkout
      - run:
          name: Install Escape CLI
          command: |
            npm install -g @escape.tech/action
            npm show @escape.tech/action version
      - run:
          name: Run Escape Scan
          command: escape-action
      environment:
        ESCAPE_APPLICATION_ID: $ESCAPE_APPLICATION_ID
        ESCAPE_API_KEY: $ESCAPE_API_KEY
        CONFIGURATION_OVERRIDE: '{"users":{"user1":{"auth":"schema1","headers":{"Authorization":"<YOUR_AUTH>"}}},"auth":{"schema1":{"tech":"manual"}}}'
        # Optional: Use configuration file instead
        # CONFIGURATION_OVERRIDE_PATH: ./configuration_override.json

workflows:
  version: 2
  deploy_and_scan:
    jobs:
      - deploy
      - escape_scan:
          requires:
            - deploy
          filters:
            branches:
              only: staging
pipeline {
    agent {
        docker {
            image 'node:alpine'
        }
    }

    environment {
        ESCAPE_APPLICATION_ID = credentials('ESCAPE_APPLICATION_ID')
        ESCAPE_API_KEY = credentials('ESCAPE_API_KEY')
        CONFIGURATION_OVERRIDE = '{"users":{"user1":{"auth":"schema1","headers":{"Authorization":"<YOUR_AUTH>"}}},"auth":{"schema1":{"tech":"manual"}}}'
        # Optional: Use configuration file instead
        # CONFIGURATION_OVERRIDE_PATH = './configuration_override.json'
    }

    stages {
        stage('Checkout') {
            steps {
                checkout scm // Checkout the codebase from the SCM provider
            }
        }

        stage('Post-Deploy') {
            when {
                branch 'staging' // Only run on the 'staging' branch
            }

            steps {
                script {
                    // Install the Escape CLI tool
                    sh 'npm install -g @escape.tech/action'

                    // Show the installed Escape CLI version
                    sh 'npm show @escape.tech/action version'

                    // Run the Escape action
                    sh 'escape-action'
                }
            }

            post {
                always {
                    // Configuration to allow failure
                }
            }
        }
    }
}
trigger:
  branches:
    include:
      - staging

pool:
  vmImage: 'ubuntu-latest'

jobs:
  - job: EscapeScan
    displayName: 'Escape Scan'
    dependsOn: deploy # Assuming you have a 'deploy' job defined elsewhere in your Azure DevOps pipeline.

    variables:
      ESCAPE_APPLICATION_ID: $(EscapeAppId) # Define these in the Azure DevOps Pipeline environment variables or in a variable group.
      ESCAPE_API_KEY: $(EscapeApiKey)
      CONFIGURATION_OVERRIDE: '{"users":{"user1":{"auth":"schema1","headers":{"Authorization":"<YOUR_AUTH>"}}},"auth":{"schema1":{"tech":"manual"}}}'
      # Optional: Use configuration file instead
      # CONFIGURATION_OVERRIDE_PATH: ./configuration_override.json

    steps:
      - script: |
          sudo npm install -g @escape.tech/action
          npm show @escape.tech/action version
          escape-action
        displayName: 'Run Escape Action'
        env:
          ESCAPE_APPLICATION_ID: $(EscapeAppId)
          ESCAPE_API_KEY: $(EscapeApiKey)
          CONFIGURATION_OVERRIDE: $(CONFIGURATION_OVERRIDE)
          # Optional: Use configuration file instead
          # CONFIGURATION_OVERRIDE_PATH: $(CONFIGURATION_OVERRIDE_PATH)
          continueOnError: true
language: node_js
node_js:
  - node

jobs:
  include:
    - stage: security
      if: branch = staging
      script:
        - npm install -g @escape.tech/action
        - npm show @escape.tech/action version
        - escape-action
      env:
        - ESCAPE_APPLICATION_ID=$ESCAPE_APPLICATION_ID
        - ESCAPE_API_KEY=$ESCAPE_API_KEY
        - CONFIGURATION_OVERRIDE='{"users":{"user1":{"auth":"schema1","headers":{"Authorization":"<YOUR_AUTH>"}}},"auth":{"schema1":{"tech":"manual"}}}'
        # Optional: Use configuration file instead
        # - CONFIGURATION_OVERRIDE_PATH=./configuration_override.json

stages:
  - security
export ESCAPE_APPLICATION_ID=<YOUR APPLICATION ID>
export ESCAPE_API_KEY=<YOUR API KEY>
export CONFIGURATION_OVERRIDE='{"users":{"user1":{"auth":"schema1","headers":{"Authorization":"<YOUR_AUTH>"}}},"auth":{"schema1":{"tech":"manual"}}}'
# Optional: Use configuration file instead
# export CONFIGURATION_OVERRIDE_PATH="./configuration_override.json"

npm i -g @escape.tech/action
escape-action
export APPLICATION_ID=<YOUR APPLICATION ID>
export API_KEY=<YOUR API KEY>
export CONFIGURATION_OVERRIDE='{"users":{"user1":{"auth":"schema1","headers":{"Authorization":"<YOUR_AUTH>"}}},"auth":{"schema1":{"tech":"manual"}}}'
# Optional: Use configuration file instead
# export CONFIGURATION_OVERRIDE_PATH="./configuration_override.json"

curl -X POST \
-H "Authorization: Key $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"configurationOverride\": $CONFIGURATION_OVERRIDE }"
https://public.escape.tech/applications/$APPLICATION_ID/start-scan