API Reference
GitHub Action Reference

GitHub Action Reference

The bg-playground/nat-action GitHub Action runs a NAT security scan as part of your CI/CD workflow.

Usage

- uses: bg-playground/nat-action@v1
  with:
    api-url: https://api.example.com
    api-key: ${{ secrets.NAT_API_KEY }}

Inputs

Required inputs

InputDescription
api-urlThe base URL of the API to scan
api-keyYour NAT API key. Store this in a GitHub secret — never hard-code it.

Discovery inputs

InputDescriptionDefault
specPath to an OpenAPI 3.x or Swagger 2.x spec file (local path or URL)Auto-discover
graphqlEnable GraphQL testing mode (true / false)false
graphql-endpointGraphQL endpoint path/graphql
graphql-schemaPath to GraphQL schema fileAuto-introspect
depthEndpoint discovery crawl depth3
includeComma-separated path patterns to includeAll
excludeComma-separated path patterns to excludeNone

Authentication inputs

InputDescriptionDefault
auth-typeAuthentication method: bearer, header, basic, oauth2, nonenone
tokenBearer token value
secondary-tokenSecond user token for BOLA testing
headerCustom header in Name: Value format (repeatable)
usernameUsername for Basic auth
passwordPassword for Basic auth
oauth2-token-urlOAuth2 token endpoint URL
oauth2-client-idOAuth2 client ID
oauth2-client-secretOAuth2 client secret
oauth2-scopeOAuth2 scopes (space-separated)
oauth2-grant-typeOAuth2 grant type: client_credentials, passwordclient_credentials

Execution inputs

InputDescriptionDefault
concurrencyParallel request count5
timeoutPer-request timeout in seconds30
rate-limitMaximum requests per secondUnlimited
max-requestsHard cap on total requestsUnlimited

Output inputs

InputDescriptionDefault
fail-onSeverity level that fails the workflow step: critical, high, medium, low, infohigh
output-formatReport format: html, json, sarifsarif
output-fileOutput report file pathnat-results.sarif

Check customization inputs

InputDescription
profileBuilt-in check profile name: owasp-api-top10, minimal, pci-dss, hipaa
disable-checksComma-separated check IDs to disable
enable-checksComma-separated check IDs to enable

Outputs

OutputDescription
scan-idUnique identifier for this scan
finding-countTotal number of findings
critical-countNumber of critical severity findings
high-countNumber of high severity findings
medium-countNumber of medium severity findings
low-countNumber of low severity findings
risk-scoreAggregate risk score (0–100)
report-urlURL to the full report in the NAT dashboard
report-filePath to the local report file

Examples

Basic scan with SARIF upload

- uses: bg-playground/nat-action@v1
  with:
    api-url: ${{ vars.STAGING_API_URL }}
    api-key: ${{ secrets.NAT_API_KEY }}
    spec: ./openapi.yaml
    auth-type: bearer
    token: ${{ secrets.API_TOKEN }}
 
- uses: github/codeql-action/upload-sarif@v3
  if: always()
  with:
    sarif_file: nat-results.sarif

OAuth2 authentication

- uses: bg-playground/nat-action@v1
  with:
    api-url: https://api.example.com
    api-key: ${{ secrets.NAT_API_KEY }}
    auth-type: oauth2
    oauth2-token-url: https://auth.example.com/oauth/token
    oauth2-client-id: ${{ secrets.OAUTH2_CLIENT_ID }}
    oauth2-client-secret: ${{ secrets.OAUTH2_CLIENT_SECRET }}
    oauth2-scope: "read write"

Fail only on critical findings

- uses: bg-playground/nat-action@v1
  with:
    api-url: ${{ vars.STAGING_API_URL }}
    api-key: ${{ secrets.NAT_API_KEY }}
    fail-on: critical

Custom check profile

- uses: bg-playground/nat-action@v1
  with:
    api-url: ${{ vars.STAGING_API_URL }}
    api-key: ${{ secrets.NAT_API_KEY }}
    profile: owasp-api-top10
    disable-checks: tls-issues,security-misconfiguration

Use outputs in subsequent steps

- uses: bg-playground/nat-action@v1
  id: nat
  with:
    api-url: ${{ vars.STAGING_API_URL }}
    api-key: ${{ secrets.NAT_API_KEY }}
 
- name: Comment findings on PR
  if: github.event_name == 'pull_request'
  uses: actions/github-script@v7
  with:
    script: |
      github.rest.issues.createComment({
        issue_number: context.issue.number,
        owner: context.repo.owner,
        repo: context.repo.repo,
        body: `**NAT Security Scan**: ${{ steps.nat.outputs.finding-count }} findings ` +
              `(Risk score: ${{ steps.nat.outputs.risk-score }}/100)\n` +
              `[View report](${{ steps.nat.outputs.report-url }})`
      })

Permissions

The action requires security-events: write permission to upload SARIF results:

permissions:
  security-events: write
  contents: read

Version pinning

Pin to a specific version for reproducible builds:

- uses: bg-playground/nat-action@v1.2.0

Next steps