Skip to content

🛡️ Sentinel: [HIGH] Fix SSRF bypass via unspecified IPs#699

Merged
trunk-io[bot] merged 3 commits into
mainfrom
sentinel/fix-ssrf-unspecified-ip-13452951382544854245
Apr 4, 2026
Merged

🛡️ Sentinel: [HIGH] Fix SSRF bypass via unspecified IPs#699
trunk-io[bot] merged 3 commits into
mainfrom
sentinel/fix-ssrf-unspecified-ip-13452951382544854245

Conversation

@abhimehro

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
💡 Vulnerability: The SSRF prevention function _is_safe_ip relied on the ip.is_global property. However, in Python's ipaddress module, IPv4Address("0.0.0.0").is_global evaluates to True. When passed to standard socket implementations on Linux, 0.0.0.0 connects to the local loopback interface (127.0.0.1). This allowed an attacker to bypass SSRF filters and access internal or local resources by using a domain that resolves to 0.0.0.0.
🎯 Impact: Potential Server-Side Request Forgery (SSRF) allowing unauthorized access to internal resources or local services.
🔧 Fix: Added an explicit check for ip.is_unspecified in _is_safe_ip to block 0.0.0.0 and :: immediately, overriding the is_global evaluation.
Verification: Verified that existing unit tests pass, and specifically that the test_domain_resolving_to_unspecified_ip case in tests/test_ssrf_enhanced.py passes successfully, correctly identifying 0.0.0.0 as blocked.


PR created automatically by Jules for task 13452951382544854245 started by @abhimehro

- Updated `_is_safe_ip` in `main.py` to check and return `False` for `ip.is_unspecified`.
- Added critical learning to `.jules/sentinel.md` regarding `ip.is_global` and `0.0.0.0` loopback resolution.

Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings April 3, 2026 23:09
@trunk-io

trunk-io Bot commented Apr 3, 2026

Copy link
Copy Markdown

😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details.

@github-actions github-actions Bot added documentation Improvements or additions to documentation python labels Apr 3, 2026
codescene-delta-analysis[bot]

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR mitigates an SSRF filter bypass where domains resolving to unspecified IPs (e.g., 0.0.0.0 / ::) could incorrectly pass the existing _is_safe_ip check due to ipaddress.ip_address(...).is_global evaluating to True for those addresses.

Changes:

  • Block unspecified IP addresses explicitly in _is_safe_ip via ip.is_unspecified.
  • Add a Sentinel security note documenting the vulnerability and mitigation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
main.py Adds an explicit ip.is_unspecified check to prevent SSRF bypass via unspecified IPs.
.jules/sentinel.md Documents the SSRF bypass scenario and the prevention guidance.

Comment thread main.py Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an SSRF vulnerability by explicitly blocking unspecified IP addresses in the _is_safe_ip function. The reviewer identified an additional security risk regarding IPv4-mapped IPv6 addresses and provided a code suggestion to recursively unwrap and validate these addresses to ensure comprehensive filtering.

Comment thread main.py
abhimehro and others added 2 commits April 4, 2026 00:58
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
codescene-delta-analysis[bot]

This comment was marked as outdated.

@trunk-io
trunk-io Bot merged commit 07c1dcc into main Apr 4, 2026
14 checks passed
@trunk-io
trunk-io Bot deleted the sentinel/fix-ssrf-unspecified-ip-13452951382544854245 branch April 4, 2026 07:00

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gates Passed
6 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants