verifyChecksum fails for non-output files

PR #967 introduced another error. Before verifyChecksum was used only
from kojikamid and it made sense, that it failed on other files. Now it
is used also for build requires, etc. As it makes no harm (read-only),
we can extend this check for other paths.

Fixes: https://pagure.io/koji/issue/1669
This commit is contained in:
Tomas Kopecek 2019-09-30 16:14:03 +02:00
parent 6c97ff4309
commit 46f85c9b86

View file

@ -760,7 +760,8 @@ class VMExecTask(BaseTaskHandler):
def verifyChecksum(self, path, checksum, algo='sha1'):
local_path = os.path.abspath(os.path.join(self.output_dir, path))
if not local_path.startswith(self.output_dir):
if not local_path.startswith(self.output_dir) and \
not local_path.startswith(self.buildreq_dir):
raise koji.BuildError('invalid path: %s' % path)
if not os.path.isfile(local_path):
raise koji.BuildError('%s does not exist' % local_path)