Convert any backward slashes from path given by client

Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
This commit is contained in:
Vladimir Diaz 2018-04-23 11:04:50 -04:00
parent fe54935b29
commit ff183fc053
No known key found for this signature in database
GPG key ID: 5DEE9B97B0E2289A

View file

@ -2629,6 +2629,8 @@ def get_one_valid_targetinfo(self, target_filepath):
# Raise 'securesystemslib.exceptions.FormatError' if there is a mismatch.
securesystemslib.formats.RELPATH_SCHEMA.check_match(target_filepath)
target_filepath = target_filepath.replace('\\', '/')
if target_filepath.startswith('/'):
raise tuf.exceptions.FormatError('The requested target file cannot'
' contain a leading path separator: ' + repr(target_filepath))