From e6a202f790daaf204513b8c53b824fcc246f9972 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 2 Aug 2019 15:57:57 -0400 Subject: project: add basic path checks for & Reject paths in & that try to use symlinks or non-file or non-dirs. We don't fully validate when src is a glob as it's a bit complicated -- any component in the src could be the glob. We make sure the destination is a directory, and that any paths in that dir are created as symlinks. So while this can be used to read any path, it can't be abused to write to any paths. Bug: https://crbug.com/gerrit/11218 Change-Id: I68b6d789b5ca4e43f569e75e8b293b3e13d3224b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/233074 Tested-by: Mike Frysinger Reviewed-by: Mike Frysinger Reviewed-by: Michael Mortensen --- manifest_xml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifest_xml.py') diff --git a/manifest_xml.py b/manifest_xml.py index 69105c9e..4f7bd498 100644 --- a/manifest_xml.py +++ b/manifest_xml.py @@ -1026,7 +1026,7 @@ class XmlManifest(object): # dest is relative to the top of the tree. # We only validate paths if we actually plan to process them. self._ValidateFilePaths('copyfile', src, dest) - project.AddCopyFile(src, dest, os.path.join(self.topdir, dest)) + project.AddCopyFile(src, dest, self.topdir) def _ParseLinkFile(self, project, node): src = self._reqatt(node, 'src') @@ -1036,7 +1036,7 @@ class XmlManifest(object): # dest is relative to the top of the tree. # We only validate paths if we actually plan to process them. self._ValidateFilePaths('linkfile', src, dest) - project.AddLinkFile(src, dest, os.path.join(self.topdir, dest)) + project.AddLinkFile(src, dest, self.topdir) def _ParseAnnotation(self, project, node): name = self._reqatt(node, 'name') -- cgit v1.2.3-54-g00ecf