[PATCH 6 of 6] vfs: also audit rename

Boris Feld boris.feld at octobus.net
Mon Nov 26 18:22:48 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1498961267 -7200
#      Sun Jul 02 04:07:47 2017 +0200
# Node ID afdc73b20bd1faeec1b278ef0a2ab8d1dda71eb8
# Parent  cc7d970d99eb242dbe2d8e792a9212aabd06911f
# EXP-Topic vfs.audit-rename
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r afdc73b20bd1
vfs: also audit rename

Renaming through the vfs is not used in many places, and none of them seems to
be at security risk.

However it is still worthwhile to run the auditing on rename file to perform
developer-warning level checks.

diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -436,6 +436,10 @@ class vfs(abstractvfs):
 
         return fp
 
+    def rename(self, src, dst, *args, **kwargs):
+        self._auditpath(dst, 'w')
+        return super(vfs, self).rename(src, dst, *args, **kwargs)
+
     def symlink(self, src, dst):
         self.audit(dst)
         linkname = self.join(dst)



More information about the Mercurial-devel mailing list