Page MenuHomePhabricator

Work around a Windows escaping issue and security conecern in "hg cat --output ..."
ClosedPublic

Authored by epriestley on Oct 25 2018, 2:01 AM.
Tags
None
Referenced Files
F19511047: D19758.diff
Sun, Jan 11, 8:43 PM
F19427641: D19758.id47208.diff
Sun, Dec 28, 8:42 AM
F19106815: D19758.diff
Dec 7 2025, 2:26 PM
F19106814: D19758.diff
Dec 7 2025, 2:26 PM
F18997063: D19758.diff
Nov 20 2025, 10:03 AM
F18837079: D19758.diff
Oct 27 2025, 4:18 AM
F18790481: D19758.id47191.diff
Oct 15 2025, 2:56 PM
F18788963: D19758.id.diff
Oct 15 2025, 7:18 AM
Subscribers
None

Details

Summary

See PHI904. Ref T13210. Ref T13209. Currently, we have an hg cat construction which attempts to pass a literal %p to Mercurial. This fails because you can't pass % through %s outside of wilds.

It also uses %C to pass a list of file paths. This is broadly unsafe and can cause command execution if you modify a file named, e.g., ; rm -rf xyz or similar. I think it would be difficult to turn this into an attack but it's fairly bad. This dates from D5144 in 2013.

Test Plan

With this patch, created D19757 which has valid binary data (see F5962134).

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable