Skip to content

Commit

Permalink
[Build] Add a space character to separate the url and hash value
Browse files Browse the repository at this point in the history
  • Loading branch information
xumia committed Mar 11, 2023
1 parent 9e7b038 commit 438a152
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion scripts/versions_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import glob
import os
import sys
from urllib.parse import urlparse
from urllib.parse import parse_qs

ALL_DIST = 'all'
ALL_ARCH = 'all'
Expand Down Expand Up @@ -70,7 +72,21 @@ def dump(self, config=False, priority=999):
lines = 'Package: {0}\nPin: version {1}\nPin-Priority: {2}\n\n'.format(package, self.versions[package], priority)
result.append(lines)
else:
result.append('{0}=={1}'.format(package, self.versions[package]))
separator="=="
if self.ctype == "web":
parsed_url = urlparse(package)
query = parse_qs(parsed_url.query)
sp = query.get('sp')
if '.blob.core.' in package and sp:
if len(sp) > 1:
continue
elif len(sp) == 1 and sp[0] != 'r' and sp[0] != 'rl':
# Skip the url if it is high privilege
continue
elif package.endswith('&sp=r') or package.endswith('&sp=rl'):
# Add a space character to separate the storage SAS key to pass Cred Scan
separator = ' =='
result.append('{0}{1}{2}'.format(package, separator, self.versions[package]))
return "\n".join(result)

def dump_to_file(self, version_file, config=False, priority=999):
Expand Down

0 comments on commit 438a152

Please sign in to comment.