feat: wire threat-model.md into Phase 4 validation planning#52
Conversation
Add explicit threat-model.md awareness to the Phase 4 validator agent, exploit-validation skill, prompt, and evidence template. Mirror the existing Phase 2/3 integration pattern: - Required reading references threat-model.md (conditional: when available). - Validation workflow includes a threat-model consultation step covering attacker capabilities/non-capabilities, trust boundaries, existing controls, affected assets, and open assumptions. - Evidence README template gains a dedicated Threat-model assumptions section. - Final response summary includes threat-model assumptions that materially affected validation. 5 new prompt tests assert the Phase 4 prompt references threat-model.md, attacker capabilities/non-capabilities, trust boundaries, existing controls, and uses conditional language. Closes #35.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughPhase 4 validation planning now consults itemdb/notes/threat-model.md when available, adding a threat-model alignment step before source inspection. Evidence templates capture any material threat-model assumptions, validator and skill docs reference the threat model, and tests verify prompt and documentation updates. ChangesThreat-Model Integration in Phase 4 Validation
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Coverage Report
Generated by pytest-cov on |
There was a problem hiding this comment.
Pull request overview
This PR wires itemdb/notes/threat-model.md into Phase 4 validation guidance (prompt/agent/skill) and updates the evidence template + tests so validation planning and reporting can incorporate threat-model constraints and assumptions, consistent with prior Phase 2/3 integrations.
Changes:
- Extend Phase 4 validation workflow to incorporate threat-model alignment checks (capabilities/non-capabilities, trust boundaries, existing controls, assumptions).
- Add an evidence template section for documenting threat-model assumptions when they materially affect validation.
- Add Phase 4 prompt-level tests to enforce threat-model references and key terminology.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
prompts/phase-4-validate.md |
Adds threat-model-aware validation planning step and final summary note. |
.opencode/agents/validator.md |
Updates validator agent required reading + workflow to include threat-model alignment. |
.opencode/skills/exploit-validation/SKILL.md |
Updates exploit-validation skill inputs + workflow to include threat-model alignment review. |
templates/evidence-readme.md |
Adds a “Threat-model assumptions (if applicable)” section to evidence README structure. |
tests/test_phase_1_prompts_threat_model.py |
Adds tests asserting Phase 4 prompt references and threat-model-related wording. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryThis PR wires
Confidence Score: 5/5All changes are additive documentation and test additions with no behavioural or configuration logic; safe to merge. Every modified file is a prompt, template, or test — no executable code paths are changed. The new workflow steps are conditional ('if present' / 'when available'), preserving backward compatibility for projects without a threat model. Tests added for all three modified Phase 4 files confirm the key strings are present. No regressions are introduced. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([Start Phase 4 Validation]) --> B[Read finding, source files,\nsandbox docs]
B --> C{itemdb/notes/threat-model.md\npresent?}
C -- Yes --> D[Step 5: Review threat-model alignment\n- Attacker capabilities / non-capabilities\n- Trust boundaries\n- Existing controls\n- Affected assets\n- Open assumptions]
C -- No --> E[Skip threat-model step]
D --> F[Inspect source files]
E --> F
F --> G[Prepare sandbox]
G --> H[Execute / improve validation plan]
H --> I[Capture commands, inputs, outputs]
I --> J[Store evidence under itemdb/evidence/]
J --> K[Update finding]
K --> L[Move finding to correct status dir]
L --> M[Final summary\n+ threat-model assumptions\nthat affected strategy]
Reviews (3): Last reviewed commit: "fix: strengthen test_exploit_validation_..." | Re-trigger Greptile |
- Make threat-model bullets explicitly optional ("If present, …") in
prompt, validator agent, and exploit-validation skill per Copilot review.
- Rename test_phase_1_prompts_threat_model.py -> test_prompts_threat_model.py
to reflect multi-phase coverage per Greptile review.
- Add 4 new tests covering validator.md and SKILL.md threat-model additions.
- Update conditional-language test to also accept "if present" phrasing.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_prompts_threat_model.py`:
- Around line 136-139: The test
test_exploit_validation_skill_mentions_attacker_capabilities currently only
asserts "non-capabilities" and can miss removal of the phrase "attacker
capabilities"; update the test to check for both keywords (case-insensitive) by
reading the SKILL.md content and asserting that it contains "non-capabilities"
and also contains "attacker capabilities" (or the exact phrase your
documentation uses) so both are validated; locate the assertion in
test_exploit_validation_skill_mentions_attacker_capabilities and add the second
assertion (or a combined check) against the variable content read from
".opencode/skills/exploit-validation/SKILL.md".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 3946fd19-ae22-426a-9f1e-361d3cc7a0e0
📒 Files selected for processing (4)
.opencode/agents/validator.md.opencode/skills/exploit-validation/SKILL.mdprompts/phase-4-validate.mdtests/test_prompts_threat_model.py
✅ Files skipped from review due to trivial changes (2)
- .opencode/skills/exploit-validation/SKILL.md
- .opencode/agents/validator.md
🚧 Files skipped from review as they are similar to previous changes (1)
- prompts/phase-4-validate.md
|
All review feedback addressed in 3aca7d2: Copilot — make threat-model bullets explicitly optional (3 threads):
Greptile — test file naming:
Greptile — missing tests for validator.md / SKILL.md:
CodeRabbit — docstring coverage: Skipped — project convention (no existing test functions in this file have docstrings). 784 tests pass, frontmatter and artifact checks clean. |
pruiz
left a comment
There was a problem hiding this comment.
Resolved all review feedback in 3aca7d2:
Copilot (3 threads — bullets not explicitly optional)
prompts/phase-4-validate.md:40: Changed to If present, itemdb/notes/threat-model.md — … so a missing file won't cause agents to fail.
.opencode/agents/validator.md:27: Same fix — leads with If present, ….
.opencode/skills/exploit-validation/SKILL.md:33: Same fix — leads with If present, ….
Greptile (2 threads — test naming + coverage)
Test file naming: Renamed test_phase_1_prompts_threat_model.py → test_prompts_threat_model.py (the file already covered Phases 2/3/4, not just Phase 1).
Missing tests for validator.md / SKILL.md: Added _read_opencode helper and 4 new tests:
test_validator_agent_references_threat_model— assertsitemdb/notes/threat-model.mdinvalidator.mdtest_validator_agent_uses_conditional_language— asserts "if present" / "when available" phrasingtest_exploit_validation_skill_references_threat_model— assertsitemdb/notes/threat-model.mdinSKILL.mdtest_exploit_validation_skill_mentions_attacker_capabilities— asserts "non-capabilities" inSKILL.md
CodeRabbit (docstring coverage warning)
Skipped — matches project convention (no existing test functions in this file use docstrings).
784 tests pass, frontmatter and artifact checks clean.
…ilities Add assertion for "attacker" keyword alongside existing "non-capabilities" check per CodeRabbit review feedback. The skill step 4 text contains both "attacker profile" and "documented capabilities, non-capabilities".
Closes #35.
Summary
Adds explicit
itemdb/notes/threat-model.mdawareness to Phase 4 validation planning, mirroring the integration already present in Phase 2 (auditor) and Phase 3 (reviewer).Changes
prompts/phase-4-validate.md.opencode/agents/validator.md.opencode/skills/exploit-validation/SKILL.mdtemplates/evidence-readme.md# Threat-model assumptions (if applicable)section between Environment and Commandstests/test_phase_1_prompts_threat_model.pyAcceptance criteria
itemdb/notes/threat-model.mdwhen presentSummary by CodeRabbit
Documentation
Tests