Repository navigation
fix(security): URL host checks and key-file emission (code-scanning batch 3) #3695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| from datetime import datetime, timezone | ||
| from pathlib import Path | ||
| from unittest.mock import MagicMock, patch | ||
| from urllib.parse import urlparse | ||
|
|
||
| os.environ.setdefault("DATABASE_URL", "sqlite:///:memory:") | ||
| os.environ.setdefault("ENVIRONMENT", "test") | ||
|
|
@@ -368,6 +369,7 @@ def test_delivers_to_multiple_urls(self): | |
| results = n.notify([_make_item()]) | ||
| assert len(results) == 2 | ||
| urls = {r.url for r in results} | ||
| assert "https://hook1.example.com" in urls | ||
| assert "https://hook2.example.com" in urls | ||
| hosts = {urlparse(u).hostname for u in urls} | ||
| assert hosts == {"hook1.example.com", "hook2.example.com"} | ||
| assert all(urlparse(u).scheme == "https" for u in urls) | ||
|
Comment on lines
+372
to
+374
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the exact webhook URL assertion. The new checks verify only hostnames and schemes. They accept Keep an exact URL-set assertion. Retain the parsed host and scheme checks for the host-validation intent. Preserve the exact endpoint set
As per path instructions, tests must not be weakened or loosened.
|
||
| n.close() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Webhook test no longer checks full URLs
Low Severity
Replacing exact membership of the webhook URLs with hostname and scheme checks widens what this test accepts. Path, port, or userinfo changes on
r.urlno longer fail the assertion.urlsis already a set, so the previousincheck was exact equality, not a substring host test.Triggered by project rule: Cursor Bugbot Review Guidelines
Reviewed by Cursor Bugbot for commit e3a00c4. Configure here.