Skip to content

Commit

Permalink
Merge pull request #554 from vyos/mergify/bp/sagitta/pr-553
Browse files Browse the repository at this point in the history
T6173: validate allowed characters in ISO image name (backport #553)
  • Loading branch information
c-po authored Apr 11, 2024
2 parents 3799b5c + 938d781 commit a1c0443
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/build-vyos-image
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import platform
import argparse
import datetime
import functools
import string

import json

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a1c0443

Please sign in to comment.