Skip to content

Epic: chant audit — standalone CI security auditor for any repo #350

Closed

Description

@lex00

Turn chant's CI security rules into a tool that audits any repo's pipelines — including hand-written YAML chant did not generate.

Why

chant already ships a deep CI security rule set: 58 GHA rules (github), 44 WGL rules (gitlab), and forgejo reuses github's set. Today those rules only run during a chant build, so they only see workflows chant generates. Epic #296 named this exact gap in its Out of scope note:

Whole-repo coverage of hand-written workflows — post-synth only sees workflows chant generates. For non-generated YAML, run a dedicated auditor on the output.

chant audit is that dedicated auditor. It reads existing .github/workflows/*.yml, .gitlab-ci.yml, and .forgejo/workflows/*.yml, runs the real post-synth security checks against them, and emits a tiered report.

Goals

  1. Library + CLI — chant audit <path> on any repo, no chant adoption required. Primary near-term deliverable.
  2. Tiered findings — separate merge-worthy security findings (worth a PR to the target) from report-only hygiene, with external-authority citations (OSSF Scorecard / GitHub hardening) so a finding isn't just chant's opinion.
  3. Shareable report — a markdown artifact suitable for outreach or a PR description.
  4. Hosted tool (portfolio piece) — a paste-a-URL web service wrapping the same library, scale-to-zero, rate-limited. Phase 2; ships only after the library is solid.

Design spine (read before picking up a child)

  • Post-synth checks (lexicons/<lex>/src/lint/post-synth/*.ts) are sync, auto-discovered via plugin.postSynthChecks(), and read the emitted YAML from ctx.outputs (Map<string, string | SerializerResult>). See packages/core/src/lint/post-synth.ts (PostSynthContext, runPostSynthChecks, getPrimaryOutput).
  • The auditor therefore needs no import-to-chant-model step for the security tier. It constructs a synthetic PostSynthContext whose outputs map is filePath → rawYAML (entities empty, env undefined) and runs the target lexicon's checks. Checks that iterate for (const [, output] of ctx.outputs) handle one-doc and cross-file checks alike.
  • No LLM anywhere in the audit or the hosted service. Findings are deterministic lint rules (zero inference, no API key). Fixes split by fixKind (see feat(audit): rule catalog — tiering, authority citations, remediation #351): deterministic fixes (add permissions: contents: read; pin @v4→@sha via a git API lookup, not a model) may be auto-applied/diffed (feat(audit): round-trip proof of minimal change per finding #358); guidance fixes (right-sized scopes, injection rewrites, pwn-request redesigns) are report text only, never auto-applied. Any LLM-assisted apply is a separate, optional, local bring-your-own-key step — never run or paid for by the service. This keeps remote cost ~\$0.
  • Known limitation: any check that reads ctx.entities (chant model) instead of ctx.outputs (YAML) will not fire on audited YAML. The security tier is YAML-based, so this is acceptable — document per-rule in the catalog.
  • The existing chant import CLI is not reused: it gates on JSON.parse (import.ts:201) and rejects YAML before reaching the YAML parser. The auditor calls the lexicon parsers / post-synth checks directly.

Phasing

Phase 1 — library + CLI (do first)

Phase 2 — hosted tool (good-problem-to-have)

Cold-start conventions

Each child is self-contained: target files, the approach, tests, and a Definition of done. Shared rules: npx vitest run stays green; new code lives under packages/core/src/audit/; no network or fs in the pure core (fetch is isolated to its own module); rerun docs codegen if rule metadata is surfaced in docs.

Unlinked sub-issues (attached 2026-08-23)

Activity

  1. added
    enhancement
    on Jun 16, 2026
  2. added a commit that references this issue on Jul 5, 2026
  3. added
    epic
    area:audit
    on Aug 23, 2026
  4. lex00 commented on Aug 26, 2026

    @lex00
    ContributorAuthor

    Status sweep (2026-08-26). All five unlinked sub-issues closed today: #443 (secrets detection, SEC001–SEC010, PR #1969), #445 (supply-chain/token-scoping, GHA059–GHA062, PR #1975), #444 (efficiency dimension + GHA063–GHA068/WGL049–WGL050, PR #1976), #442 (SARIF completion — tier/category properties, remediation help, ajv schema validation, PR #1974), #446 (spike-gated format coverage — Wrangler TOML, WRG001–WRG006, PR #1978; nginx follow-up filed as #1979). Also landed adjacent: search-first fetch discovery for large repos (#520, PR #1971).

    Phase 2 disposition — #356 held back, #357 status: per this epic's own comments, #357's hardening layers are implemented and tested in the private INTENTIUS/blacklight service repo (per-IP + global rate limits over KV, fail-closed Turnstile, SSRF host-allowlist, resource caps), env-gated off by default; #356's handler + tier-first SPA are built and E2E-verified there, and #431 (npm publish) has since closed, removing the file:-deps deploy blocker. What remains is deploy-time work tracked in the blacklight repo (blacklight#1 deploy, #2 CORS lock to Pages origin, #3 counters, #4 optional DO) plus flipping the gates on for prod. Those are outward-facing launch actions in another repo — deliberately left for the maintainer; nothing further blocks them from this repo's side.

  5. lex00 commented on Sep 2, 2026

    @lex00
    ContributorAuthor

    Every phase is shipped, so closing the epic.

    Phase 1 (library + CLI) — #354/#351/#353/#352/#358, all long merged.

    Phase 2 (hosted tool) — #355 merged; #356 shipped as INTENTIUS/blacklight (live at blacklight.intentius.workers.dev); #357, the public-launch gate, closed today with a full review: rate limiting live-verified (5/min → 429), SSRF live-verified (metadata IP → 400), exact in-flight concurrency via a Durable Object (blacklight#26), resource caps and reject-reason logging in place. The one remaining human step — enabling Turnstile with account credentials — is documented in blacklight's README and deliberately not automated.

    Since the epic was filed, coverage also grew past its original scope: secrets (SEC), Wrangler config (WRG, #446), and today nginx (NGX, #1979) — all lexicon-independent, all running on both the local CLI and the hosted path. Dogfooding the hosted bump surfaced and fixed three engine regressions this week (#2055 edge-cleanliness, #2056 candidate collection, #2057 lockfile noise), which is the epic's model working as intended: the hosted tool is now the audit engine's best integration test.

    Current live state: chant 0.54.2 on npm, blacklight deployed against it, 65 audits / 2014 findings on the anonymous counter.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:auditenhancementepic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions