qa(security): add supply-chain, fuzz, and authz coverage#24
Open
UberMetroid wants to merge 1 commit into
Open
Conversation
- .github/workflows/security.yml: cargo-deny + cargo-audit + gitleaks + cargo-cyclonedx SBOM + secret-pattern scanner, runs on push, PR, weekly cron, and workflow_dispatch. - .gitleaks.toml: project allowlists for generated/vendored/lock files. - fuzz/: cargo-fuzz harnesses for mine-layout determinism, leaderboard JSON parsing, and PIN-helper length + cookie-secure policy. - backend/tests/authz/: 37 black-box integration tests covering origin policy, RequirePin middleware, per-IP rate limit, request body limit, leaderboard cap, transport-security headers, and /metrics + /ready observability. - scripts/sbom.sh and scripts/secret-scan.sh: local developer mirror of the CI supply-chain / secret checks.
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
Adds security test coverage and supply-chain controls for the scan backend.
Changes
CI:
.github/workflows/security.ymlcargo-deny(advisories, bans, licenses, sources)cargo-auditagainst the RustSec advisory DBgitleakssecret scan (config in.gitleaks.toml)cargo-cyclonedxSBOM generation in JSON + XML (artifact uploaded)Fuzz harnesses (
fuzz/)board_parsing:LeaderboardEntryJSON round-trip + sanitisermine_layout: deterministic mine-placement invariantspin_helper: PIN length window +cookie_should_be_securepolicyAuthz integration suite (
backend/tests/authz/) — 37 testsRequirePin: GET/POST gated, session cookie, x-pin header, logout revocation, PIN length window, constant-time compare, canonical cookie name,HttpOnly/SameSite=Strictscan_requests_429_totalcounter/api/verify-pinand/api/leaderboardpayloadsMAX_LEADERBOARD_ENTRIEStruncation + sort, name sanitiser, anonymous fallback/metricstext-plain Prometheus, never rate-limited, no token leak;/ready200/503, unauthenticated even when PIN setDeveloper helpers (
scripts/)sbom.sh metadata|cyclonedx— local SBOM generatorsecret-scan.sh— local credential-pattern scannerValidation
cargo build --workspace✓cargo test --workspace✓ (156 tests pass; 37 new inauthz)cargo clippy -p backend --tests✓ (no warnings on new code)python -c 'import yaml; yaml.safe_load(...)'on workflow ✓cargo +nightly build --bin board_parsing(one fuzz target builds)Limitations
fuzz/fuzz_targets/mine_layout.rs. The production path (frontend/src/components/scan_logic.rs) draws fromjs_sys::Math::random, which is non-deterministic by design and only runs inside the Wasm frontend — fuzzing it from cargo-fuzz would require Wasm-side harness support beyond the scope of this PR.pin_helperfuzz target mirrors the productioncookie_should_be_secure/parse_translation_envhelpers inline rather than depending on the (private) production symbols, so future production changes to those helpers should be propagated to the fuzz target.fuzz/Cargo.lock; CI re-fetches it on each run viacargo fuzz build.cargo-deny,cargo-audit,cargo-cyclonedx) on every run; cache the toolchain if this becomes a bottleneck.