Skip to content

Test/ssrf ip overflow regression 3118#3227

Open
Shan7Usmani wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
Shan7Usmani:test/ssrf-ip-overflow-regression-3118
Open

Test/ssrf ip overflow regression 3118#3227
Shan7Usmani wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
Shan7Usmani:test/ssrf-ip-overflow-regression-3118

Conversation

@Shan7Usmani

Copy link
Copy Markdown

Summary

Adds regression tests for the signed 32-bit integer overflow in ipToNumber that bypassed SSRF protection for 192.168.x.x and 172.16.x.x IP ranges. The overflow bug is already fixed (>>> 0 unsigned shift in ssrf-protection.ts), but had no test coverage for direct IP literal private ranges.

Closes #3118


Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📝 Documentation update
  • ♻️ Refactor / code cleanup (no functional change)
  • ⚡ Performance improvement
  • 🔒 Security fix
  • 🧪 Tests only

What Changed

  • Added 4 test cases to test/ssrf-protection.test.ts covering direct IP literal private ranges:
    • 192.168.x.x (3 addresses)
    • 172.16.x.x (2 addresses)
    • 10.x.x.x (2 addresses)
    • 127.x.x.x (2 addresses)

How to Test

  1. Run npx vitest run test/ssrf-protection.test.ts
  2. Verify all 23 tests pass (19 existing + 4 new)

Expected result: All tests pass, including the new regression tests confirming isSafeUrl returns false for private IP literals.


Checklist

  • Linked the related issue above
  • Self-reviewed my own diff
  • No unnecessary console.log, debug code, or commented-out blocks
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Added or updated tests where applicable
  • Updated documentation / comments if behavior changed

Accessibility (UI changes only)

N/A — tests only.


Additional Context

The SSRF fix (>>> 0 unsigned right shift in ipToNumber) was already merged by a prior contributor. These tests ensure the overflow regression cannot reappear silently.

…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
@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:testing GSSoC type bonus: tests (+10 pts) labels Jul 22, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@github-actions github-actions Bot added type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) labels Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SECURITY] JavaScript Signed 32-Bit Integer Overflow in IP Parsing Bypasses SSRF Protection for 192.168.x.x and 172.16.x.x

1 participant