feat(audit): gowdk audit — declarative security posture + baseline policy engine (M8 slice 1)#360
Open
cssbruno wants to merge 3 commits into
Open
feat(audit): gowdk audit — declarative security posture + baseline policy engine (M8 slice 1)#360cssbruno wants to merge 3 commits into
cssbruno wants to merge 3 commits into
Conversation
Introduce the first slice of the M8 declarative security audit framework: a single, auditable view of an app's security posture plus a command that checks it against a built-in baseline. - internal/securitymanifest: pure IR-derived posture (gowdk-security.json) of every route, backend endpoint, and contract — guards, CSRF, body limit, public/default-deny, and source location. Describes, never enforces. - internal/auditspec: composable policy model (named policies, extends, route/endpoint/frontend selectors), the evaluation engine, and a built-in baseline that encodes the production-readiness gates in security.md (actions require CSRF, no public-by-omission APIs, no guardless endpoints). - cmd/gowdk audit: derives the posture, applies the baseline, prints findings (human + --json) with code, file:line, and remediation, and exits non-zero on error findings to gate CI. It is standalone; gowdk build never runs it. - buildgen: emit gowdk-security.json alongside the route/asset manifests on the disk, memory, and incremental build paths. - diagnostics: register experimental audit_* and policy_* codes with gowdk explain details. Severity lives only in the registry. Also skip .claude (nested git worktrees) in the diagnostics completeness scan and the contract scanner, so whole-tree tooling does not double-count a sibling worktree's diagnostic codes and contract registrations. Tests: securitymanifest projection, auditspec engine/baseline/composition/ selectors, and audit CLI (clean pass + missing-CSRF failure with non-zero exit). Refs #179, #182, #120, #119. Spec: docs/product/security-audit-spec.md
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d052ca9565
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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
internal/securitymanifestprojects validated IR into a declarativegowdk-security.jsonposture, andinternal/auditspecevaluates the built-in baseline policy set used bygowdk audit.gowdk auditwith human and--jsonoutput, registry-backed experimentalaudit_*/policy_*diagnostics, source locations, remediation text, and non-zero exits for error findings.gowdk-security.jsonemission to a non-served sibling report path under.gowdk/reports/<output-name>/, removes stale served copies, and denies/excludes the report from static serving and generated app embedding.Issue Closure
Related: #179, #182, #120, #119
Verification
scripts/test-go-modules.shwhen Go code or compiler behavior changed.go build ./cmd/gowdkwhen CLI, compiler, runtime, addon, or release behavior changed.node --check editors/vscode/extension.jswhen editor files changed. Editor files were not changed.Commands run:
Notes:
gowdk audit --json --config gowdk.config.gofails validation unless--ssris passed because the repository examples include SSR pages and the default config does not enable the SSR addon.gowdk audit --json --ssr --config gowdk.config.goruns and exits non-zero on the existing example CSRF findings, which is the expected CI-gating behavior.LLM Assistance
gowdk-security.json, updating docs/tests, merging currentmain, and resolving the fixed PR review threads.*.audit.gwdk), frontend audits, emitted tests, and runtime security-header verification deferred to later M8 phases documented indocs/product/security-audit-spec.md.