Skip to content

GitHub Action

Kovar ships a GitHub Action that runs security checks and posts findings as PR comments.

.github/workflows/security.yml
name: Security Check
on: [pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install chromium
- name: Run security check
uses: ./.github/actions/security-check
with:
url: "https://staging.your-app.com"
checks: "headers,cookies"
fail-on: "high"
comment: "true"
github-token: ${{ secrets.GITHUB_TOKEN }}
InputDescriptionRequiredDefault
urlURL to checkYes
checksComma-separated checks to runNoheaders,cookies
fail-onMinimum severity to fail: critical, high, medium, lowNohigh
commentPost findings as PR commentNotrue
github-tokenGitHub token for PR commentsNo${{ github.token }}
baseline-pathPath to baseline JSON file for tracking findings across PRsNo"" (disabled)
update-baselineSave current findings as new baselineNofalse
OutputDescription
scoreSecurity score (0-100)
findings-countTotal number of findings
passedWhether the check passed (true/false)

When comment is enabled, Kovar posts a structured comment on the PR with:

  • Security score (0-100)
  • Pass/fail status based on the severity threshold
  • Summary table of findings by severity
  • Expandable details for each finding with CWE references and remediation guidance

When baseline tracking is enabled, the comment additionally shows:

  • New Findings — findings not in the baseline (regressions)
  • Existing Findings — findings already known from the baseline
  • Resolved — baseline findings no longer present (improvements)

To track findings across PRs, save a baseline on main and diff against it on PRs:

jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npx playwright install chromium
- name: Run security check with baseline
uses: ./.github/actions/security-check
with:
url: "https://staging.your-app.com"
baseline-path: ".kovar/baseline.json"
update-baseline: ${{ github.ref == 'refs/heads/main' }}
github-token: ${{ secrets.GITHUB_TOKEN }}

This saves the baseline on main branch merges and diffs against it on PRs.

You can use the outputs in subsequent steps:

- name: Run security check
id: security
uses: ./.github/actions/security-check
with:
url: "https://staging.your-app.com"
- name: Check results
run: |
echo "Score: ${{ steps.security.outputs.score }}"
echo "Findings: ${{ steps.security.outputs.findings-count }}"
echo "Passed: ${{ steps.security.outputs.passed }}"
  • Baseline Tracking — track security baselines across PRs.
  • Reporter — Playwright reporter for local and CI test runs.
  • Full Audit — the audit that powers the GitHub Action.