Skip to content

Commit

Permalink
T6173: validate allowed characters in ISO image name
Browse files Browse the repository at this point in the history
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 611cfc8)
  • Loading branch information
c-po authored and mergify[bot] committed Apr 10, 2024
1 parent 3799b5c commit 938d781
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 938d781

Please sign in to comment.