mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-13 18:32:20 +02:00
Merge verified Odysseus fixes
This commit is contained in:
@@ -64,6 +64,33 @@ def test_strict_mode_blocks_private_and_loopback():
|
||||
assert ok is False and "private" in reason
|
||||
|
||||
|
||||
def test_strict_mode_blocks_cgnat_shared_space():
|
||||
# RFC 6598 shared/CGNAT space (100.64.0.0/10) is not globally routable.
|
||||
# A public redirect into it must be rejected under full SSRF lockdown,
|
||||
# even though ipaddress reports is_private=False for this range.
|
||||
CGNAT = _resolver({"svc.example": ["100.64.0.1"]})
|
||||
ok, reason = check_outbound_url("http://svc.example:8080", block_private=True, resolver=CGNAT)
|
||||
assert ok is False
|
||||
assert "blocked" in reason
|
||||
|
||||
|
||||
def test_strict_mode_blocks_non_global_ranges():
|
||||
# Strict mode is a full SSRF lockdown: only globally-routable public
|
||||
# addresses may be reached. Benchmarking (198.18.0.0/15) and TEST-NET
|
||||
# documentation space (192.0.2.0/24) are not globally routable.
|
||||
for ip in ("198.18.0.1", "192.0.2.10"):
|
||||
res = _resolver({"svc.example": [ip]})
|
||||
ok, reason = check_outbound_url("http://svc.example", block_private=True, resolver=res)
|
||||
assert ok is False, ip
|
||||
assert "blocked" in reason
|
||||
|
||||
|
||||
def test_strict_mode_still_allows_public_ip():
|
||||
# The lockdown must not reject a legitimate globally-routable target.
|
||||
ok, reason = check_outbound_url("https://example.com/v1", block_private=True, resolver=PUBLIC)
|
||||
assert ok is True, reason
|
||||
|
||||
|
||||
def test_unresolvable_host_blocked():
|
||||
ok, reason = check_outbound_url("http://does-not-resolve.invalid", resolver=PUBLIC)
|
||||
assert ok is False
|
||||
|
||||
Reference in New Issue
Block a user