Skip to content

Commit f192b11

Browse files
committed
Add punycode sink unit tests for ssrf
1 parent 79a3981 commit f192b11

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

aikido_zen/sinks/tests/requests_test.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
SSRF_TEST_TWICE = "http://ssrf-redirects.testssandbox.com/ssrf-test-twice"
1414
SSRF_TEST_DOMAIN_TWICE = "http://ssrf-redirects.testssandbox.com/ssrf-test-domain-twice"
1515

16+
SSRF_TEST_PUNYCODE = "http://ssrf-rédirects.testssandbox.com/ssrf-test"
17+
SSRF_TEST_PUNYCODE_ENCODED = "http://xn--ssrf-rdirects-ghb.testssandbox.com/ssrf-test"
18+
SSRF_TEST_DOMAIN_TWICE_PUNYCODE = (
19+
"http://ssrf-rédirects.testssandbox.com/ssrf-test-domain-twice"
20+
)
21+
22+
1623
CROSS_DOMAIN_TEST = "http://firewallssrfredirects-env-2.eba-7ifve22q.eu-north-1.elasticbeanstalk.com/ssrf-test"
1724
CROSS_DOMAIN_TEST_DOMAIN_TWICE = "http://firewallssrfredirects-env-2.eba-7ifve22q.eu-north-1.elasticbeanstalk.com/ssrf-test-domain-twice"
1825

@@ -81,6 +88,33 @@ def test_srrf_test_domain_twice(monkeypatch):
8188
requests.get(SSRF_TEST_DOMAIN_TWICE)
8289

8390

91+
def test_ssrf_test_punycode(monkeypatch):
92+
reset_comms()
93+
set_context_and_lifecycle(SSRF_TEST_PUNYCODE)
94+
monkeypatch.setenv("AIKIDO_BLOCK", "1")
95+
96+
with pytest.raises(AikidoSSRF):
97+
requests.get(SSRF_TEST_PUNYCODE)
98+
99+
100+
def test_ssrf_test_punycode_encoded(monkeypatch):
101+
reset_comms()
102+
set_context_and_lifecycle(SSRF_TEST_PUNYCODE_ENCODED)
103+
monkeypatch.setenv("AIKIDO_BLOCK", "1")
104+
105+
with pytest.raises(AikidoSSRF):
106+
requests.get(SSRF_TEST_PUNYCODE_ENCODED)
107+
108+
109+
def test_ssrf_test_domain_twice_punycode(monkeypatch):
110+
reset_comms()
111+
set_context_and_lifecycle(SSRF_TEST_DOMAIN_TWICE_PUNYCODE)
112+
monkeypatch.setenv("AIKIDO_BLOCK", "1")
113+
114+
with pytest.raises(AikidoSSRF):
115+
requests.get(SSRF_TEST_DOMAIN_TWICE_PUNYCODE)
116+
117+
84118
def test_cross_domain(monkeypatch):
85119
set_context_and_lifecycle(CROSS_DOMAIN_TEST)
86120
monkeypatch.setenv("AIKIDO_BLOCK", "1")

0 commit comments

Comments
 (0)