From 438a15272ad7d528d20779abf88ac418aab6dd7f Mon Sep 17 00:00:00 2001 From: xumia Date: Sat, 11 Mar 2023 03:00:56 +0000 Subject: [PATCH] [Build] Add a space character to separate the url and hash value --- scripts/versions_manager.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/versions_manager.py b/scripts/versions_manager.py index a20684e97bb4..7869f838e1c7 100755 --- a/scripts/versions_manager.py +++ b/scripts/versions_manager.py @@ -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' @@ -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):