Repository navigation
fix #135 Reject a JSON context that does not decode to an array in the HTTP API - #136
Merged
Merged
Conversation
…e HTTP API Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Description
Fixes #135
HTTP API: a
contextgiven as a JSON string that is valid but does not decode to an array ("1","true","\"abc\"","null") passed the validation, thenjson_decode()returned a scalar (ornull) passed toProcessExecuteMessage/ProcessManager::execute()(typedarray):TypeError, 500. With a synchronous execution, the response was theTypeErrormessage, exposing the server paths. It is now rejected with a422.Changes
HttpProcessExecution::validateContext()(#[Callback]): a string context must decode to an array, else violationContext must be a JSON object or array.oncontext.AtLeastOneOf([Json, Type('array')])constraint is kept: an invalid JSON context still gives a single violation, with the same message as before (the callback skips it).""is rejected too: theJsonconstraint accepts the empty string, which gave the same 500.{},["value"]) are still accepted.JSON_THROW_ON_ERROR,json_validate()being PHP 8.3+ (the bundle supports PHP 8.2).reference/06-http_api.md(contextparameter,422response). CHANGELOG: HTTP API: a scalar JSON context gives a 500 #135 entry under "Latest" / "Fixes".Tests
HttpProcessExecutionTest::testValidation: integer, boolean, string,nulland empty JSON contexts rejected; empty object and list accepted.HttpProcessExecuteTest::testScalarJsonContext: the 5 contexts, queued and synchronous:422, no message dispatched, no process execution created.phpunit.xml.dist) already exist onmain.Not changed
Requirements
Breaking changes
None: these requests failed with a 500, they are now rejected with a 422.
🤖 Generated with Claude Code