Fix(chat): resolve empty-string TIN bypass masking with is not None guard#433
Open
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Open
Fix(chat): resolve empty-string TIN bypass masking with is not None guard#433Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Conversation
Root cause: Truthiness guard `result[key]` evaluates "" and 0 as False, causing masking to be skipped for empty-string or zero-value TIN/bank fields. Solution: Replace `result[key]` with `result[key] is not None` in both VendorChatAssistant and CoPilotAssistant._call_get_vendor_details. Impact: Deterministic masking for all non-None sensitive field values. None (absent/null) fields continue to pass through unchanged. Zero regression risk on existing non-empty field behavior. 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
Fixes #408
Sensitive field masking skipped
""and0values due to Pythontruthiness evaluation. Replaces falsy check with explicit
is not None.Problem
if key in result and result[key]:treats""asFalse, allowingan empty-string TIN to bypass the masking pipeline and be returned raw.
Affects
tin,bank_account_number,bank_routing_numberin bothVendorChatAssistantandCoPilotAssistant.Root Cause
Truthiness guard
result[key]evaluates falsy values ("",0) asFalse, skipping the masking block entirely.Solution
Changed guard to
result[key] is not Nonein both_call_get_vendor_detailsimplementations. Two-line diff, no other code touched.
Impact
Testing