Test/ssrf ip overflow regression 3118#3227
Open
Shan7Usmani wants to merge 2 commits into
Open
Conversation
…n IP parsing Adds direct IP literal tests for private ranges 192.168.x.x, 172.16.x.x, 10.x.x.x, and 127.x.x.x. These regression tests verify the >>> 0 unsigned right shift fix prevents the overflow that previously bypassed SSRF protection for high-bit IPs like 192.168.x.x. Closes Priyanshu-byte-coder#3118
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
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
Adds regression tests for the signed 32-bit integer overflow in
ipToNumberthat bypassed SSRF protection for 192.168.x.x and 172.16.x.x IP ranges. The overflow bug is already fixed (>>> 0unsigned shift inssrf-protection.ts), but had no test coverage for direct IP literal private ranges.Closes #3118
Type of Change
What Changed
test/ssrf-protection.test.tscovering direct IP literal private ranges:How to Test
npx vitest run test/ssrf-protection.test.tsExpected result: All tests pass, including the new regression tests confirming
isSafeUrlreturnsfalsefor private IP literals.Checklist
console.log, debug code, or commented-out blocksnpm run lintpasses locallynpm run type-check)Accessibility (UI changes only)
N/A — tests only.
Additional Context
The SSRF fix (
>>> 0unsigned right shift inipToNumber) was already merged by a prior contributor. These tests ensure the overflow regression cannot reappear silently.