[MEDIUM] falsify.py: sigma_gate passes LLM-controlled values to str.format() — KeyError risk #7
Labels
No labels
bug
code-review
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
foravo/mesh-review-comment-proof-20260519044241#7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub issue
M00C1FER/mesh-review#6.Source: https://github.com/M00C1FER/mesh-review/issues/6
Original author: @M00C1FER
Original state: closed
Finding 5 — MEDIUM
File:
src/mesh_review/review/falsify.pyFunction:
sigma_gate()Commit fixing this: 834f8d8441226ac383868a9cb8ac5c69b650581e (PR #1)
Description
sigma_gate()constructs the falsification prompt using:cluster.titleandcluster.bodycontain LLM-generated text. If any value contains a curly-brace sequence like{variable}(common in findings about JSON handling, Python f-strings, template code, etc.), Python'sstr.format()raisesKeyErrororValueError, crashing the entire sigma gate for all findings in the cluster.Note:
_FALSIFY_PROMPTitself contains{{and}}(literal braces in the JSON example) which are already correctly escaped; the vulnerability is exclusively in the LLM-controlled kwargs.Fix Applied
Added an
_esc()helper that doubles all curly braces before passing values to.format():Imported from GitHub issue comment
M00C1FER/mesh-review#6:4362220274.Source: https://github.com/M00C1FER/mesh-review/issues/6#issuecomment-4362220274
Original author: @M00C1FER
Fixed by merged PR #1.