Commit 159bc67
security: fix incomplete URL sanitization in tests
Replace unsafe substring check with proper URL parsing in
test_url_validation to prevent incomplete URL sanitization.
Changes:
- Import urllib.parse.urlparse
- Parse URL and validate scheme and netloc separately
- Ensure hostname is exactly "github.com", not substring
This prevents malicious URLs like:
- https://evil.com/github.com/malicious
- https://github.com.evil.com/
- https://attacker.com?redirect=github.com
Fixes CodeQL HIGH severity alert: Incomplete URL substring sanitization.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 4244f4b commit 159bc67
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
397 | 398 | | |
398 | 399 | | |
399 | 400 | | |
400 | | - | |
401 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
| |||
0 commit comments