Skip to content

Commit 84cf2b3

Browse files
Merge pull request #94 from Zektopic/sentinel/fix-mock-assertion-ssrf-16557653444664257341
🛡️ Sentinel: [MEDIUM] Fix test suite SSRF mock bypass
2 parents b77dae8 + 78caf87 commit 84cf2b3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

test_testping1.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ def test_is_reachable_success(self, mock_call):
1212
mock_call.return_value = 0
1313

1414
self.assertTrue(is_reachable('8.8.8.8'))
15+
mock_call.assert_called_once()
1516

1617
@patch('testping1.subprocess.call')
1718
def test_is_reachable_failure(self, mock_call):
1819
"""Test is_reachable returns False for a failed ping."""
1920
# Simulate a failed ping response by returning a non-zero exit code
2021
mock_call.return_value = 1
2122

22-
self.assertFalse(is_reachable('10.0.0.1'))
23+
# 🛡️ Sentinel: Use a public IP to ensure SSRF blocklist doesn't bypass network logic test
24+
self.assertFalse(is_reachable('8.8.4.4'))
25+
mock_call.assert_called_once()
2326

2427
@patch('testping1.subprocess.call')
2528
def test_is_reachable_invalid_ip_format(self, mock_call):

0 commit comments

Comments
 (0)