Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

docs: add a reusable SARIF upload workflow example#4

Open
dchaudhari7177 wants to merge 1 commit into
mockingbird777:mainmockingbird777/hooktripwire:mainfrom
dchaudhari7177:docs/sarif-upload-exampledchaudhari7177/hooktripwire:docs/sarif-upload-exampleCopy head branch name to clipboard
Open

docs: add a reusable SARIF upload workflow example#4
dchaudhari7177 wants to merge 1 commit into
mockingbird777:mainmockingbird777/hooktripwire:mainfrom
dchaudhari7177:docs/sarif-upload-exampledchaudhari7177/hooktripwire:docs/sarif-upload-exampleCopy head branch name to clipboard

Conversation

@dchaudhari7177

Copy link
Copy Markdown

What

Adds examples/sarif-upload.yml — a copy-paste workflow that uploads HookTripwire's SARIF to GitHub code scanning — and links it from the README's GitHub Actions section.

Per the acceptance criteria:

  • step roles are explicit: the audit step runs mockingbird777/hooktripwire with format: sarif + an explicit output path and owns the job's pass/fail via fail-on: high; the upload step is github/codeql-action/upload-sarif
  • if: always() interaction documented in comments: the upload runs even when the audit step fails the job so findings reach the Security tab, while the job's final result still comes from the audit threshold
  • fork-PR permission boundary: workflows from fork PRs don't receive security-events: write, so the upload step is conditionally skipped (head.repo.full_name == github.repository) rather than suggesting broader credentials; fail-on still gates those runs
  • least privilege & pinning: contents: read + security-events: write only; checkout reuses the repo's existing SHA pin, upload-sarif is pinned to the v4.37.1 full SHA, and the composite Action itself is pinned to the v0.2.0 release commit SHA
  • no pull_request_target, no shell interpolation of untrusted values (the workflow has no run: steps at all)

Verification

  • YAML parses (yaml.safe_load)
  • npm test: 55/56 — the one failure (does not follow symbolic links) is pre-existing on my Windows machine (symlink creation requires elevation) and fails identically on a clean checkout
  • npm audit: 0 vulnerabilities

Fixes #2

Adds examples/sarif-upload.yml showing the audit step producing SARIF
via the composite Action and github/codeql-action/upload-sarif sending
it to code scanning. Least-privilege permissions (contents: read +
security-events: write), full-SHA pins for third-party Actions, an
explanation of how fail-on interacts with if: always() on the upload
step, and a fork-PR guard instead of broader credentials. Linked from
the README's GitHub Actions section.

Fixes mockingbird777#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: add a reusable SARIF upload workflow example

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.