Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jul 7, 2025

Bumps bandit from 1.7.4 to 1.8.6.

Release notes

Sourced from bandit's releases.

1.8.6

What's Changed

New Contributors

Full Changelog: PyCQA/bandit@1.8.5...1.8.6

1.8.5

What's Changed

Full Changelog: PyCQA/bandit@1.8.4...1.8.5

1.8.4

What's Changed

New Contributors

... (truncated)

Commits

Dependabot compatibility score

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 rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will 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 version will 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 dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

@dependabot dependabot bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Jul 7, 2025
@dependabot dependabot bot force-pushed the dependabot/pip/bandit-1.8.6 branch from 41407dc to ef731e9 Compare July 10, 2025 19:13
@nikolas
Copy link
Member

nikolas commented Oct 29, 2025

@dependabot rebase

@dependabot dependabot bot force-pushed the dependabot/pip/bandit-1.8.6 branch from ef731e9 to c4fe351 Compare October 29, 2025 17:57
@nikolas nikolas force-pushed the dependabot/pip/bandit-1.8.6 branch 2 times, most recently from ad1f939 to 6558516 Compare October 29, 2025 18:08
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

The full URL of this request depends on a
user-provided value
.

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 as sns.<region>.amazonaws.com.
  • Consider using ipaddress and socket to resolve and ensure the endpoint is not private (though AWS endpoints tend to be public).
    Make these checks in the _subscription_confirmation method before calling requests.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.


Suggested changeset 1
wardenclyffe/main/views.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/wardenclyffe/main/views.py b/wardenclyffe/main/views.py
--- a/wardenclyffe/main/views.py
+++ b/wardenclyffe/main/views.py
@@ -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")
EOF
@@ -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")
Copilot is powered by AI and may make mistakes. Always verify output.
@nikolas nikolas force-pushed the dependabot/pip/bandit-1.8.6 branch from 6558516 to b93c55d Compare October 29, 2025 18:13
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]>
@nikolas nikolas force-pushed the dependabot/pip/bandit-1.8.6 branch from b93c55d to 83f1d71 Compare October 29, 2025 18:19
@nikolas nikolas merged commit f7b35f7 into master Oct 29, 2025
3 of 4 checks passed
@dependabot dependabot bot deleted the dependabot/pip/bandit-1.8.6 branch October 29, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants