Repository navigation
Repository security hygiene: CodeQL and OSV scans, Renovate, CODEOWNERS, sanitizer passthrough tests - #82
Merged
Conversation
Mirror coder/coder's security workflow shape for this TypeScript/pnpm monorepo: CodeQL for javascript-typescript and OSV-Scanner against pnpm-lock.yaml, both uploading SARIF to the Security tab, pinned to full commit SHAs, on push/PR/weekly schedule/dispatch. Assisted-by: AI
… support Extend config:recommended, enable vulnerabilityAlerts and osvVulnerabilityAlerts, pin GitHub Actions to digests, pick up pnpm-workspace.yaml catalog entries via the npm manager, group fumadocs-* packages, and pin ranges rather than leaving them floating. Assisted-by: AI
Default ownership on everything, plus explicit owners on the mdx-config/sanitizer/sync files that gate untrusted corpus content and on the workflows directory, since those are the files where a mistake has the highest blast radius. Individuals stand in for a team handle that doesn't exist yet. Assisted-by: AI
One sentence per header comment: Depot (depot-ubuntu-22.04-4) runs only the jobs that compile content and need 16 GB of memory, and everything else runs on ubuntu-latest since it needs no memory and Depot is metered. Comments only, no behavior change. Assisted-by: AI
MDX_PASSTHROUGH_TYPES lists five node kinds the sanitizer must let through untouched (mdxjsEsm, mdxFlowExpression, mdxTextExpression, mdxJsxFlowElement, mdxJsxTextElement); only two of the five had direct coverage. Add one pair of tests per type: an engine-generated node of that type survives verbatim, and a corpus-authored raw-HTML lookalike carrying a dangerous attribute (onclick, style, javascript:) is sanitized as ordinary raw HTML rather than treated as passthrough. Assisted-by: AI
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…y OSV action, fix pins - security.yaml: GitHub Code Security is not enabled on this private repo, so SARIF uploads would 403 and both jobs would be permanently red. Gate the codeql job, and the osv-scanner job's upload-sarif step, behind vars.CODE_SCANNING_ENABLED == 'true'; osv-scanner always uploads its SARIF as a workflow artifact so results are never lost while the variable is unset. - Replace the curl-and-chmod OSV-Scanner install with the official google/osv-scanner-action, pinned by verified commit SHA. - Replace the three github/codeql-action pins with the actual commit SHA (the previous pin was the annotated tag object, not a commit — it ran, but broke pin-hygiene tooling and Renovate's digest pinning). - Add actions: read to the codeql job (required for private repos) and persist-credentials: false to both checkout steps. - CODEOWNERS: say plainly that the sanitizer-boundary and workflow rules are documentary until a security team handle exists, since they currently name the same owners as the `*` default. - renovate.json: drop the npm.fileMatch block; current Renovate covers pnpm-workspace.yaml catalogs by default, so it added nothing and used a spelling Renovate would flag for migration. - Fix a vacuous sanitizer test: the mdxJsxFlowElement raw-HTML lookalike used a tag hast-util-sanitize unwraps entirely, so it never exercised attribute filtering. Assert the unwrap directly and add a second case on an allowed element to cover the real path. - Fix a new biome format violation introduced by an earlier commit. Assisted-by: AI
…steps inline Assisted-by: AI
…dition
Review follow-ups.
`osv-scanner` could not fail and could not report. Its outcome step exited 0
both when the scan was clean and when it found vulnerabilities, so the check
was green either way; with Code Security still gated off, the SARIF went only
to a workflow artifact. A scanner nobody can hear is worse than no scanner,
because the workflow's name implies coverage. Findings now land in the job
summary as a table and as warning annotations, and stay non-blocking on
purpose: a transitive advisory with no fix should not block unrelated pull
requests, and the archive serves prerendered files rather than running this
dependency tree. The failure case is narrowed to what it should always have
been -- a scan that did not happen. OSV-Scanner exits non-zero both when it
finds something and when it breaks, so the two are now told apart by whether
a result set exists, and an unsuccessful exit with an empty result set fails
rather than reading as clean.
While the Code Security gate is closed the job says so on every run, in the
log and the summary. Before, the codeql job reported as skipped and the
Security tab stayed empty, which is indistinguishable from a clean scan.
`steps.scan.outcome` moves out of the `run:` body into `env:`. It is a fixed
enum, so this is not a live injection, but a `${{ }}` expansion inside a
shell script is not the pattern to leave lying around for the next workflow
to copy. Renamed to `security.yml`, matching the other six workflows.
The sanitizer tests grew a matrix over `MDX_PASSTHROUGH_TYPES` but not a test
of the precondition the list depends on: that corpus content cannot produce
one of those node types in the first place. That claim is what makes waving
five node types past the schema safe, and it was carried by a comment. Pin
both halves. A unit test reparses HTML written to manufacture each type by
name, asserts `rehype-raw` yields only root/element/text, and asserts the
payloads are inert afterwards. An e2e test compiles real `.md` through the
production chain with an ESM statement, two expressions, and a
component-shaped tag, and asserts the braces survive as text and no
component received the attacker attribute -- reaching those assertions at all
proves nothing was evaluated.
Renovate gains `dependencyDashboardOSVVulnerabilitySummary`, so the advisories
the workflow no longer fails on are listed somewhere standing rather than
only in a per-run summary.
Also drops a stale tracker id from a comment in a test file this commit
already edits.
Assisted-by: AI
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.github/workflows/security.yaml: CodeQL (javascript-typescript) and OSV-Scanner againstpnpm-lock.yaml, mirroring coder/coder's security workflow shape for this stack.GitHub Code Security is not yet enabled on this private repo, so the
codeqljob and theosv-scannerjob's SARIF-upload step are gated behind aCODE_SCANNING_ENABLEDrepository variable (see the admin section below); OSV-Scanner's results are always uploaded as a workflow artifact regardless, so nothing is lost while that variable is unset.OSV-Scanner runs via the official
google/osv-scanner-action, pinned by verified commit SHA, rather than an unverified curl download.renovate.json: extendsconfig:recommended, enablesvulnerabilityAlerts/osvVulnerabilityAlerts, pins GitHub Actions to digests, groupsfumadocs-*, pins ranges.pnpm-workspace.yamlcatalog support comes from Renovate's built-in npm-manager defaults, so no extra config is needed for it. Validated withrenovate-config-validator(current release, not a stale cache)..github/CODEOWNERS: default ownership plus rules naming the same owners on the sanitizer boundary (mdx-config.ts,rehype-sanitize-coder-docs.ts,html-delimiters.ts,sync.ts) and.github/workflows/. The file says plainly that these rules are documentary until a security team handle exists (see the admin section below for the ruleset change that would make them binding).ubuntu-latestrule. Comment-only, no behavior change.MDX_PASSTHROUGH_TYPESentry in the sanitizer: each type has a test that an engine-generated node survives and a test that a corpus-authored raw-HTML lookalike carrying a dangerous attribute is sanitized normally.For the repository admin
coder/docs-engine, then set the repository variableCODE_SCANNING_ENABLED=true. Until both are done,security.yaml'scodeqljob is skipped and itsosv-scannerjob runs but does not upload to the Security tab (it still uploads a SARIF workflow artifact).mainto require this status check (the only jobci.ymldefines):build & checkrequire_code_owner_review: trueon themainruleset so.github/CODEOWNERSactually blocks merges rather than only auto-requesting reviewers.vulnerabilityAlerts/osvVulnerabilityAlerts, so a separate Dependabot config would be redundant.Testing
pnpm --filter @coder/docs-transforms test— 252 passed.pnpm test(root, via turbo) — 17/17 tasks passed.turbo run lint --force— 11/11 packages passed.actionlint .github/workflows/security.yaml— no findings.npx -p renovate@latest renovate-config-validator renovate.json— validated successfully against the current Renovate release.biome formaton the changed test file — no new violations (two pre-existing violations elsewhere in the file are unchanged and out of scope).Addresses the repository and threat-model items in coder/security-assessments#280 (Linear: SEC-868).
🤖 Built with AI assistance.