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
Open
fix(vendor): Add max length validation to update_vendor_agent_notes()#197Jean-Regis-M wants to merge 2 commits intoGenAI-Security-Project:mainfrom
Jean-Regis-M wants to merge 2 commits intoGenAI-Security-Project:mainfrom
Conversation
Signed-off-by: JEAN REGIS <240509606@firat.edu.tr>
Signed-off-by: JEAN REGIS <240509606@firat.edu.tr>
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.
Summary
Adds input validation to
update_vendor_agent_notes()to enforce a 10,000 character limit onagent_notes, matching the fix in #165 for the similar issue with invoice notes.Problem
The
update_vendor_agent_notesfunction currently accepts arbitrarily long notes (tested up to 10,001 characters). This allows unbounded growth of theagent_notesfield, which is included inget_vendor_risk_profileresponses, leading to payload bloat and potential performance issues in risk assessment calls.Solution
MAX_NOTES_LENGTH = 10_000constantValueErrorwith a clear message when input exceeds the limitImpact
get_vendor_risk_profileTesting
test_vnd_notes_008now passes (previously failed)test_vnd_notes_001andtest_vnd_notes_003still pass (no regressions)