Skip to content

top-complexity: prevent filename-based shell injection risk#20969

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/top-complexity-args
Closed

top-complexity: prevent filename-based shell injection risk#20969
bagder wants to merge 1 commit intomasterfrom
bagder/top-complexity-args

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Mar 17, 2026

As we run this script in CI, this should reduce the risk of mischief

Found by Codex Security

As we run this script in CI, this should reduce the risk of mischief

Found by Codex Security
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens scripts/top-complexity by avoiding shell-invoked pipelines/backticks and instead using list-form open(..., "-|", ...) to run git ls-files and pmccabe more safely.

Changes:

  • Replace open(F, "git ls-files ... |") with list-form open(my $git, "-|", "git", "ls-files", ...).
  • Replace backticks execution of pmccabe with list-form open(my $pmc, "-|", $pmccabe, @files).
  • Explicitly close the new pipe filehandles.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread scripts/top-complexity
@bagder bagder marked this pull request as ready for review March 18, 2026 09:24
@bagder bagder closed this in b11f43a Mar 18, 2026
@bagder bagder deleted the bagder/top-complexity-args branch March 18, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants