fix(pixel-inference): reject boolean value for integer seed parameter - #5943
Open
vaibhavsrv wants to merge 1 commit into
Open
vaibhavsrv wants to merge 1 commit into
vaibhavsrv wants to merge 1 commit into
Conversation
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.
Why this matters
In
ods/extensions/services/pixel-inference/app/main.py,_prepare(payload, grant)listsseedin the allowedFIELDSmapping but does not validate its data type. In Python,boolis a direct subclass ofint, so type checks such asisinstance(val, int)evaluate toTrueforTrueandFalse. When a client sends{"seed": true}or a non-integer float/string (e.g."42"), the unvalidated value passes to the model engine, where boolean flags or floats alter backend pseudo-random number generator seeding unexpectedly or trigger runtime type errors.This change introduces strict integer validation for
seedin_prepare. If present and non-null, it requirestype(seed) is int and type(seed) is not bool, raisingShareError(400, 'invalid_seed')for booleans, strings, or floats. Standard integer seeds and omitted/null seeds continue to function cleanly.Validation
{"seed": True}or{"seed": 42.0}bypassed_preparewithout error.invalid_seed; valid integer seeds pass without modification.Overlap check
temperaturebounds inpixel-inference.pixel-inference.stoptypes inpixel-inference.pixel_settings/contract.py.This PR solely hardens
seedtype validation inpixel-inference/app/main.pyand does not overlap with any concurrent PRs.Risk / AI disclosure
AI-assisted defect discovery, implementation, and regression verification. This strengthens request boundary checking for inference random seeds and does not modify running infrastructure, models, or configurations. Independent human review remains a gate.
Follow-up integration evidence
Composed cleanly on top of #5569, #5871, and #5875 at HEAD without conflicts. Production and test diffs passed together; adjacent pixel-agent and pixel-settings checks remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.