Repository navigation
Name invalid Security review reports instead of generic failure - #2301
Merged
Merged
Conversation
Merged
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
Strict approach chosen: the parser still rejects
severity/fix_sizeat a finding's top level (deny_unknown_fieldsstructs remain the single schema source), and the Security review prompt now shows a complete example object with both fields insideproof_of_concept. Validation errors fromOldFinding::reproductionnow name the field too (empty`title`, non-positive`head_exit_code`, invalid`severity`/`fix_size`), as do type errors and misplaced-field errors even whenproof_of_conceptcomes first in the object.Evidence
Execution evidence
Before:
cargo test --bin thirdshift security::review::tests::probe_top_level_severity_repro -- --nocapture(probe since removed, replaced by kept regression tests) on the unpatched tree:After:
cargo test --bin thirdshift security::review::tests— 7 passed, includingtop_level_severity_names_the_offending_field_in_the_outcomeasserting the hold is exactlySecurity review's private report is invalid: unknown fieldseverityat finding 1, plus the three reviewer-supplied tests in the second commit (poc_first_top_level_severity_is_named_unknown,type_error_names_offending_field,empty_title_validation_names_title_field), each verified failing before its fix and passing after.cargo test --bin thirdshift security::— 51 passed.cargo test --bin thirdshift prompt::— 18 passed.cargo test prompts_page— passed afterUPDATE_PROMPTS=1 cargo test prompts_pageregeneratedprompts/*.mdandsite/prompts/index.html.python3 scripts/affected-tests refs/remotes/origin/main— all selected checks passed (full cargo suite, doctests, integration tests, site tests), afternpm ci --prefix siteinstalled the site's declared dependencies.Merge Danger
Door: two-way
Blast Radius: narrow
Only Security review report handling and its prompt change. Invalid reports now fail with a named, public-safe reason (field name and finding index, never field values — a test asserts the fingerprint does not leak) instead of the generic final-line message; valid reports, final-line handling, and recording are unchanged.
Unaddressed findings
Standards
split_array_elements,src/security/review.rs). Declined. The reviewer suggested enumerating the parsedserde_json::Valuearray instead, but this crate does not enable serde_json'spreserve_orderfeature, soValueobjects iterate keys in sorted order: the same probe that names`severity`from the raw slice named`fix_size`when deserialized viaValue(observed in this session before the raw-slice parser was kept). Document-order naming of the first offending field — the field agy actually misplaced first — therefore needs the raw element slices; the tokenizer is small, string/nesting-aware, and covered by the kept tests insrc/security/review/tests.rs.reproduction()prefix-stripping coupling was removed in the second commit:OldFinding::reproductionnow bails with short field-naming causes andload_reportadds the finding index directly, so that magic prefix no longer exists. The remaining piece, extracting the field name fromserde_json::Error's Display text inserde_field_name(src/security/review.rs), is declined: serde_json exposes no structured field-name accessor, and on any wording change the code degrades safely to the genericinvalid field type at finding Nrather than leaking report values.Spec
None. Both Spec findings were run as written, failed as described, and were fixed with their tests kept.
Security
None. One introduced Security finding —
serde_field_nameandtype_mismatch_fieldinsrc/security/review.rsreflecting arbitrary unvalidated JSON keys from a malformed private report into publicInvalidReportoutcomes (allowing private key-text disclosure and<!-- /thirdshift:security-review -->PR section injection) — was reproduced by a failing proof-of-concept test (cargo test --test security_review invalid_private_report_does_not_reflect_arbitrary_keys_or_inject_pr_markers -- --nocapture) before the fix and fixed in commitea52b33aby restricting reflected field names to the closed schema allowlist (known_schema_field). Its regression tests (arbitrary_unknown_keys_and_type_mismatch_fallbacks_never_leak_key_namesinsrc/security/review/tests.rsandinvalid_private_report_does_not_reflect_arbitrary_keys_or_inject_pr_markersintests/security_review.rs) were kept and pass after the fix.Security review outcome
No unaddressed introduced findings.
Review coverage
Changed files the review intentionally did not read as generated output (reviewed via their source
src/prompt.rsand the regeneration checkUPDATE_PROMPTS=1 cargo test prompts_page):prompts/pull-request-security-review.md,prompts/security-review.md,prompts/spec-ticket-security-review.md,site/prompts/index.html. No other changed file was left unread. Full reports:.thirdshift-review-O8O81O/standards.mdand.thirdshift-review-O8O81O/spec.mdin the session record (Standards: 2 judgement calls; Spec: 2 findings, both addressed).Closes #2298
Built with muse Muse Code 1.4.24 (1.4.24-R9131.1) · default model · default effort