summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-04-08 20:42:46 +0200
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-04-10 14:37:32 +0000
commit938d781f4033dc84479cbcd9cdbb6e2240bc7512 (patch)
treec3c213054ddcd00ac9609e787bebe20b7620ca84 /scripts
parent3799b5c7698d7ef52ee7695f63a9252f7e0519ab (diff)
downloadvyos-build-938d781f4033dc84479cbcd9cdbb6e2240bc7512.tar.gz
vyos-build-938d781f4033dc84479cbcd9cdbb6e2240bc7512.zip
T6173: validate allowed characters in ISO image name
Building custom VyOS version: 1.5-asdf%-202404081841 I: Checking if packages required for VyOS image build are installed Version contained illegal character(s), allowed: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-+ (cherry picked from commit 611cfc85c531f6b6c55f89503d6d2cdf84213317)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-vyos-image8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/build-vyos-image b/scripts/build-vyos-image
index d26c8a65..716a4cde 100755
--- a/scripts/build-vyos-image
+++ b/scripts/build-vyos-image
@@ -28,6 +28,7 @@ import platform
import argparse
import datetime
import functools
+import string
import json
@@ -205,6 +206,13 @@ if __name__ == "__main__":
print("Use --build-type=release option if you want to set version number")
sys.exit(1)
+ # Validate characters in version name
+ if 'version' in args:
+ allowed = string.ascii_letters + string.digits + '.' + '-' + '+'
+ if not set(args['version']) <= set(allowed):
+ print(f'Version contained illegal character(s), allowed: {allowed}')
+ sys.exit(1)
+
## Inject some useful hardcoded options
args['build_dir'] = defaults.BUILD_DIR
args['pbuilder_config'] = os.path.join(defaults.BUILD_DIR, defaults.PBUILDER_CONFIG)