summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-04-10 16:36:46 +0200
committerGitHub <noreply@github.com>2024-04-10 16:36:46 +0200
commita9cc581827e9a0ba1646b16ed07170e4ec2ca34e (patch)
treec6028505468751bb494a3aa72f8becc26866dae8 /scripts
parentf32d9fa78b8ccb3d0fb48d6c811ae57e8ed93015 (diff)
parent611cfc85c531f6b6c55f89503d6d2cdf84213317 (diff)
downloadvyos-build-a9cc581827e9a0ba1646b16ed07170e4ec2ca34e.tar.gz
vyos-build-a9cc581827e9a0ba1646b16ed07170e4ec2ca34e.zip
Merge pull request #553 from c-po/T6173
T6173: validate allowed characters in ISO image name
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/image-build/build-vyos-image8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/image-build/build-vyos-image b/scripts/image-build/build-vyos-image
index 250a1d2c..3b265a01 100755
--- a/scripts/image-build/build-vyos-image
+++ b/scripts/image-build/build-vyos-image
@@ -28,6 +28,7 @@ import platform
import argparse
import datetime
import functools
+import string
import json
@@ -227,6 +228,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)