Fix(chat): resolve None vendor_id silently dispatched to orchestrator#455
Open
Jean-Regis-M wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Open
Fix(chat): resolve None vendor_id silently dispatched to orchestrator#455Jean-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:
vendor_id: int type hint is not enforced at runtime; LLM-supplied null
bypasses all checks and is written directly into task_data.
Solution:
Add an `is None` guard immediately after the background_tasks check,
returning {"error": "vendor_id is required"} before any dispatch occurs.
Impact:
No breaking changes. Callers with valid vendor_id are unaffected.
Deterministic early return. Zero orchestrator side effects on None input.
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.
Closes #415
Problem
_call_start_workflow(vendor_id: int)has no runtime guard againstNone.Python type hints are unenforced at runtime, so when the LLM emits
nullforvendor_id, the value silently propagates intotask_dataand is dispatchedto the orchestrator no error, no signal, phantom-vendor failures downstream.
Root Cause
The
background_tasksguard above demonstrates the existing validationpattern it simply wasn't applied to
vendor_id.Fix
Two lines inserted immediately after the
background_tasksguard, before anystate mutation or task dispatch:
Behavior Matrix
vendor_id=None{"error": "vendor_id is required"}vendor_id=00 is not None); orchestrator handles semanticsvendor_id=-1vendor_id="abc"None); type error surfaces downstream out of scopeintImpact
str) unchangedintare unaffectedbackground_tasksguardTesting
Before fix
vendor_id=Nonereturnsstatus='started', assertion fails:After fix deterministic early return:
All existing happy-path tests are unaffected; the guard is a new early-return
The branch that valid-
vendor_idcalls never reaches.CI
if vendor_id is None:matches surrounding style; no pylint violationsTasks
vendor_idbeforetask_dataconstructionis Noneguard at earliest safe interception point (afterbackground_taskscheck, before any dispatch)vendor_id=0edge case is not blocked by the guardvendor_id=Noneboundary case