-
Notifications
You must be signed in to change notification settings - Fork 2
Hardening suggestions for python-security / safe_urlopen #21
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 |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| from urllib.parse import urlparse | ||
| from urllib.request import urlopen as unsafe_urlopen | ||
|
|
||
| from requests import get as unsafe_get | ||
| from security.safe_requests import get as unsafe_get | ||
| from requests import post as unsafe_post | ||
|
|
||
| from security.exceptions import SecurityException | ||
|
|
@@ -58,7 +58,7 @@ def get( | |
| **kwargs, | ||
| ): | ||
| UrlParser(url).check(allowed_protocols, host_validator) | ||
| return unsafe_get(url, params=params, **kwargs) | ||
| return unsafe_get(url, params=params, **kwargs, timeout=60) | ||
|
Author
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. Add timeout to
Author
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. Switch use of requests for security.safe_requests |
||
|
|
||
|
|
||
| def post( | ||
|
|
@@ -70,4 +70,4 @@ def post( | |
| **kwargs, | ||
| ): | ||
| UrlParser(url).check(allowed_protocols, host_validator) | ||
| return unsafe_post(url, data=data, json=json, **kwargs) | ||
| return unsafe_post(url, data=data, json=json, **kwargs, timeout=60) | ||
|
Author
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. Add timeout to |
||
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.
This library holds security tools for protecting Python API calls.
License: MIT ✅ Open Source ✅ More facts