Thu, 15 Mar 2018 21:51:33 -0700 tests: demonstrate aborted rebase strips commits that didn't need rebasing stable
Martin von Zweigbergk <martinvonz@google.com> [Thu, 15 Mar 2018 21:51:33 -0700] rev 35855
tests: demonstrate aborted rebase strips commits that didn't need rebasing I haven't verified, but this has probably been broken ever since I added the feature in 78496ac30025 (rebase: allow rebase even if some revisions need no rebase (BC) (issue5422), 2017-05-11). Differential Revision: https://phab.mercurial-scm.org/D2877
Mon, 12 Mar 2018 13:15:00 -0700 hgweb: garbage collect on every request stable
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 12 Mar 2018 13:15:00 -0700] rev 35854
hgweb: garbage collect on every request There appears to be a cycle in localrepository or hgweb that is preventing repositories from being garbage collected when hgwebdir dispatches to hgweb. Every request creates a new repository instance and then leaks that object and other referenced objects. A periodic GC to find cycles will eventually collect the old repositories. But these don't run reliably and rapid requests to hgwebdir can result in rapidly increasing memory consumption. With the Firefox repository, repeated requests to raw-file URLs leak ~100 MB per hgwebdir request (most of this appears to be cached manifest data structures). WSGI processes quickly grow to >1 GB RSS. Breaking the cycles in localrepository is going to be a bit of work. Because we know that hgwebdir leaks localrepository instances, let's put a band aid on the problem in the form of an explicit gc.collect() on every hgwebdir request. As the inline comment states, ideally we'd do this in a finally block for the current request iff it dispatches to hgweb. But _runwsgi() returns an explicit value. We need the finally to run after generator exhaustion. So we'd need to refactor _runwsgi() to "yield" instead of "return." That's too much change for a patch to stable. So we implement this hack one function above and run it on every request. The performance impact of this change should be minimal. Any impact should be offset by benefits from not having hgwebdir processes leak memory.
Sun, 11 Mar 2018 20:10:38 +0900 amend: abort if unresolved merge conflicts found (issue5805) stable
Yuya Nishihara <yuya@tcha.org> [Sun, 11 Mar 2018 20:10:38 +0900] rev 35853
amend: abort if unresolved merge conflicts found (issue5805) It was checked by repo.commit() before e8a7c1a0565a "cmdutil: remove the redundant commit during amend."
Tue, 06 Mar 2018 13:19:54 -0600 Added signature for changeset 8bba684efde7 stable
Kevin Bullock <kbullock@ringworld.org> [Tue, 06 Mar 2018 13:19:54 -0600] rev 35852
Added signature for changeset 8bba684efde7
Tue, 06 Mar 2018 13:19:52 -0600 Added tag 4.5.2 for changeset 8bba684efde7 stable
Kevin Bullock <kbullock@ringworld.org> [Tue, 06 Mar 2018 13:19:52 -0600] rev 35851
Added tag 4.5.2 for changeset 8bba684efde7
Tue, 06 Mar 2018 13:17:07 -0600 merge with security patches stable 4.5.2
Kevin Bullock <kbullock+mercurial@ringworld.org> [Tue, 06 Mar 2018 13:17:07 -0600] rev 35850
merge with security patches
Sun, 18 Feb 2018 17:20:38 -0800 hgweb: always perform permissions checks on protocol commands (BC) (SEC) stable
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Feb 2018 17:20:38 -0800] rev 35849
hgweb: always perform permissions checks on protocol commands (BC) (SEC) Previously, the HTTP request handling code would only perform permissions checking on a wire protocol command if that wire protocol command defined its permissions / operation type. This meant that commands (possibly provided by extensions) not defining their operation type would bypass permissions check. This could lead to exfiltration of data from servers and mutating repositories that were supposed to be read-only. This security issue has been present since the permissions table was introduced by d3147b4e3e8a in 2008. This commit changes the behavior of the HTTP server to always perform permissions checking for protocol requests. If an explicit permission for a wire protocol command is not defined, the server assumes the command can be used for writing and governs access accordingly. .. bc:: Wire protocol commands not defining their operation type in ``wireproto.PERMISSIONS`` are now assumed to be used for "push" operations and access control to run those commands is now enforced accordingly.
Tue, 20 Feb 2018 18:55:58 -0800 wireproto: check permissions when executing "batch" command (BC) (SEC) stable
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 20 Feb 2018 18:55:58 -0800] rev 35848
wireproto: check permissions when executing "batch" command (BC) (SEC) For as long as the "batch" command has existed (introduced by bd88561afb4b and first released as part of Mercurial 1.9), that command (like most wire commands introduced after 2008) lacked an entry in the hgweb permissions table. And since we don't verify permissions if an entry is missing from the permissions table, this meant that executing a command via "batch" would bypass all permissions checks. The security implications are significant: a Mercurial HTTP server would allow writes via "batch" wire protocol commands as long as the HTTP request were processed by Mercurial and the process running the Mercurial HTTP server had write access to the repository. The Mercurial defaults of servers being read-only and the various web.* config options to define access control were bypassed. In addition, "batch" could be used to exfiltrate data from servers that were configured to not allow read access. Both forms of permissions bypass could be mitigated to some extent by using HTTP authentication. This would prevent HTTP requests from hitting Mercurial's server logic. However, any authenticated request would still be able to bypass permissions checks via "batch" commands. The easiest exploit was to send "pushkey" commands via "batch" and modify the state of bookmarks, phases, and obsolescence markers. However, I suspect a well-crafted HTTP request could trick the server into running the "unbundle" wire protocol command, effectively performing a full `hg push` to create new changesets on the remote. This commit plugs this gaping security hole by having the "batch" command perform permissions checking on each sub-command that is being batched. We do this by threading a permissions checking callable all the way to the protocol handler. The threading is a bit hacky from a code perspective. But it preserves API compatibility, which is the proper thing to do on the stable branch. One of the subtle things we do is assume that a command with an undefined permission is a "push" command. This is the safest thing to do from a security perspective: we don't want to take chances that a command could perform a write even though the server is configured to not allow writes. As the test changes demonstrate, it is no longer possible to bypass permissions via the "batch" wire protocol command. .. bc:: The "batch" wire protocol command now enforces permissions of each invoked sub-command. Wire protocol commands must define their operation type or the "batch" command will assume they can write data and will prevent their execution on HTTP servers unless the HTTP request method is POST, the server is configured to allow pushes, and the (possibly authenticated) HTTP user is authorized to perform a push.
Tue, 20 Feb 2018 18:54:27 -0800 wireproto: declare operation type for most commands (BC) (SEC) stable
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 20 Feb 2018 18:54:27 -0800] rev 35847
wireproto: declare operation type for most commands (BC) (SEC) The permissions model of hgweb relies on a dictionary to declare the operation associated with each command - either "pull" or "push." This dictionary was established by d3147b4e3e8a in 2008. Unfortunately, we neglected to update this dictionary as new wire protocol commands were introduced. This commit defines the operations of most wire protocol commands in the permissions dictionary. The "batch" command is omitted because it is special and requires a more complex solution. Since permissions checking is skipped unless a command has an entry in this dictionary (this security issue will be addressed in a subsequent commit), the practical effect of this change is that various wire protocol commands now HTTP 401 if web.deny_read or web.allow-pull, etc are set to deny access. This is reflected by test changes. Note how various `hg pull` and `hg push` operations now fail before discovery. (They fail during the initial "capabilities" request.) This change fixes a security issue where built-in wire protocol commands would return repository data even if the web config were configured to deny access to that data. I'm on the fence as to whether we should HTTP 401 the capabilities request. On one hand, it can expose repository metadata and can tell callers things like what version of Mercurial the server is running. On the other hand, a client may need to know the capabilities in order to authenticate in a follow-up request. It appears that Mercurial clients handle the HTTP 401 on *any* protocol request, so we should be OK sending a 401 for "capabilities." But if this causes problems, it should be possible to allow "capabilities" to always work. .. bc:: Various read-only wire protocol commands now return HTTP 401 Unauthorized if the hgweb configuration denies read/pull access to the repository. Previously, various wire protocol commands would still work and return data if read access was disabled.
Tue, 20 Feb 2018 18:53:39 -0800 wireproto: move command permissions dict out of hgweb_mod stable
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 20 Feb 2018 18:53:39 -0800] rev 35846
wireproto: move command permissions dict out of hgweb_mod The operation type associated with wire protocol commands is supposed to be defined in a dictionary so it can be used for permissions checking. Since this metadata is closely associated with wire protocol commands themselves, it makes sense to define it in the same module where wire protocol commands are defined. This commit moves hgweb_mod.perms to wireproto.PERMISSIONS and updates most references in the code to use the new home. The old symbol remains an alias for the new symbol. Tests pass with the code pointing at the old symbol. So this should be API compatible for extensions. As part of the code move, we split up the assignment to the dict so it is next to the @wireprotocommand. This reinforces that a @wireprotocommand should have an entry in this dict. In the future, we'll want to declare permissions as part of the @wireprotocommand decorator. But this isn't appropriate for the stable branch.
Tue, 20 Feb 2018 19:09:01 -0800 tests: comprehensively test HTTP server permissions checking stable
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 20 Feb 2018 19:09:01 -0800] rev 35845
tests: comprehensively test HTTP server permissions checking We didn't have test coverage for numerous web.* config options. We add that test coverage. Included in the tests are tests for custom commands. We have commands that are supposedly read-only and perform writes and a variation of each that does and does not define its operation type in hgweb_mod.perms. The tests reveal a handful of security bugs related to permissions checking. Subsequent commits will address these security bugs.
Sun, 18 Feb 2018 10:40:49 -0800 tests: extract HTTP permissions tests to own test file stable
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Feb 2018 10:40:49 -0800] rev 35844
tests: extract HTTP permissions tests to own test file We're about to implement a lot more coverage of the permissions mechanism. In preparation for that, establish a new test file to hold permissions checks. As part of this, we inline the important parts of the "req" helper function.
Tue, 06 Mar 2018 13:08:00 -0600 Added signature for changeset 369aadf7a326 stable
Kevin Bullock <kbullock@ringworld.org> [Tue, 06 Mar 2018 13:08:00 -0600] rev 35843
Added signature for changeset 369aadf7a326
Tue, 06 Mar 2018 13:07:58 -0600 Added tag 4.5.1 for changeset 369aadf7a326 stable
Kevin Bullock <kbullock@ringworld.org> [Tue, 06 Mar 2018 13:07:58 -0600] rev 35842
Added tag 4.5.1 for changeset 369aadf7a326
Tue, 13 Feb 2018 11:35:32 -0800 revlog: resolve lfs rawtext to vanilla rawtext before applying delta stable 4.5.1
Jun Wu <quark@fb.com> [Tue, 13 Feb 2018 11:35:32 -0800] rev 35841
revlog: resolve lfs rawtext to vanilla rawtext before applying delta This happens when a LFS delta base gets a non-LFS delta from another client. In that case, the LFS delta base needs to be converted to non-LFS version before applying the delta. Differential Revision: https://phab.mercurial-scm.org/D2069
Tue, 13 Feb 2018 11:35:32 -0800 revlog: do not use delta for lfs revisions stable
Jun Wu <quark@fb.com> [Tue, 13 Feb 2018 11:35:32 -0800] rev 35840
revlog: do not use delta for lfs revisions This is similar to what we have done for changegroups. It is needed to make sure the delta application code path can assume deltas are always against vanilla (ex. non-LFS) rawtext so the next fix becomes possible. Differential Revision: https://phab.mercurial-scm.org/D2068
Tue, 06 Feb 2018 19:08:25 -0800 changegroup: do not delta lfs revisions stable
Jun Wu <quark@fb.com> [Tue, 06 Feb 2018 19:08:25 -0800] rev 35839
changegroup: do not delta lfs revisions There is no way to distinguish whether a delta base is LFS or non-LFS. If the delta is against LFS rawtext, and the client trying to apply it has the base revision stored as fulltext, the delta (aka. bundle) will fail to apply. This patch forbids using delta for LFS revisions in changegroup so bad deltas won't be transmitted. Note: this does not solve the problem entirely. It solves LFS delta applying to non-LFS base. But the other direction: non-LFS delta applying to LFS base is not solved yet. Differential Revision: https://phab.mercurial-scm.org/D2067
Tue, 06 Feb 2018 16:08:57 -0800 lfs: add a test showing bundle application could be broken stable
Jun Wu <quark@fb.com> [Tue, 06 Feb 2018 16:08:57 -0800] rev 35838
lfs: add a test showing bundle application could be broken When a bundle containing LFS delta uses non-LFS delta-base, or vice-versa, the bundle will fail to apply. Differential Revision: https://phab.mercurial-scm.org/D2066
Sun, 04 Mar 2018 14:53:57 -0500 test-annotate: set stdin and stdout to binary to get CR unmodified stable
Yuya Nishihara <yuya@tcha.org> [Sun, 04 Mar 2018 14:53:57 -0500] rev 35837
test-annotate: set stdin and stdout to binary to get CR unmodified
Sun, 04 Mar 2018 13:19:05 -0500 test-annotate: rewrite sed with some python stable
Yuya Nishihara <yuya@tcha.org> [Sun, 04 Mar 2018 13:19:05 -0500] rev 35836
test-annotate: rewrite sed with some python I hope this will fix the test failure seen on FreeBSD and Windows.
Sat, 03 Mar 2018 22:29:24 -0500 test-subrepo: glob away an unstable hash stable
Matt Harbison <matt_harbison@yahoo.com> [Sat, 03 Mar 2018 22:29:24 -0500] rev 35835
test-subrepo: glob away an unstable hash This is the instability mentioned at the beginning of the series. I don't like hiding it, but I don't want to sit on a fix for a user reported problem while trying to figure this out. The instability seems related to the cset with a .hgsub with a remote URL. (There's very little existing remote URL subrepo testing.)
Thu, 01 Mar 2018 11:37:00 -0500 subrepo: activate clone pooling to enable sharing with remote URLs stable
Matt Harbison <matt_harbison@yahoo.com> [Thu, 01 Mar 2018 11:37:00 -0500] rev 35834
subrepo: activate clone pooling to enable sharing with remote URLs This is the easiest way to ensure that repositories with remote subrepo references can share the subrepos, consistent with how local subrepos can be shared.
Thu, 01 Mar 2018 11:13:00 -0500 subrepo: don't attempt to share remote sources (issue5793) stable
Matt Harbison <matt_harbison@yahoo.com> [Thu, 01 Mar 2018 11:13:00 -0500] rev 35833
subrepo: don't attempt to share remote sources (issue5793) Untangling _abssource() to resolve the new subrepo relative to the shared parent's share path, and then either sharing from there (if it exists), or cloning to that location and then sharing, is probably more than should be attempted on stable. Absolute subrepo references are discouraged, so for now, this resumes the behavior prior to 68e0bcb90357 of cloning the absolute subrepo locally.
Wed, 28 Feb 2018 00:29:27 -0500 test-subrepo: demonstrate problems with subrepo sharing and absolute paths stable
Matt Harbison <matt_harbison@yahoo.com> [Wed, 28 Feb 2018 00:29:27 -0500] rev 35832
test-subrepo: demonstrate problems with subrepo sharing and absolute paths This affects remote paths in .hgsub, as well as clone pooling from a remote source. For reasons unknown, there are stability issues with the relative-path.t tests. If run as a single test, it is stable. If run with --loop, or with -jX for X>1, the hash of the parent repo changes. I'm seeing this on both Windows and Fedora 26. I added an `hg log --debug`, and the manifest hash changes, but I have no idea why.
Wed, 21 Feb 2018 21:14:05 +0900 annotate: do not poorly split lines at CR (issue5798) stable
Yuya Nishihara <yuya@tcha.org> [Wed, 21 Feb 2018 21:14:05 +0900] rev 35831
annotate: do not poorly split lines at CR (issue5798) mdiff and lines(text) take only LF as a line separator, but str.splitlines() breaks our assumption. Use mdiff.splitnewlines() consistently. It's hard to read \r in tests, so \r is replaced with [CR]. I had to wrap sed by a shell function to silence check-code warning.
Fri, 23 Feb 2018 17:57:04 -0800 setup: only allow Python 3 from a source checkout (issue5804) stable
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 23 Feb 2018 17:57:04 -0800] rev 35830
setup: only allow Python 3 from a source checkout (issue5804) People are running `pip install Mercurial` with Python 3 and that is working because not everything performs a Python version compatibility check. Modern versions of pip do recognize the "python_requires" keyword (https://packaging.python.org/tutorials/distributing-packages/#python-requires) which we set if using setuptools. But this isn't set nor recognized everywhere. To prevent people from accidentally installing Mercurial with Python 3 until Python 3 is officially supported, have setup.py fail when run with Python 3. But don't fail if we're running from a source checkout, as we don't want to anger Mercurial developers hacking on Python 3 nor Mercurial's test automation running from source checkouts. People running setup.py from source checkouts could still fall through a Python 3 crack. But at least the `pip install Mercurial` attempt will get nipped in the bud.
Wed, 21 Feb 2018 16:51:09 -0500 help: fix wording describing SSH requirements stable
Josef 'Jeff' Sipek <jeffpc@josefsipek.net> [Wed, 21 Feb 2018 16:51:09 -0500] rev 35829
help: fix wording describing SSH requirements
Thu, 22 Feb 2018 15:18:44 +0800 graphlog: document what "_" and "*" mean stable
Anton Shestakov <av6@dwimlabs.net> [Thu, 22 Feb 2018 15:18:44 +0800] rev 35828
graphlog: document what "_" and "*" mean Documenting "*" should've been a part of 9b3f95d9783d, but I somehow didn't notice that the symbols are explained in the command's help text.
Sun, 18 Feb 2018 16:19:26 -0800 tests: expand test coverage for updating phases stable
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Feb 2018 16:19:26 -0800] rev 35827
tests: expand test coverage for updating phases Consolidating the tests demonstrated that there are behavior differences when pushing phases between bundle1 and bundle2. A reason for this is the behavior of legacy pushes where the client queries the state of phases and then conditionally updates phases after an "unbundle" is processed. This behavior is expected. The tests were incomplete because they only tested the case of a publishing repo. In this commit, we add a variant for a non-publishing repo. We still see some differences between the legacy and bundle2 exchanges. But they are less pronounced. The behavior of not firing a pushkey hook when phases are updated as part of changegroup application feels weird to me. I'm not sure if this is a feature or a bug. By the time the "pushkey" or "phases" bundle2 part is applied, the phases have already been moved on a publishing repository. We fire the "pushkey" hook regardless, even though it would be a no-op. This is the part that feels the most buggy.
Sun, 18 Feb 2018 10:00:34 -0800 tests: consolidate test-push-http.t and test-push-http-bundle1.t stable
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Feb 2018 10:00:34 -0800] rev 35826
tests: consolidate test-push-http.t and test-push-http-bundle1.t These tests were initially copies of each other. Now that we have #testcases support in .t tests, we can consolidate them. The changes to test-push-http.t reflect the differences between that file and test-push-http-bundle1.t. The variances in phases push behavior are the biggest differences. The test will be updated in a subsequent commit to make the differences more clear and to expand test coverage. For now, let's just port the differences verbatim to get the tests consolidated.
(0) -30000 -10000 -3000 -1000 -300 -100 -50 -30 +30 +50 +100 +300 +1000 +3000 +10000 tip