Skip to content

fix option injection through file names in hg and jj blame - #437

Merged
umputun merged 2 commits into
masterfrom
fix-blame-option-injection
Nov 9, 2026
Merged

umputun merged 2 commits into
masterfrom
fix-blame-option-injection

Conversation

@umputun

@umputun umputun commented Nov 9, 2026

Copy link
Copy Markdown
Owner

hg parses options anywhere on its command line, so a tracked file named --config=extensions.x=evil.py became an hg option when blame annotated it, and hg imported evil.py from the repository. Viewing such a file with blame on was enough to run code from a cloned repository. Under jj the same kind of name became jj's global --config.

both annotate calls now put -- before the file name, as the diff and cat calls already do. CI now installs hg and jj, so the regression tests that run real hg and jj on a flag-shaped file name no longer skip there.

hg parses options anywhere on its command line, so a tracked file named
`--config=extensions.x=evil.py` became an hg option when blame annotated it,
and hg imported evil.py from the repository. Under jj the same kind of name
became its global `--config`. Both annotate calls now put `--` before the
file name, as the diff and cat calls already do.
the hg and jj tests skip when the binary is missing, and CI installed
neither, so the "--" fix for flag-shaped file names was not checked there.
hg comes from apt, jj from the pinned v0.47.1 release tarball, verified by
its sha256.
Copilot AI balanced review requested due to automatic review settings November 9, 2026 05:14

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@umputun
umputun merged commit 30c3b51 into master Nov 9, 2026
10 of 13 checks passed
@umputun
umputun deleted the fix-blame-option-injection branch November 9, 2026 05:22
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.

2 participants