No description
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-17 03:40:06 +00:00
.forgejo/workflows ci: bot identity -> system service user [skip ci] 2026-11-16 22:40:03 -05:00
dist port to git.bun.cafe: default server URL, registry, bot email, runner label 2026-11-16 17:15:29 -05:00
src port to git.bun.cafe: default server URL, registry, bot email, runner label 2026-11-16 17:15:29 -05:00
test feat(pip): a pyproject without requirements.txt announces itself 2026-08-10 15:02:15 -04:00
.gitignore feat: multi-ecosystem audit reported as a PR comment or an issue 2026-08-05 11:41:13 -04:00
action.yml feat(images): opt-in trivy scanning of deployed image references 2026-08-07 14:33:15 -04:00
CHANGELOG.md chore(release): v1.5.0 2026-11-16 22:16:31 +00:00
package-lock.json feat: multi-ecosystem audit reported as a PR comment or an issue 2026-08-05 11:41:13 -04:00
package.json chore(release): v1.5.0 2026-11-16 22:16:32 +00:00
README.md port to git.bun.cafe: default server URL, registry, bot email, runner label 2026-11-16 17:15:29 -05:00

audit

Audits whatever is actually in the repo and reports it where it will be seen — a comment on a pull request, a labelled issue anywhere else.

jobs:
  audit:
    runs-on: self-hosted
    container:
      image: node:24-bookworm
    steps:
      - uses: actions/checkout@v4
      - uses: actions/audit@main
        with:
          token: ${{ secrets.RELEASE_BOT_PAT }}

One step, correct in a node repo and a Go repo, because which checkers run is decided by what is present:

checker detected by how
npm package-lock.json npm audit --json, run against the production tree and the full tree
go go.mod govulncheck when available, else OSV version matching
cargo Cargo.lock parsed, queried against OSV
pip requirements.txt pinned (==) entries only, queried against OSV
dockerfile Dockerfile unpinned base images (:latest, or no tag)

Why this exists

Vulnerability visibility used to be an accident of Docker layer caching. org-chart printed 3 vulnerabilities because npm prune --omit=dev happened to run inside its build — so when a merge's tree matched an already-built branch, every layer cached, the command never executed, and the build reported nothing at all. You cannot tell from a silent log whether a repo is clean or whether the check was skipped.

This runs outside the image build, every time, and its silence means something.

Reachability, where it can be had

For Go the native tool is not merely tidier, it answers a different question. govulncheck resolves the call graph, so it reports whether your code actually calls the vulnerable function. On deployer:

40 advisories required   →   1 reachable
GO-2026-4945  github.com/go-jose/go-jose/v4@v4.0.2 → v4.1.4
  auth.go:71:31: deployer.Authenticator.authenticate calls
    oidc.IDTokenVerifier.Verify, which eventually calls jose.JSONWebSignature.Verify

The other 39 are in SSH server and agent code deployer never calls, including eight rated critical. Both signals are reported, because they answer different questions — one is act-now, the other is version-level remediation backlog — but they are ranked by reachability rather than severity. A critical the code cannot reach is less urgent than a high it calls from its auth path.

So the Go checker reports three tiers: reachable, imported (you import the package, no call path found) and present (you require the module, no call). Without the toolchain it falls back to OSV and reports one tier, unknown — labelled that way on purpose, since "not analysed" is not "not callable".

Run it with the toolchain by using the image that has it:

container:
  image: git.bun.cafe/actions/node-go:24

Go advisories carry no severity of their own — a GO-xxxx entry only has a GHSA- alias that does — so severity is resolved through the alias. govulncheck's bundled copy often lists only the CVE, so the alias is read from osv.dev's copy of the same id.

The reported location is the call site in your module, not the vulnerable symbol's own file, plus the path that reaches it:

where:  auth.go:71, auth.go:9
via:    deployer.authenticate → oidc.Verify → v4.ParseSigned

npm gets a weaker version of the same thing

There is no free equivalent of govulncheck for npm, and it is not only a tooling gap: Go's call graph is statically sound, while JS has dynamic require, runtime patching and tree-shaking, so a sound call graph is not available.

What is available is whether your own source references the package:

jspdf      src/components/OrgChart.tsx:21     your code imports it
dompurify  transitive via jspdf               a dependency does
lodash     transitive via dagre, graphlib     dependencies do

That decides who fixes it and how — the jspdf major bump touches one file, and dompurify resolves with it.

No import site is not evidence of safety. lodash is never imported by org-chart's source and still executes on every render, because dagre requires it. The claim is "our code does not reference this", not "this cannot run".

Why OSV for the rest

cargo-audit reads Cargo.lock against RustSec, which OSV already ingests, and does no reachability analysis — so it would buy almost nothing over what is here.

pip-audit would buy something real, but for resolution rather than data: the parser here only handles fully pinned (==) requirements and skips ranges, which is under-reporting. That is the worst failure mode an audit can have, and it is the next thing worth fixing.

OSV also stays the fallback everywhere, so a repo whose workflow uses a plain node image still gets coverage rather than silence.

OSV usually reports a CVSS vector rather than a number, so severity is computed from the vector using the v3.1 base-score equations. Without that, nearly every non-npm finding came out as info. The implementation is checked against published scores — Log4Shell 10.0, Heartbleed 7.5 — because it silently decides how serious everything looks.

Production against development

The npm checker audits both trees and labels findings by scope, because either one alone misleads.

Auditing only production hides what ships to browsers. org-chart had three production findings purely because client-only libraries were declared as runtime dependencies; moving them to devDependencies made the production audit clean while the same vulnerable jspdf and dompurify code still shipped inside dist/assets.

Auditing everything together hides which findings are actually in the running container. So the report separates them and says which is which.

Image scanning

Lockfile audits cover what a repo builds; they say nothing about the images a deployment actually runs — third-party images most of all, since their source never passes through this org. The images checker scans image references with trivy: OS packages in the layers plus bundled language dependencies, aggregated one row per package like the npm checker, sectioned by image.

It is opt-in, never detected. Compose files in app repos are mostly local dev tooling, and a dev database's :latest is not a finding. A repo opts in by naming deployed refs (images: swaggerapi/swagger-ui:v5.29.5) or the compose file that describes a real deployment (compose: docker-compose.yml); the gitops repo passes its rendered cluster inventory. Every ref also gets the Dockerfile checker's pinning rule — an unpinned or :latest ref is a low finding regardless of what trivy says.

The default severity floor is high and unfixed advisories are excluded — every debian/alpine base always carries some unfixed lows, and a scan that cries wolf on day one gets ignored by week two (image-severity lowers the floor). trivy must be on the runner; its absence, or a ref that cannot be pulled, is reported as a moderate finding ("unknown, not clean") rather than thrown, so one bad ref cannot discard every other image's results.

Reporting

report: auto (the default) comments on a pull request and opens an issue otherwise. Both carry the same body.

The PR comment is upserted — a branch pushed to repeatedly carries one current report, not a column of stale ones.

The issue works differently: it is one issue per finding state. A run whose finding set is unchanged refreshes the open issue in place; a run whose set changed — findings fixed, new advisories published, or both — closes the open issue with a "Superseded by #N" comment and opens a fresh one that links back with "Supersedes #M"; a clean run closes it with a comment saying so. The audit trail is therefore a chain of closed issues anyone can walk, rather than one issue's edit history. State comparison rides on a fingerprint embedded invisibly in the report body, so an issue predating this behaviour rotates once on the first run that sees it.

A checker that cannot run is reported above the findings, and the issue title says so. Treat those ecosystems as unknown, not clean — tofu-drift swallowing its own errors is how an expired Cloudflare token stayed hidden for a week.

Inputs

input default notes
token — required; a bot PAT with issue and PR write, and access to this repo
working-directory . manifests are detected relative to this
only / skip (all detected) checker names
images (none) image refs to scan with trivy; opt-in, see Image scanning
compose (none) compose file(s) whose image: refs are scanned
image-severity high severity floor for image scanning
fail-on none none, low, moderate, high, critical
report auto auto, comment, issue, none
label audit used to find, reuse and close the issue

Outputs: total, worst, critical, high, moderate, low, info, errors.

fail-on defaults to never failing

Adding this action should start reporting, not start breaking builds that were already green — org-chart would have gone red immediately on a jspdf advisory published months after its last dependency change. Opt into a threshold once a repo is clean:

with:
  token: ${{ secrets.RELEASE_BOT_PAT }}
  fail-on: critical

errors is worth gating on separately if you want a hard failure when a checker could not complete, since that is not a clean result.

A finding is not evidence of a recent change

Advisory databases are queried live, so an untouched lockfile audits worse over time. org-chart's three findings were jspdf@3.0.1, dompurify@3.2.6 and lodash@4.17.21 — unchanged versions, with advisories published between August 2025 and June 2026. The report says this inline, because the first instinct on seeing it is to look for what changed, and nothing did.

Scheduling

Since findings appear without any commit, a cron run is what catches them:

on:
  pull_request:
    branches: [main]
  schedule:
    - cron: '0 8 * * 1'
  workflow_dispatch: {}

A PR run comments; the scheduled run keeps the labelled issue tracking the current finding state — rotating it when the state changes and closing it once clean.