Skip to content

fix(pixel-gateway): validate user parameter string type and length - #6336

Closed
vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/pixel-gateway-user-param
Closed

vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/pixel-gateway-user-param

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Why this matters

In ods/bin/pixel_provider/runtime_gateway.py, the validate_request routine admits the optional user client identifier without verifying string type or bounding length. Incoming requests with non-string representations (such as integers, booleans, or objects), empty strings, or unconstrained oversized payloads pass admission checks and trigger serialization failures or telemetry storage issues downstream.

This change surgically enforces that user must be a non-empty string of at most 512 characters (isinstance(payload['user'], str) and 1 <= len(payload['user']) <= 512) in validate_request, rejecting invalid configurations with invalid-inference-request. Standard user identifiers and email/UUID tokens remain fully supported.

Validation

  • Baseline reproduction: Payloads specifying user: "", user: 123, user: True, or strings longer than 512 characters were accepted by validate_request.
  • Post-fix behavior: Requests with empty, non-string, or oversized user strings raise RuntimeErrorCode('invalid-inference-request'). Valid strings pass cleanly.
  • Telemetry: Pixel gateway suites: 2 passed. New-test Ruff, ShellCheck, and diff checks pass; new regressions wired into Linux CI.

Overlap check

Recent PRs #6335 (reasoning_effort values in runtime gateway), #6334 (logprobs bounds in runtime gateway), and #6333 (stop parameter validation in runtime gateway) harden separate request parameters. This PR focuses exclusively on the user parameter in ods/bin/pixel_provider/runtime_gateway.py without conflicting.

Risk / AI disclosure

AI-assisted investigation, implementation and CLI regressions. This strengthens an API validation check, not runtime admission. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.

Follow-up integration evidence

Composed with #6335 at 3f7dd7a without conflicts. Production and test diffs passed together; gateway and runtime 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.

@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for this contribution. public-beta was promoted into main on 2026-09-24 and no longer receives changes, so we're closing pull requests that target it. This isn't a judgment on the change itself. If it's still needed, please rebase onto main and open a focused PR. See #7253 for details and the contribution policy.

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.

2 participants