Skip to content

Init - #977

Merged
motdotla merged 3 commits into
mainfrom
init
Sep 19, 2026
Merged

Init#977
motdotla merged 3 commits into
mainfrom
init

Conversation

@motdotla

Copy link
Copy Markdown
Contributor

No description provided.

@superagent-security superagent-security Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superagent found 1 security concern(s).

: `${quote(process.execPath)} ${quote(path.resolve(__dirname, '../../cli/dotenvx.js'))}`

const scope = global ? '--global' : '--local'
git('config', scope, 'filter.dotenvx.clean', `${executable} precommit --clean %f`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: The Git clean filter interpolates the filename into a shell command without escaping it

The filter command leaves Git's %f filename substitution unquoted, enabling shell metacharacter command injection during git add.

Pass the filename through an argv-safe wrapper; add a malicious-filename regression test before installing this filter.

AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.

<file name="src/lib/helpers/installPrecommitFilter.js">
<violation number="1" location="src/lib/helpers/installPrecommitFilter.js:37">
<priority>P1</priority>
<title>The Git clean filter interpolates the filename into a shell command without escaping it</title>
<evidence>The installed filter command is assembled as `${executable} precommit --clean %f`. Git substitutes `%f` with the path being staged, and the path is left unquoted or otherwise argv-escaped. A repository file with shell metacharacters in its name can therefore alter the filter command and execute unintended commands when a user runs git add.</evidence>
<recommendation>Do not interpolate `%f` into a shell command. Install an argv-safe wrapper that receives the filename without shell parsing, or use a fixed executable/command interface that safely passes the path; add a regression test with shell metacharacters in a staged filename.</recommendation>
</violation>
</file>

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.

false positive. added a regression test to demonstrate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

False-positive claims on a P1 command-injection finding require a clear technical explanation (e.g., Git invokes the filter via exec/argv without shell interpretation) and confirmation that the regression test exercises shell-sensitive metacharacters (e.g. ;, |, $(…), backticks). Please provide that context or a pointer to the test logic so reviewers can verify the claim before dismissing.

@motdotla
motdotla merged commit 93db85f into main Sep 19, 2026
25 checks passed
@motdotla
motdotla deleted the init branch September 19, 2026 20:10
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