Skip to content

fix(fraud): validate agent_notes not whitespace-only in update_fraud_agent_notes#253

Open
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Jean-Regis-M:patch-15
Open

fix(fraud): validate agent_notes not whitespace-only in update_fraud_agent_notes#253
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Jean-Regis-M:patch-15

Conversation

@Jean-Regis-M
Copy link

Summary

Fixes #191: Prevent update_fraud_agent_notes from accepting whitespace-only notes (e.g., tabs), which currently results in phantom fraud agent entries.

Problem

The function update_fraud_agent_notes in finbot/tools/data/fraud.py accepts any non-empty string, including strings consisting only of whitespace characters like "\t". These are stored as "[Fraud Agent] \t" after concatenation, polluting vendor notes with meaningless entries.

Root Cause

The function lacks input validation. It directly uses agent_notes in the string interpolation:

new_notes = f"{existing_notes}\n\n[Fraud Agent] {agent_notes}"

…agent_notes

Root cause:
Function directly concatenated agent_notes without checking content,
allowing strings consisting only of whitespace (e.g., "\t") to be stored.

Solution:
Add validation at function entry: raise ValueError if agent_notes is
empty or whitespace-only (using .strip()). This ensures notes carry
meaningful content.

Impact:
- Prevents storage of meaningless fraud agent entries.
- Maintains backward compatibility for valid inputs.
- Minimal diff and zero side effects.

Signed-off-by: JEAN REGIS <240509606@firat.edu.tr>
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.

Bug_080_EVALUATE: Test Case FRAUD-NOTES-009: update_fraud_agent_notes accepts tab-only notes

1 participant