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

codemod to set shell=False for subprocess commands #193

Merged
merged 3 commits into from
Jan 3, 2024

Conversation

clavedeluna
Copy link
Contributor

@clavedeluna clavedeluna commented Dec 27, 2023

Overview

Codemod that checks any of the subprocess functions / class instantiations that have a shell kwarg and ensures it is set to True

This is the most secure fix, but there are some valid cases for using shell=True hence the review guidance.

@clavedeluna clavedeluna force-pushed the subprocess-shell-codemod branch from 2a988b8 to 4fcc014 Compare December 27, 2023 12:58
@clavedeluna clavedeluna changed the title add subprocess shell=False codemod codemod to set shell=False for subprocess commands Dec 27, 2023
Copy link

codecov bot commented Dec 27, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (a91eb5a) 96.35% compared to head (b673e03) 96.34%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #193      +/-   ##
==========================================
- Coverage   96.35%   96.34%   -0.01%     
==========================================
  Files          82       83       +1     
  Lines        3837     3860      +23     
==========================================
+ Hits         3697     3719      +22     
- Misses        140      141       +1     
Files Coverage Δ
src/core_codemods/__init__.py 100.00% <100.00%> (ø)
src/core_codemods/subprocess_shell_false.py 95.45% <95.45%> (ø)

@clavedeluna clavedeluna force-pushed the subprocess-shell-codemod branch from 4fcc014 to 458500f Compare December 27, 2023 13:04
@clavedeluna clavedeluna marked this pull request as ready for review December 27, 2023 13:04
Copy link
Member

@drdavella drdavella left a comment

Choose a reason for hiding this comment

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

Looks good but I have some requests for updates to metadata.

Also there's the question of whether this should be retroactively applied to our own security API.

tests/codemods/test_subprocess_shell_false.py Outdated Show resolved Hide resolved
src/codemodder/scripts/generate_docs.py Outdated Show resolved Hide resolved
src/core_codemods/subprocess_shell_false.py Outdated Show resolved Hide resolved
src/codemodder/scripts/generate_docs.py Outdated Show resolved Hide resolved
@clavedeluna clavedeluna force-pushed the subprocess-shell-codemod branch from 1659568 to ed87f3d Compare January 2, 2024 19:48
@clavedeluna clavedeluna force-pushed the subprocess-shell-codemod branch from ed87f3d to b673e03 Compare January 2, 2024 19:55
Copy link

sonarqubecloud bot commented Jan 2, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

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

See analysis details on SonarCloud

@clavedeluna clavedeluna added this pull request to the merge queue Jan 3, 2024
Merged via the queue into main with commit 751d1a0 Jan 3, 2024
14 checks passed
@clavedeluna clavedeluna deleted the subprocess-shell-codemod branch January 3, 2024 13:32
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.

3 participants