Skip to content

fix(vendor): Add max length validation to update_vendor_agent_notes()#197

Open
Jean-Regis-M wants to merge 2 commits intoGenAI-Security-Project:mainfrom
Jean-Regis-M:patch-4
Open

fix(vendor): Add max length validation to update_vendor_agent_notes()#197
Jean-Regis-M wants to merge 2 commits intoGenAI-Security-Project:mainfrom
Jean-Regis-M:patch-4

Conversation

@Jean-Regis-M
Copy link

Summary

Adds input validation to update_vendor_agent_notes() to enforce a 10,000 character limit on agent_notes, matching the fix in #165 for the similar issue with invoice notes.

Problem

The update_vendor_agent_notes function currently accepts arbitrarily long notes (tested up to 10,001 characters). This allows unbounded growth of the agent_notes field, which is included in get_vendor_risk_profile responses, leading to payload bloat and potential performance issues in risk assessment calls.

Solution

  • Added a MAX_NOTES_LENGTH = 10_000 constant
  • Added validation before concatenating with existing notes
  • Raises ValueError with a clear message when input exceeds the limit
  • Updated the function docstring to document the exception

Impact

Testing

  • Verified test_vnd_notes_008 now passes (previously failed)
  • Verified test_vnd_notes_001 and test_vnd_notes_003 still pass (no regressions)

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

1 participant