Repository navigation
Add failing tests for absolute endpoint URL credential leak - #10
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
list, get, create, update, and delete currently forward an absolute or protocol-relative endpoint to the HTTP client with the API key header. These tests require that input to be rejected before any request is sent.
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.
Summary
These tests are expected to fail until the endpoint handling bug is fixed. They do not change production code.
Microcms\Client::list,get,create,update, anddeletepass the caller-supplied endpoint string through to Guzzle as the request URI and always attach theX-MICROCMS-API-KEYheader. An absolute URL (https://…orhttp://…) or a protocol-relative URL (//…) replaces thehttps://{serviceDomain}.microcms.io/api/v1/base, including when a content id is joined onto that endpoint. The tests require each of those calls to throwInvalidArgumentExceptionbefore the HTTP client is invoked.Joining a content id onto a normal endpoint name stays on the service host, so that input is not part of this suite.
How to run
On the current code this reports 48 failures.
vendor/bin/phpunit tests/ClientTest.phpstill passes.