Skip to content

PR-04: Fixture app + known answers (scanner) - #27

Merged
emmanuelgjr merged 1 commit into
mainfrom
improve/pr-04-fixture-app
Jul 18, 2026
Merged

PR-04: Fixture app + known answers (scanner)#27
emmanuelgjr merged 1 commit into
mainfrom
improve/pr-04-fixture-app

Conversation

@emmanuelgjr

Copy link
Copy Markdown
Contributor

Phase 1. The single highest-credibility artifact: the test corpus, demo, screenshot source, and contributor on-ramp. Depends on PR-03 (rules).

What's here

  • tests/fixtures/vulnerable-app/ — a small, intentionally-vulnerable multi-language GenAI app (Python + a JS service). Every secret is a fake canonical value (sk-proj-FAKE..., xoxb-FAKE...).
    • Genuine violations: DSGAI04 (torch.load), DSGAI06 (http MCP + uvicorn 0.0.0.0), DSGAI11 (unscoped vector query), DSGAI12 (LLM-generated SQL), DSGAI14 (content capture), DSGAI15 (secret in system prompt), DSGAI02 (hardcoded key).
    • Negatives: good_config.py (Vault), rate_limited_api.py (authed + rate-limited).
    • The two confirmed v0.2 bugs: .env unquoted key (P02.1 false negative) and webhook.py (P12.1 false positive), both tracked.
    • Adversarial docs/NOTES.md — the PR-07 prompt-injection regression test.
  • tests/expected-findings.yaml — 25 findings pinned to exact lines with compound logic (subtract, requires_nearby) resolved to final status, plus must_not_flag negatives and known_false_negatives (each mapped to the PR that fixes it).
  • tests/expected-findings.schema.json — validates the sheet.
  • tests/regen_expected.py — regenerates/verifies line-pins (Appendix C mitigation for brittle line numbers).
  • .github/secret_scanning.yml — ignores the fixture fakes.

Verification (all local)

  • regen_expected.py --check: all 25 sheet line-pins match the live rg scan exactly (0 drift).
  • Sheet validates against expected-findings.schema.json.
  • scanner-lint (yamllint + md-link-check) green under the exact CI config.
  • Push protection did not block the FAKE-padded secrets.

Design notes

  • The P11 proximity case is deliberate: the unscoped query (line 12) and the tenant-filtered query (line 30) are >15 lines apart so the filter can't "rescue" the unscoped call — proving requires_nearby works both ways.
  • Explanatory comments were kept free of literal pattern tokens so each file yields exactly its intended finding(s) — no comment-induced noise.
  • .env is force-added (root .gitignore ignores .env).

Follow-ups

  • PR-10: gitleaks allowlist for tests/fixtures/**.
  • PR-11: flip .env/webhook.py known-bugs. PR-15: JS ecosystem globs.

tests/fixtures/vulnerable-app/ is the scanner's test corpus, demo, and
screenshot source — a small intentionally-vulnerable multi-language GenAI app.
All credentials are fake canonical values (sk-proj-FAKE..., xoxb-FAKE...).

- Covers DSGAI02/04/06/11/12/13/14/15/17/20 with genuine violations, PASS
  signals, and the two confirmed v0.2 bugs (unquoted .env P02.1 false negative;
  webhook.py P12.1 false positive) as tracked known_bug entries.
- Adversarial docs/NOTES.md is the PR-07 prompt-injection regression test.
- tests/expected-findings.yaml pins all 25 findings to exact lines (compound
  logic resolved), with must_not_flag negatives and known_false_negatives
  (unquoted .env, xoxb- token, JS endpoint) mapped to the PR that fixes each.
- tests/expected-findings.schema.json validates the sheet.
- tests/regen_expected.py regenerates/verifies line-pins (Appendix C mitigation);
  --check confirms all 25 pins match the live scan.
- .github/secret_scanning.yml ignores the fixture fakes.

Acceptance: fixture files match the sheet's paths/lines exactly (regen --check
green); sheet validates against its schema.
@emmanuelgjr
emmanuelgjr merged commit 4456dc6 into main Jul 18, 2026
8 checks passed
@emmanuelgjr
emmanuelgjr deleted the improve/pr-04-fixture-app branch July 18, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant