Skip to content

Hardening suggestions for codemodder-python / pydantic-codetf#358

Merged
drdavella merged 1 commit intomainfrom
pixeebot/pydantic-codetf
Mar 12, 2024
Merged

Hardening suggestions for codemodder-python / pydantic-codetf#358
drdavella merged 1 commit intomainfrom
pixeebot/pydantic-codetf

Conversation

@pixeebot
Copy link
Copy Markdown
Contributor

@pixeebot pixeebot bot commented Mar 11, 2024

I've reviewed the recently opened PR (357 - Use Pydantic to generate and validate CodeTF data models) 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 drdavella as a code owner March 11, 2024 20:09
@pixeebot pixeebot bot requested a review from drdavella March 11, 2024 20:09
def codetf_schema():
schema_path = "https://raw.githubusercontent.com/pixee/codemodder-specs/main/codetf.schema.json"
response = requests.get(schema_path)
response = requests.get(schema_path, timeout=60)
Copy link
Copy Markdown
Contributor 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

@@ -176,8 +177,7 @@ def test_file_rewritten(self, codetf_schema):
self.check_code_before()
self.check_dependencies_before()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Replaces subprocess.{func} with more secure safe_command library functions.

# idempotency test, run it again and assert no files changed
completed_process = subprocess.run(
command,
completed_process = safe_command.run(subprocess.run, command,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Replaces subprocess.{func} with more secure safe_command library functions.

Comment thread pyproject.toml Outdated
"tomlkit~=0.12.0",
"wrapt~=1.16.0",
"chardet~=5.2.0",
"security==1.2.1",
Copy link
Copy Markdown
Contributor 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

Base automatically changed from pydantic-codetf to main March 12, 2024 14:12
@drdavella drdavella force-pushed the pixeebot/pydantic-codetf branch from 7d0bad7 to 8d8e8ee Compare March 12, 2024 14:24
@sonarqubecloud
Copy link
Copy Markdown

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

@drdavella drdavella enabled auto-merge March 12, 2024 14:26
@drdavella drdavella added this pull request to the merge queue Mar 12, 2024
Merged via the queue into main with commit 72d42a1 Mar 12, 2024
@drdavella drdavella deleted the pixeebot/pydantic-codetf branch March 12, 2024 14:40
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