validate previous_response_id input type/length - #2961
Closed
aydnOktay wants to merge 1 commit into
Closed
Conversation
teknium1
reviewed
Jul 12, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the input-hardening work. The /v1/responses premise remains valid on current main: previous_response_id is read without validation at gateway/platforms/api_server.py:3227 and supplied to the response store at :3286.
Problems
- The same public field is parsed in
POST /v1/runsatgateway/platforms/api_server.py:4199and passed toResponseStore.get()at:4223, but this PR validates only/v1/responses. The Runs API documentsprevious_response_idsupport atwebsite/docs/user-guide/features/api-server.md:247, so the hardening is incomplete.
Suggested changes
- Extract the validation into a shared helper and use it in both request parsers; add
/v1/runsinvalid-type and overlong-ID coverage. - The linked salvage PR #62758 already identifies these two body-parse sites and may be a useful current-main porting reference.
Automated hermes-sweeper review.
| @@ -654,6 +655,28 @@ async def _handle_responses(self, request: "web.Request") -> "web.Response": | |||
| conversation = body.get("conversation") | |||
Contributor
There was a problem hiding this comment.
Please share this validation with the /v1/runs parser too. Current main reads the same field at gateway/platforms/api_server.py:4199 and passes it to ResponseStore.get() at :4223; the API docs advertise previous_response_id for runs.
Bartok9
pushed a commit
to Bartok9/hermes-agent
that referenced
this pull request
Aug 1, 2026
…ge of NousResearch#2961 by @aydnOktay) Rebuilt on latest main (Bartok9 hygiene 2026-08-01). Original: NousResearch#62758
Contributor
Author
|
Closing to concentrate review on a single linked product bug: #89979. |
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.
This PR hardens the OpenAI-compatible Responses API by validating previous_response_id input.
It rejects:
non-string previous_response_id values (400)
empty or excessively long IDs (400)
Additionally, it adds regression tests covering invalid type and too-long cases to prevent accidental future regressions.
Endpoints affected:
POST /v1/responses