M24: Extend Container E2E (verify_all_scenarios.sh) for DSN Credentials, CUSTOM_FIELD=sk-… & Live DVMCP stdio Probing¶
- Task ID:
M24 - Priority:
P2(Master Rank#13, Track B — Simple Fixes, Docs & CI Hygiene) - Status:
Done - Dependencies:
M8,M11 - Target Repository:
/Users/ivan/Project/3t.tools.intellij/verityredteam-free(verity-redteam-core) - GitHub Project #5: Verity RedTeam Free Task Board
1. Context & Problem Statement¶
MultiClientConfigScanner (src/verity/discovery/config_scanner.py) separates key-name matching (SECRET_KEY_PATTERNS) from value-shape matching (SECRET_VALUE_PATTERNS). M11 added DSN credential detection (DATABASE_URL / postgres://user:pass@host/db-style values) and M7/M11 extended value-shape coverage, but the container E2E suite never exercises either behaviour:
- Scenario 1 configs contain only
sk-,ghp_and placeholder env values; no DSN with an embedded password and no secret under an arbitrary (non-secret-looking) key name such asCUSTOM_FIELD. SECRETS=( … )intests/e2e_containers/verify_all_scenarios.shhas no DSN password or arbitrary-key secret, so a redaction regression in_scrub_secrets()(src/verity/cli.py) could leak raw values intoterminal/json/markdown/htmloutput undetected.- DVMCP coverage is static-only: Scenario 4 runs
verity scan --path /opt/dvmcp. The live probe path (verity test --command "python3 …") is only exercised against the syntheticvuln_stdio_mcp.pyfixture, so a real DVMCP challenge server is never handshaked against, listed, or probed overstdio.
2. Requirements & Target Files¶
- DSN credential coverage: extend the generated
~/.cursor/mcp.jsonin Scenario 1 with a server whoseenvcarriesDATABASE_URL: postgres://analytics:<password>@db.internal:5432/analytics(embedded password) plus aCUSTOM_FIELDholding ask-…literal (arbitrary key name, value-pattern-only detection). - Safe twin: add a second server using
DATABASE_URL: postgres://analytics:${DB_PASS}@db.internal:5432/analytics; it must produce zero secret findings (no detection, no masking artefacts). - Leak assertions: append the raw DSN password and the
sk-…literal to theSECRETS=( … )array so bothscan_for_leakspasses (pre-snapshot and post-snapshot) cover them. - Live DVMCP probing: in addition to the existing static
verity scan --path /opt/dvmcp, add a livestdioprobeverity test --command "python3 /opt/dvmcp/<challenge_script>.py"(both terminal and--format json), asserting exit1and at least oneFAILresult carryingVERITY-STATIC-*rule ids. - Parity: the same DSN shapes accepted by
MultiClientConfigScannermust be redacted by_scrub_secrets()in all four report formats — no drift between detection and masking.
3. Automated Tests to Verify (tests/unit/test_cli_auditor_parity.py)¶
DATABASE_URL=postgres://app:SuperSecretDbPassword123@db:5432/app→ flaggedSEC-STATIC-SECRET-IN-CONFIG; raw password absent fromterminal/json/markdown/htmloutput (parametrized over the four formats); matched value rendered as****.DATABASE_URL=postgres://app:${DB_PASS}@db:5432/appand$DB_PASS-style references → not flagged.CUSTOM_FIELD=sk-live-…(non-secret key name) → flagged via value pattern; scrubbed to****.mysql://user:pass@host/dbandmongodb+srv://user:pass@cluster/dbDSN variants → flagged and scrubbed.- Benign values (
DATABASE_URL=postgres://app@db:5432/app,REDIS_URL=redis://cache:6379/0,DB_POOL_SIZE=10) → zero findings. - Parity test: every DSN shape detected by
MultiClientConfigScanner.is_secret_env_entry()is redacted to****by the CLI scrubber in each report format (no detection/masking drift).
4. Acceptance Scenario in Clean Container with Real MCP Server Config¶
Extend tests/e2e_containers/verify_all_scenarios.sh:
- In the generated
~/.cursor/mcp.json, add: db-analyticsserver (npx -y @modelcontextprotocol/server-postgres-style entry) withDATABASE_URLcarrying a real embedded password andCUSTOM_FIELD: sk-….db-safetwin withDATABASE_URL: postgres://analytics:${DB_PASS}@db.internal:5432/analytics.- Add the raw DSN password and the
sk-…literal to theSECRETS=( … )leak-scan array. - Run:
- Assertions:
verity scanexits1;SEC-STATIC-SECRET-IN-CONFIGreported for bothDATABASE_URLandCUSTOM_FIELD, each with****evidence.db-safeproduces zero secret findings.scan_for_leaksfinds no raw DSN password orsk-…value in any output or exported snapshot.- The live DVMCP probe exits
1and yields at least oneFAILresult withVERITY-STATIC-*rule ids, alongside the existing static--path /opt/dvmcpfindings. - Full
INSTALL_SOURCE=wheel ./tests/e2e_containers/run_e2e.shpasses.
5. Verification Commands¶
cd /Users/ivan/Project/3t.tools.intellij/verityredteam-free
uv run ruff check src tests
uv run pytest tests/unit/test_cli_auditor_parity.py -v
uv run pytest tests/
INSTALL_SOURCE=wheel ./tests/e2e_containers/run_e2e.sh
6. Acceptance Criteria¶
- [ ] DSN credentials with embedded passwords are flagged as
SEC-STATIC-SECRET-IN-CONFIGin MCP configenvblocks;${VAR}/$VARplaceholders and password-less DSNs produce zero findings. - [ ] Secrets under arbitrary key names (
CUSTOM_FIELD) are detected via value patterns. - [ ] All matched values (including the DSN password) are redacted to
****interminal,json,markdownandhtmlreports and in exported snapshots. - [ ] Container E2E exercises live
verity test --commandprobing against a DVMCP challenge server under/opt/dvmcp, in addition to static path scanning. - [ ]
tests/unit/test_cli_auditor_parity.py, fullpytest tests/,ruff check src tests, and the container E2E scenario pass cleanly.