Skip to content
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

Hardening suggestions for python-security / safe_urlopen #21

Closed
wants to merge 2 commits into from

Conversation

pixeebot[bot]
Copy link

@pixeebot pixeebot bot commented Apr 25, 2024

I've reviewed the recently opened PR (20 - Fix tests and add lint and test workflows) and have identified some area(s) that could benefit from additional hardening measures.

These changes should help prevent potential security vulnerabilities and improve overall code quality.

Thank you for your consideration!

docs | feedback
Powered by: pixeebot

@pixeebot pixeebot bot requested a review from andrecsilva April 25, 2024 14:25
@@ -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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add timeout to requests call

@@ -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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add timeout to requests call

@@ -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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch use of requests for security.safe_requests

@@ -13,6 +13,7 @@ description = "The security toolkit for the Python community"
keywords = ["security", "appsec"]
dependencies = [
"requests",
"security==1.2.1",
Copy link
Author

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: MITOpen SourceMore facts

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant