Skip to content

fix #151 (vendor): prevent writing "None" when agent_notes is None#252

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

fix #151 (vendor): prevent writing "None" when agent_notes is None#252
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Jean-Regis-M:patch-14

Conversation

@Jean-Regis-M
Copy link

Summary

Fixes #151 update_vendor_agent_notes writing the literal string "None" when agent_notes=None (test case VND-NOTES-004).

Problem

When called with agent_notes=None, the function builds new_notes = f"{existing_notes}\n\n{agent_notes}".
Python converts None to "None", resulting in "\n\nNone" being appended to the vendor’s notes, corrupting the field.

Root Cause

No guard against None before the f‑string interpolation. The function assumes agent_notes is always a string, but the call site sometimes passes None.

Solution

Add an early return after the vendor is fetched and before any string manipulation:

if agent_notes is None:
    return vendor.to_dict()

Refactor vendor notes update logic to handle None case.

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_049_MUST_FIX: Test Case VND-NOTES-004 — update_vendor_agent_notes writes literal "None" when agent_notes is None

1 participant