Repository navigation
feat: reusable security gate as a composite action - #13
Open
VincentJerico wants to merge 1 commit into
Open
VincentJerico wants to merge 1 commit into
VincentJerico wants to merge 1 commit into
Conversation
gate/action.yml runs the header policy and a stack-trace probe (in a node:22 container) against an app on localhost in the calling job, plus an optional ZAP baseline. A policy file lists routes and accepted findings with reasons; unaccepted findings and stale acceptances fail. CI runs it against Juice Shop: its policy must pass, an empty one must fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What & why
Third of three security-automation PRs. The header and error-page checks only ever tested Juice Shop. This packages them as a composite action other repos can call:
uses: VincentJerico/security-testing/gate@<sha>.Why a composite action and not a reusable workflow: a reusable workflow runs on a fresh runner, so it would have to start the caller's app from a command string passed in as an input. A composite action runs inside the caller's own job, after the caller has started its app the usual way, and
github.action_pathgives it exactly the pinned commit's code.gate/action.yml:gate/check.tsin a pinnednode:22.23.4-slimcontainer (--network host), so the caller's Node version is untouched.rules.conf. A crash counts as a scan error, the same fix as in feat: nightly drift watch with a security-drift issue #12.env.gate/check.ts: goes through the existing target guard (localhost only, before any request). It checks each policy route's headers with the existingcheckHeaderspolicy and requests aproberoute that doesn't exist to look for a stack trace.gate/policy.ts:gate/examples/juice-shop.policy.json: S-1 to S-5 accepted, with references todocs/FINDINGS.md.tsconfig.json:allowImportingTsExtensions, socheck.tsruns as plainnode(Node 22 strips the types). No new dependencies.Proof it can fail
tests/gate.selftest.spec.ts, 8 passed locally:NEW /: Content-Security-Policy is missingand the S-5 stack trace. An acceptance for a problem Juice Shop doesn't have fails as STALE.https://example.comis refused.gate-selftest: uses./gatethe way a caller would. Juice Shop's policy plus ZAP rules must pass. A run withtests/fixtures/gate-accepts-nothing.policy.jsonmust fail, and the job checks that it did.First caller: TaskFlow
Run locally against TaskFlow
main(e9012be), Vincent's own app:/,/healthor/api/tasks, so the gate reports 15 findings.X-Powered-By: Express.Wiring the gate into TaskFlow's CI (and fixing the headers, e.g. with
helmet) is for the TaskFlow session. I'm handing it the findings and a ready-to-use policy.🤖 Generated with Claude Code