Skip to content

fix: validate stream field type across OpenAI-compatible handlers#3000

Merged
Wei-Shaw merged 1 commit into
Wei-Shaw:mainfrom
Pluviobyte:codex/sub2api-stream-field-validation
Jun 6, 2026
Merged

fix: validate stream field type across OpenAI-compatible handlers#3000
Wei-Shaw merged 1 commit into
Wei-Shaw:mainfrom
Pluviobyte:codex/sub2api-stream-field-validation

Conversation

@Pluviobyte
Copy link
Copy Markdown
Contributor

Summary

  • add a shared OpenAI-compatible stream parser that only accepts missing or boolean stream values
  • reject string/number stream values with invalid_request_error / invalid stream field type
  • apply the check to gateway Responses, gateway Chat Completions, OpenAI Chat Completions, and the existing OpenAI Responses path
  • add unit coverage for invalid stream values and boolean values continuing through the normal handler flow

Tests

  • cd backend && go test -tags=unit ./internal/handler -count=1
  • cd backend && go test -tags=unit ./internal/handler -run 'TestOpenAICompatibleHandlersRejectInvalidStreamFieldType|TestGatewayOpenAICompatibleHandlersAllowBooleanStreamToContinue|TestOpenAIHandler_GjsonExtraction|TestOpenAIResponses_Rejects' -count=1

@Pluviobyte
Copy link
Copy Markdown
Contributor Author

Note: the only failing check here is backend-security, which is currently tripping on Go 1.26.3 standard-library vulnerabilities reported by govulncheck. I opened #3001 as a separate patch-version update to Go 1.26.4; that PR now has backend-security passing.

@Pluviobyte Pluviobyte marked this pull request as ready for review June 5, 2026 07:01
@Wei-Shaw Wei-Shaw merged commit 651b245 into Wei-Shaw:main Jun 6, 2026
6 of 7 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants