-
Notifications
You must be signed in to change notification settings - Fork 230
Hardening suggestions for insecure-kubernetes-deployments / pixeebot/drip-2024-12-19-pixee-python/add-requests-timeouts #68
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,2 +1,3 @@ | ||
| fastapi==0.115.5 | ||
| uvicorn==0.32.1 | ||
| uvicorn==0.32.1 | ||
| security==1.3.1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,9 @@ | |
| import subprocess | ||
| import os | ||
| import sqlite3 | ||
| import requests | ||
| from lxml import etree | ||
| from security import safe_requests, safe_command | ||
| import lxml.etree | ||
|
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. Security control: Static Code Analysis Python Semgrep Potential Xxe Vulnerability With Native Python Xml Libraries Found use of the native Python XML libraries, which is vulnerable to XML external entity (XXE) Severity: HIGH Jit Bot commands and options (e.g., ignore issue)You can trigger Jit actions by commenting on this PR review:
|
||
|
|
||
| # Example hardcoded AWS credentials (sensitive data leakage) | ||
| aws_access_key_id = 'AKIA2JAPX77RGLB664VE' | ||
|
|
@@ -28,7 +29,7 @@ def index(): | |
| # 2 - Command Injection | ||
| if 'command' in request.form: | ||
| cmd = request.form['command'] | ||
| process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
| process = safe_command.run(subprocess.Popen, cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
| stdout, stderr = process.communicate() | ||
| if process.returncode == 0: | ||
| output = stdout.decode('utf-8') | ||
|
|
@@ -67,8 +68,8 @@ def index(): | |
| xml_data = request.form['xml'] | ||
| try: | ||
| # Use lxml to parse the XML data | ||
| parser = etree.XMLParser(load_dtd=True, resolve_entities=True) | ||
| tree = etree.fromstring(xml_data.encode(), parser) | ||
| parser = etree.XMLParser(load_dtd=True, resolve_entities=False) | ||
| tree = etree.fromstring(xml_data.encode(), parser, parser=lxml.etree.XMLParser(resolve_entities=False)) | ||
|
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. Security control: Static Code Analysis Python Semgrep Potential Xxe Vulnerability With Native Python Xml Libraries Found use of the native Python XML libraries, which is vulnerable to XML external entity (XXE) Severity: HIGH Jit Bot commands and options (e.g., ignore issue)You can trigger Jit actions by commenting on this PR review:
|
||
| output = f"Parsed XML: {etree.tostring(tree, encoding='unicode')}" | ||
| except Exception as e: | ||
| output = f"XML Parsing Error: {e}" | ||
|
|
@@ -77,7 +78,7 @@ def index(): | |
| elif 'url' in request.form: | ||
| url = request.form['url'] | ||
| try: | ||
| response = requests.get(url, timeout=60) | ||
| response = safe_requests.get(url, timeout=60) | ||
| output = f"SSRF Response: {response.text[:200]}" | ||
| except Exception as e: | ||
| output = f"SSRF Error: {e}" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| requests == 2.19.1 | ||
| cryptography==3.3.2 | ||
| flask==3.0.2 | ||
| #cryptograpy==3.3.2 | ||
| #cryptograpy==3.3.2 | ||
| security==1.3.1 |
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.
Reputation Risk:
[email protected]has a low reputation scoreThe package has a low reputation score, consider finding an alternative.
Score factors:
Severity: Medium⚠️
Status: Open 🔴
Resources:
Take action by replying with an [arnica] command 💬
Actions
Use
[arnica]or[a]to interact with the Arnica bot to acknowledge or dismiss code risks.[arnica] ack <message>
Acknowledge the finding as a valid code risk.
Examples
[arnica] dismiss <
fp|accept|capacity> <message>Dismiss the risk with a reason.
fp: False positive, i.e. the result is incorrect and indicates no actual risk.accept: Tolerable risk, i.e. risk severity is lower than what has been reported or is accepted as it stands.capacity: No capacity, i.e. leave me alone, please.Examples