Repository navigation
ci(repo): the threat-model check, required on every pull request (#244) - #492
Open
eribertocz wants to merge 3 commits into
Open
eribertocz wants to merge 3 commits into
eribertocz wants to merge 3 commits into
Conversation
threat_model.py (standard library) refuses a stale inventory (R1, R2), a surface without a section or a STRIDE category (R3, R4), and a row with an empty, unknown, duplicate, missing or malformed field (R5-R7); scoped workflow with changes/aggregate, required context, CI alert watch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MFyANPkiUZYq6rvGD2sFLf
… cannot read (#244) Reviewer findings 1-5: the OpenAPI reader keeps comments, inline values and colons in paths and refuses an unreadable key; unmatched table lines, a second section and a repeated inventory item are refused; a Verification is a test file or a scenario path inside the repository; tests assert code, line and reason; references are read once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MFyANPkiUZYq6rvGD2sFLf
) Re-review: a '..' segment no longer passes the allowed prefixes; the prefix is tested on the resolved path, and a test directory or a model without an inventory block is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MFyANPkiUZYq6rvGD2sFLf
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.
Closes #244 (PR 2 of 2: the
threat-modelcheck; PR 1 #487 merged the model).Files and purposes
.github/workflows/scripts/threat_model.py.github/workflows/scripts/test_threat_model.py.github/workflows/threat-model.ymlchanges,model,threat-modelaggregate), whole onmain.tools/ci/checks.tomlthreat-modelis required.tools/repo/main-ruleset.jsonthreat-modelas a required status check..github/workflows/ci-alerts.yml,.github/workflows/scripts/ci_alerts.tomlmainraises the CI alert.docs/process/engineering.mdShared governance files touched, for coordination with #486:
tools/ci/checks.toml,tools/repo/main-ruleset.json,ci-alerts.ymlandci_alerts.toml. All are append-only.Case matrix
test_a_valid_model_passestest_every_allowed_form_passesTHREAT_MODEL_STALEtest_r1_…THREAT_MODEL_STALE, with the linetest_r2_…THREAT_MODEL_INVALIDtest_r3_…THREAT_MODEL_INVALID, with the section linetest_r4_…THREAT_MODEL_INVALIDtest_r5_…THREAT_MODEL_INVALIDtest_r6_…THREAT_MODEL_INVALIDtest_r7_…n/a:is used on a category that has another rowTHREAT_MODEL_INVALIDtest_r7_n_a_…test_the_repository_model_passes_in_under_five_secondsThe tests were written first and failed before the check existed. They now pass: 22 tests (independent Reviewer: APPROVE after 3 passes), and the governance-script suite (125 tests) is OK. The check passes on
mainin about 0.1 s.The Owner must do one thing
Update the GitHub ruleset from
tools/repo/main-ruleset.jsonso thatthreat-modelbecomes required. Until then, the protection check reports the difference.Size
About 730 counted lines; it is not split because the check and its tests form one unit. About 280 lines are the check and about 330 are its 22 tests, which prove R1–R7 plus the parser and path guards; a check without its tests cannot land. The rest is workflow and registration wiring, each piece of which is required for the check to run as required.
Laws touched
Risk tier
A, because it touches CI workflows. The paths are governed, so the PR is labeled
owner-merge.Generated by Claude Code