Skip to content

fix: git flag injection vulnerability in staleness check (#656) - #695

Open
Cid-oe wants to merge 1 commit into
Egonex-AI:mainfrom
Cid-oe:fix/issue-656-vulnerability
Open

Cid-oe wants to merge 1 commit into
Egonex-AI:mainfrom
Cid-oe:fix/issue-656-vulnerability

Conversation

@Cid-oe

@Cid-oe Cid-oe commented Sep 25, 2026

Copy link
Copy Markdown

Closes #656

Description

This fixes the [VULN-001] Git Flag / Argument Injection in getChangedFiles vulnerability reported in #656.

The getChangedFiles() function in understand-anything-plugin/packages/core/src/staleness.ts executed git diff ${lastCommitHash}..HEAD --name-only via execFileSync without revision verification or --end-of-options separation. A malicious graph metadata file could set gitCommitHash to a value starting with --output= to trigger arbitrary file creation or overwriting.

This patch resolves the commit hash first using git rev-parse --verify --end-of-options ${lastCommitHash}^{commit} and then uses --end-of-options during the git diff command.

(Note: VULN-002 mentioned in the same issue report has already been addressed by the maintainer in the plugin prompts).

This fixes VULN-001 reported in Egonex-AI#656.

When `getChangedFiles()` executed `git diff ${lastCommitHash}..HEAD --name-only`,
a malicious `lastCommitHash` containing git options could result in arbitrary
file overwrite (e.g. using `--output=<file>`).

This patch safely resolves and validates the revision using
`git rev-parse --verify --end-of-options ${requestedGraphCommitHash}^{commit}`
before running `git diff` with `--end-of-options` separation.

Closes Egonex-AI#656

This branch has not been deployed

No deployments
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.

bug: Security Issue, It is scanned by claude opus 5

1 participant