Add tests for path traversal and invalid ID encoding methods - #276
Open
Orkuncakilkaya wants to merge 4 commits into
Open
Add tests for path traversal and invalid ID encoding methods#276Orkuncakilkaya wants to merge 4 commits into
Orkuncakilkaya wants to merge 4 commits into
Conversation
Contributor
|
🟢 Coverage increased by 97.54% Code Coverage ReportCoverage Report
Files Coverage
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Host-injection tests use values without URL delimiters, so they do not exercise the claimed security behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds regression coverage for safe encoding of path parameters and invalid IDs.
Changes:
- Tests traversal and slash encoding.
- Verifies request hosts and paths for unusual or empty IDs.
File summaries
| File | Description |
|---|---|
test/ObjectSerializerTest.php |
Tests path-value encoding edge cases. |
test/Api/FingerprintApiTest.php |
Tests encoded event and visitor request paths. |
Review details
Suppressed comments (2)
test/Api/FingerprintApiTest.php:1574
- This fixture cannot affect the authority because it has no scheme or path delimiters, and it would produce the same assertions even with no path encoding. Use an absolute-URL-shaped ID and assert its encoded path so this security regression test can fail when encoding is removed.
$request = $this->api->updateEventRequest('domain.tld', new EventUpdate());
$this->assertSame('api.fpjs.io', $request->getUri()->getHost());
$this->assertSame('/v4/events/domain.tld', $request->getUri()->getPath());
test/Api/FingerprintApiTest.php:1599
- This fixture cannot affect the authority because it has no scheme or path delimiters, and it would produce the same assertions even with no path encoding. Use an absolute-URL-shaped ID and assert its encoded path so this security regression test can fail when encoding is removed.
$request = $this->api->deleteVisitorDataRequest('domain.tld');
$this->assertSame('api.fpjs.io', $request->getUri()->getHost());
$this->assertSame('/v4/visitors/domain.tld', $request->getUri()->getPath());
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Orkuncakilkaya
marked this pull request as ready for review
September 10, 2026 12:44
Orkuncakilkaya
requested review from
TheUnderScorer,
erayaydin and
ilfa
as code owners
September 10, 2026 12:44
…ent URL normalization issues
Contributor
🚀 Following releases will be created using changesets from this PR:@fingerprint/php-sdk@7.6.1Patch Changes
|
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.
No description provided.