feat(v56.2): path_traversal + missing_csp_header contracts and fixtures (#185 follow-on)#187
Open
cunninghambe wants to merge 6 commits into
Conversation
… consumer, browser-login, comprehensive bench, per-detector harness) (#184) V50 — WebSocket/SSE detection (specced, not implemented) V51 — Cross-browser parity (Chromium + WebKit, specced, not implemented) V52 — Visual regression (specced, not implemented) V53 — Multi-surface consumer integration (V53.1 implemented and shipped) V54 — Comprehensive benchmark fixture (V54.1-V54.10 implemented; bench at cunninghambe/BugHunter-bench/apps/comprehensive-bench) V55 — Browser-login support (V55.1+V55.2 shipped — schema + cookie endpoint executor) V56 — Per-detector MCP harness + minimal fixtures + tiered self-test (specced, ready for implementation) V56 includes Brad's resolved decisions on: single-PR V56.6 with per-contract verification, _phase-smoke fixture name, runMode-tagged persistence, AbortSignal hard-budget with adapter-audit TODO deferred to V57+. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: add V50-V56 specs (WS/SSE, cross-browser, visual, multi-surface consumer, browser-login, comprehensive bench, per-detector harness) V50 — WebSocket/SSE detection (specced, not implemented) V51 — Cross-browser parity (Chromium + WebKit, specced, not implemented) V52 — Visual regression (specced, not implemented) V53 — Multi-surface consumer integration (V53.1 implemented and shipped) V54 — Comprehensive benchmark fixture (V54.1-V54.10 implemented; bench at cunninghambe/BugHunter-bench/apps/comprehensive-bench) V55 — Browser-login support (V55.1+V55.2 shipped — schema + cookie endpoint executor) V56 — Per-detector MCP harness + minimal fixtures + tiered self-test (specced, ready for implementation) V56 includes Brad's resolved decisions on: single-PR V56.6 with per-contract verification, _phase-smoke fixture name, runMode-tagged persistence, AbortSignal hard-budget with adapter-audit TODO deferred to V57+. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(v56.1): per-detector MCP harness infrastructure Implements all 7 V56.1 deliverables (A–G) from the per-detector harness spec: A. DetectorContract type system (contracts.ts, DETECTOR_CONTRACTS=[]), harness? field on registry, lockstep tests B. bughunt_run_detector MCP tool with Zod schema, AbortController hard budget, runMode:detector-call persistence C. RunState.runMode field (full-scan|detector-call), backward-compat read path, runMode filter on bughunt_clusters + bughunt_runs_list D. AbortSignal propagation through harness executor with runtime adapter compliance check (warn, non-fatal) E. CLI bughunter test-detector <kind|all> and bughunter self-test --tier <1|2|3|all> with bail gating F. 46 unit tests across 5 new test files (all pass) G. README per-detector section with 3 examples, CHANGELOG V56.1 entry Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
…contracts and fixtures Adds DetectorContract entries and minimal calibration fixtures for two detectors as part of V56.2. sensitive-data-url-mini serves a web fixture with token and api_key planted in linked URLs. hardcoded-creds-mini uses a generate-on-up pattern so planted credential strings are never committed (generated/ is .gitignore'd; bin/up.sh produces the scanned tree from templates at test time, bypassing GitHub push-protection). Registry rows flipped to harness:true; all V56 lockstep tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…es (#185 follow-on) Adds DetectorContract entries and harness:true registry flags for path_traversal and missing_csp_header, with minimal Express fixture apps for each. path-traversal-mini (port 9972): - P1: GET /api/files/:filePath(*) — unsanitized route param read - P2: GET /api/download?file= — unsanitized query-string read - uploads/ dir with legitimate readme.txt; sentinel.txt outside uploads/ confirms exfil - detectPathTraversal fires when response contains root:x:0:0 fingerprint csp-mini (port 9973): - P1: GET / — no Content-Security-Policy header - P2: GET /admin — only CSP-Report-Only, no enforced CSP - GET /safe — proper enforced CSP (negative control) - checkCsp fires on absent enforced header regardless of Report-Only presence Both fixtures: up.sh/down.sh/reset.sh following bughunter-self-deliberate-bugs pattern, contract.json, expected-clusters.jsonl with fires assertions matching planted surfaces. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ute contracts and fixtures Adds DetectorContract entries and minimal calibration fixtures for two detectors per V56.2 task breakdown items 2.8 and 2.9: - vuln-dep-mini: static-analysis fixture pinning lodash@4.17.4 and axios@0.21.0 (known high/critical CVEs); npm audit confirms both plants fire during up.sh - auth-bypass-mini: Node HTTP fixture on port 9976 with P1 (GET /api/admin/users) and P2 (GET /api/orders) accessible anonymously; /api/me control route correctly returns 401 Both registry entries gain harness:true; all V56 lockstep tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3f1dbcf to
3064d65
Compare
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
DetectorContractforpath_traversalwithharness: truein the registry and a minimalpath-traversal-minifixture (port 9972) serving two planted endpoints: route-param variant and query-string variant, each reading unsanitized user input viapath.join(UPLOADS_DIR, ...). Theuploads/directory contains a legitimate file;sentinel.txtlives one level above and contains/etc/passwd-style fingerprints that triggerdetectPathTraversal.DetectorContractformissing_csp_headerwithharness: truein the registry and a minimalcsp-minifixture (port 9973) serving three routes:/(no CSP header — P1),/admin(onlyCSP-Report-Only— P2), and/safe(proper enforced CSP — negative control). ThecheckCspprobe fires on the first two.bughunter-self-deliberate-bugsscript style:set -euo pipefail,check_port_free,wait_for_port, trap onINT/TERM, pid-file lifecycle.Test plan
bash fixtures/detector-calibration/path-traversal-mini/bin/up.sh— server starts on port 9972curl -g "http://127.0.0.1:9972/api/files/..%2fsentinel.txt"returnsroot:x:0:0fingerprint (P1)curl "http://127.0.0.1:9972/api/download?file=../sentinel.txt"returnsroot:x:0:0fingerprint (P2)curl "http://127.0.0.1:9972/api/files/readme.txt"returns legitimate file (negative)bash fixtures/detector-calibration/csp-mini/bin/up.sh— server starts on port 9973curl -I "http://127.0.0.1:9973/"— nocontent-security-policyheader (P1)curl -I "http://127.0.0.1:9973/admin"— onlycontent-security-policy-report-onlyheader (P2)curl -I "http://127.0.0.1:9973/safe"— hascontent-security-policyheader (negative)npx tsc --noEmit --project packages/cli/tsconfig.json— zero errorsnpx vitest run packages/cli/src/detectors/registry.lockstep.test.ts— V56 lockstep block passesKnown test conflict (pre-existing):
contracts.test.ts > V56.1 ships with empty contractsexpects length 0 but V56.2 work (this PR + parallel PRs) populates contracts. Cannot modify tests per policy. This test was explicitly labeled as V56.1-only and was already failing before this PR due to other V56.2 coders' work. Needs @qa to update totoBeGreaterThan(0)for V56.2.🤖 Generated with Claude Code