-
Notifications
You must be signed in to change notification settings - Fork 4
Bump bandit from 1.7.4 to 1.8.6 #3205
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
Conversation
41407dc to
ef731e9
Compare
|
@dependabot rebase |
ef731e9 to
c4fe351
Compare
ad1f939 to
6558516
Compare
| return HttpResponse("no subscribe url", status=400) | ||
| url = message["SubscribeURL"] | ||
| r = requests.get(url) | ||
| r = requests.get(url, timeout=5) |
Check failure
Code scanning / CodeQL
Full server-side request forgery Critical
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 days ago
To fix this issue robustly, the SubscribeURL extracted from SNS confirmation messages must not be blindly trusted; instead, the URL should be validated to ensure it only references domains legitimately controlled by AWS SNS (or whatever specific infrastructure is expected). This means checking the hostname against a whitelist of known prefix or suffixes (e.g., .amazonaws.com). A recommended approach is:
- Parse the URL.
- Check that its hostname ends with a trusted AWS SNS domain suffix (e.g.,
.amazonaws.com), optionally even more specific such assns.<region>.amazonaws.com. - Consider using
ipaddressandsocketto resolve and ensure the endpoint is not private (though AWS endpoints tend to be public).
Make these checks in the_subscription_confirmationmethod before callingrequests.get(url, timeout=5).
Minimal changes should be made: add validation logic just before making the request, and ensure any required imports (import socket) are added if needed.
-
Copy modified line R53 -
Copy modified lines R1387-R1392
| @@ -50,6 +50,7 @@ | ||
| from urllib.parse import urlparse | ||
| except ImportError: | ||
| from urlparse import urlparse | ||
| import socket | ||
|
|
||
|
|
||
| def is_staff(user): | ||
| @@ -1383,6 +1384,12 @@ | ||
| if parsed_url.scheme != 'https': | ||
| return HttpResponse('invalid subscribe url', status=400) | ||
|
|
||
| # Check the hostname is an AWS SNS endpoint | ||
| allowed_domains = ('.amazonaws.com',) | ||
| hostname = parsed_url.hostname | ||
| if not hostname or not hostname.endswith(allowed_domains): | ||
| return HttpResponse('untrusted subscribe url', status=400) | ||
|
|
||
| r = requests.get(url, timeout=5) | ||
| if r.status_code == 200: | ||
| return HttpResponse("OK") |
6558516 to
b93c55d
Compare
Bumps [bandit](https://github.com/PyCQA/bandit) from 1.7.4 to 1.8.6. - [Release notes](https://github.com/PyCQA/bandit/releases) - [Commits](PyCQA/bandit@1.7.4...1.8.6) --- updated-dependencies: - dependency-name: bandit dependency-version: 1.8.6 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
b93c55d to
83f1d71
Compare
Bumps bandit from 1.7.4 to 1.8.6.
Release notes
Sourced from bandit's releases.
... (truncated)
Commits
2d0b675Huggingface revision pinning (#1281)4cd1337Bump sigstore/cosign-installer from 3.9.0 to 3.9.1 (#1284)ffed1bbadded hint to FreeBSD package in doc/source/integrations.rst (#1282)090ba0fBump docker/setup-buildx-action from 3.10.0 to 3.11.1 (#1278)33c6789Bump sigstore/cosign-installer from 3.8.2 to 3.9.0 (#1279)23d269aFix for publish to PyPI failure (#1273)e3ff8b5Fix the rendering of the CI/CD doc (#1274)61d1667add github-actions documentation (#1172)cea2b1cBump docker/build-push-action from 6.17.0 to 6.18.0 (#1268)2d577a6[pre-commit.ci] pre-commit autoupdate (#1266)You can trigger a rebase of this PR by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)