Skip to content

Commit

Permalink
reposync: check for .. in remote paths. BZ 1506205
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnks committed Jun 22, 2018
1 parent 1814b65 commit 3710cd8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions reposync.py
Expand Up @@ -216,6 +216,19 @@ def main():
else:
local_repo_path = opts.destdir + '/' + repo.id

# Check for ".." in remote paths and drop such packages (these are
# dangerous when constructing the local paths)
newlist = []
for pkg in download_list:
remote = pkg.returnSimple('relativepath')
local = os.path.realpath(local_repo_path + '/' + remote)
if not local.startswith(local_repo_path):
my.logger.warning("Warning: Remote path of package %s contains "
"dangerous symbol .., skipping" % pkg)
continue
newlist.append(pkg)
download_list = newlist

if opts.delete and os.path.exists(local_repo_path):
current_pkgs = localpkgs(local_repo_path)

Expand Down

0 comments on commit 3710cd8

Please sign in to comment.