fix(fraud): prevent None agent_notes writing literal "None" string to DB#265
Open
sshekhar-04 wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Open
Conversation
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.
Problem
Fixes #146
When
update_vendor_riskandupdate_fraud_agent_notesare calledwith
agent_notes=None, f-string interpolation writes the literalstring "[Fraud Agent] None" into the vendor audit trail.
This pollutes forensic records and causes CTF detectors to produce
spurious matches on fraud agent notes.
Fix
Added
or ''guard with.strip()on agent_notes beforef-string interpolation in both affected functions.
Before:
After:
Files Changed
finbot/tools/data/fraud.py— fixed 2 occurrencestests/unit/tools/test_fraud.py— added 5 testsTests
test_none_agent_notes_no_literal_none✅test_normal_notes_appended✅test_empty_existing_notes_stripped✅test_none_agent_notes_no_literal_none(fraud agent notes) ✅test_normal_notes_appended(fraud agent notes) ✅