diff hgext/narrow/narrowwirepeer.py @ 49241:6b10151b9621 stable 6.1.3

narrow_widen_acl: enforce narrowacl in narrow_widen (SEC) Reviewer note: this was sent by the author as a simple bugfix, but can be considered a security patch, since it allows users to access things outside of the ACL, hence the (SEC) prefix. However, this affects the `narrow` extention which is still marked as experimental and has relatively few users aside from large companies with their own security layers on top from what we can gather. We feel (Alphare: or at least, I feel) like pinging the packaging list is enough in this case.
author Sandu Turcan <idlsoft@gmail.com>
date Tue, 03 May 2022 21:44:30 -0400
parents 89a2afe31e82
children cd51d4957b28
line wrap: on
line diff
--- a/hgext/narrow/narrowwirepeer.py	Mon May 30 11:52:31 2022 +0200
+++ b/hgext/narrow/narrowwirepeer.py	Tue May 03 21:44:30 2022 -0400
@@ -10,6 +10,7 @@
 from mercurial import (
     bundle2,
     error,
+    exchange,
     extensions,
     hg,
     narrowspec,
@@ -86,6 +87,11 @@
         newincludes = splitpaths(newincludes)
         oldexcludes = splitpaths(oldexcludes)
         newexcludes = splitpaths(newexcludes)
+
+        # enforce narrow acl if set
+        if repo.ui.has_section(exchange._NARROWACL_SECTION):
+            exchange.applynarrowacl(repo, {'includepats': newincludes})
+
         # validate the patterns
         narrowspec.validatepatterns(set(oldincludes))
         narrowspec.validatepatterns(set(newincludes))