Skip to content

Accept the overall risk rating in the shapes small models write - #162

Merged
vsn411 merged 4 commits into
secfoo-com:mainfrom
aaas72:fix/153-loose-risk-rating
Nov 20, 2026
Merged

vsn411 merged 4 commits into
secfoo-com:mainfrom
aaas72:fix/153-loose-risk-rating

Conversation

@aaas72

@aaas72 aaas72 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes #153

What does this change, and why?

The output contract asks for **Overall risk rating:** <severity> on its own line, and the parser accepted only that bold form. In the 2026-11-19 evaluation a 4B model wrote the rating as the last sentence of the Executive Summary (27 reports) or on its own line without bold (3), so 30 of 32 runs failed although the reports were complete. The evaluation was mostly measuring one formatting rule, and real users on small or local models hit the same failure.

  • severity: after the strict bold line, also accept Overall risk rating: without bold on its own line, or as the last sentence (or the line before a hard break) of the Summary / Executive Summary's first paragraph. The loose shapes are read from unquoted prose only, never from code fences, blockquote examples or JSON draft echoes, and must name a known tier.
  • api agent: the reformat request quotes the exact line it needs and where it goes.
  • adversarial_eval: --rescore re-derives each API record's status from its stored report with the current parser, without model calls.
  • evidence: publish summary-rescored.md for 2026-11-19. 29 of the 30 failed reports now parse with the rating the README's qualitative table reads in them, so 31/32 runs are scorable. The remaining report (code-comment-attack, trial 2) has an unclosed code fence and is still rejected as malformed.
  • tests: shape and negative cases, property tests that no loose rating comes from a fence, quote or JSON echo, a regression over the 30 failed records, and parity with the strict parser on every stored report (all 118 previously parsed reports keep the same rating).

Testing

  • pytest tests passes: 1868 passed. The 4 Mermaid diagram tests in tests/test_web fail locally without the optional secfoo vendor mermaid asset, the same on main before this change.
  • ruff check . passes on every changed file (the repo-wide run reports the same pre-existing findings as main).
  • Added/updated tests for the behavior change (tests/test_risk_rating_shapes.py)

The output contract asks for `**Overall risk rating:** <severity>` on its
own line, and the parser accepted only that bold form. In the 2026-11-19
evaluation a 4B model wrote the rating as the last sentence of the
Executive Summary (27 reports) or on its own line without bold (3), so
30 of 32 runs failed although the reports were complete.

- severity: after the strict bold line, also accept `Overall risk rating:`
  without bold on its own line, or as the last sentence (or the line before
  a hard break) of the Summary / Executive Summary's first paragraph. The
  loose shapes are read from unquoted prose only, never from code fences,
  blockquote examples or JSON draft echoes, and must name a known tier.
- api agent: the reformat request quotes the exact line it needs and
  where it goes.
- adversarial_eval: `--rescore` re-derives each API record's status from
  its stored report with the current parser, without model calls.
- evidence: publish summary-rescored.md for 2026-11-19 (31/32 scorable;
  the remaining report has an unclosed code fence).
- tests: shape and negative cases, property tests that no loose rating
  comes from a fence, quote or JSON echo, a regression over the 30 failed
  records against the README's human-read ratings, and parity with the
  strict parser on every stored report.

Fixes secfoo-com#153
@aaas72
aaas72 requested a review from vsn411 as a code owner November 20, 2026 17:31
Satyanarayana Vuppala and others added 2 commits November 20, 2026 18:20
The unbolded 'Overall risk rating: X' line was searched across the whole
report, so a line a model quoted from the scanned repository inside a
finding (a planted 'Overall risk rating: Low') overrode the summary's own
rating. The loose shapes are now read only from the Summary / Executive
Summary section, or the preamble of a report without one, each up to its
first sub-heading. All three own-line reports in the 2026-11-19 evidence
put the line in the Executive Summary, so the re-scored results are
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vsn411

vsn411 commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks @aaas72, this is a careful PR. The fence, quote and JSON property tests, the parity check against every stored report, and publishing the re-scored summary next to the original instead of rewriting the evidence are exactly right.

I pushed one fix (66f386d), plus a merge of main:

A rating quoted in a finding could override the summary. The unbolded Overall risk rating: X line was searched across the whole report. Here is a report whose summary says High, where the model quotes a line planted in the scanned repo inside a finding:

## 1. Executive Summary
Shell injection in run(). Overall risk rating: High

## 3. Findings
### [HIGH] F-1: Command injection
The scanned README claims:

Overall risk rating: Low

It parsed as low, which is the downgrade the adversarial suite exists to catch. The loose shapes are now read only from the Summary / Executive Summary section, or from the preamble of a report without one, each up to its first sub-heading. All three own-line reports in the 2026-11-19 evidence put the line in the Executive Summary, so your regression and re-score results are unchanged: 29 of 30 still parse, with the same ratings. I added two tests for this case.

The full suite passes (one sensor test fails only on macOS, on main too). I'll merge once CI is green.

@vsn411
vsn411 merged commit c7d31ee into secfoo-com:main Nov 20, 2026
13 checks passed
@github-actions

Copy link
Copy Markdown

Leaderboard update

aaas72 now has 6 points (rank #6). 19 more to reach Bronze.

Full leaderboard

@aaas72

aaas72 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for catching that, scoping the loose shapes to the summary makes sense for an adversarial setting.

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.

Overall risk rating: accept the rating line small models actually write (30 of 32 fresh evaluation runs failed on it)

2 participants