Repository navigation
fix option injection through file names in hg and jj blame - #437
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hg parses options anywhere on its command line, so a tracked file named
--config=extensions.x=evil.pybecame 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.