Evaluate pull request code changes against Asymptote security policies. This action posts inline review comments on violations and creates a check run with annotations.
- Evaluates PR diffs against your organization's security policies
- Posts inline review comments on code with security issues
- AI-generated code fix suggestions rendered as GitHub suggestion blocks with one-click "Apply suggestion"
- "Fix in Cursor" deeplink button on each violation comment for one-click remediation in Cursor
- Creates check runs with detailed annotations
- Configurable severity thresholds for failing checks and posting comments
- Supports all severity levels: critical, high, medium, low
name: Security Scan
on:
pull_request:
branches: [main]
permissions:
contents: write
pull-requests: write
checks: write
jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Asymptote Security Scan
uses: ./.github/actions/asymptote-security-scan
with:
asymptote_api_key: ${{ secrets.ASYMPTOTE_API_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- name: Asymptote Security Scan
uses: ./.github/actions/asymptote-security-scan
with:
asymptote_api_key: ${{ secrets.ASYMPTOTE_API_KEY }}
fail_on: high # Fail the check on high or critical violations
comment_on: high # Post comments on high or critical violations
exclude_paths: '**/dist/**,**/*.min.js,**/node_modules/**' # Skip generated files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}To show Asymptote branding on PR comments instead of "github-actions", use the Asymptote GitHub App:
jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate Asymptote App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.ASYMPTOTE_GITHUB_APP_ID }}
private-key: ${{ secrets.ASYMPTOTE_GITHUB_APP_PRIVATE_KEY }}
- name: Asymptote Security Scan
uses: ./.github/actions/asymptote-security-scan
with:
asymptote_api_key: ${{ secrets.ASYMPTOTE_API_KEY }}
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}- name: Asymptote Security Scan
id: security-scan
uses: ./.github/actions/asymptote-security-scan
with:
asymptote_api_key: ${{ secrets.ASYMPTOTE_API_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check Results
if: always()
run: |
echo "Decision: ${{ steps.security-scan.outputs.decision }}"
echo "Total violations: ${{ steps.security-scan.outputs.total_violations }}"
echo "Critical: ${{ steps.security-scan.outputs.critical_count }}"
echo "High: ${{ steps.security-scan.outputs.high_count }}"
echo "Medium: ${{ steps.security-scan.outputs.medium_count }}"| Input | Required | Default | Description |
|---|---|---|---|
asymptote_api_key |
Yes | - | Asymptote API key with evaluate_diff scope |
asymptote_api_url |
No | https://asymptote-edge-... |
Asymptote Edge API URL |
fail_on |
No | high |
Minimum severity to fail the check (critical, high, medium, low) |
comment_on |
No | high |
Minimum severity to post PR comments (critical, high, medium, low) |
exclude_paths |
No | - | Comma-separated glob patterns to exclude from scanning (e.g., **/dist/**,**/*.min.js) |
| Output | Description |
|---|---|
decision |
Overall evaluation decision: allow, warn, or block |
total_violations |
Total number of violations found |
critical_count |
Number of critical severity violations |
high_count |
Number of high severity violations |
medium_count |
Number of medium severity violations |
This action requires the following GitHub token permissions:
permissions:
contents: write # Read repo contents + resolve outdated review threads (GraphQL)
pull-requests: write # Post review comments
checks: write # Create check runs with annotationsNote:
contents: writeis required for theresolveReviewThreadGraphQL mutation used to auto-resolve outdated violation threads. If you prefercontents: read, the action will still work but outdated threads won't be auto-resolved.
To use this action, you need an Asymptote API key with the evaluate_diff scope:
- Go to your Asymptote Dashboard
- Navigate to Settings > API Keys
- Create a new API key with
citype andevaluate_diffscope - Add the key to your repository secrets as
ASYMPTOTE_API_KEY
| Level | Description |
|---|---|
critical |
Severe security issues that must be fixed |
high |
Important security issues that should be addressed |
medium |
Moderate security concerns |
low |
Minor security suggestions |
info |
Informational notices (not security issues) |
For violations that meet the comment_on threshold, the action generates AI-powered code fix suggestions using the Asymptote API. These are rendered as GitHub suggestion blocks with a native "Apply suggestion" button. Users can apply fixes individually or batch multiple suggestions into a single commit.
If fix generation fails, comments are still posted with remediation guidance (graceful degradation).
Each violation comment includes a "Fix in Cursor" button that deep-links into Cursor with a prompt to fix the specific issue. This uses an HTTPS redirect page (/open/cursor) that opens the cursor:// protocol client-side, since GitHub strips non-HTTPS protocols from comment HTML.
| Scenario | Behavior |
|---|---|
| Invalid API key (401) | Fails with clear error message |
| Rate limited (429) | Warns but does not fail the check |
| Evaluation timeout | Warns but does not fail the check |
| Network errors | Retries with backoff, then fails |
cd .github/actions/asymptote-security-scan
npm install
npm run buildUse act to test the action locally:
act pull_request -s ASYMPTOTE_API_KEY=your_key -s GITHUB_TOKEN=your_tokenMIT