Skip to content

Commit

Permalink
Add missing start-of-string anchor to regexps.
Browse files Browse the repository at this point in the history
  • Loading branch information
gareth-palmer committed Nov 5, 2020
1 parent f3cecf3 commit f519f9d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def before_request():
device_name = request.args.get('devicename', '')

# check that the device name is valid
if not re.search(r'(?x) SEP [0-9A-F]{12} $', device_name) or \
if not re.search(r'(?x) ^ SEP [0-9A-F]{12} $', device_name) or \
not os.path.exists(f'{config.tftpboot_dir}/{device_name}.cnf.xml'):
return Response('ERROR'), 403

Expand Down
2 changes: 1 addition & 1 deletion problem_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def problem_report():
def before_request():
device_name = request.form.get('devicename', '')

if not re.search(r'(?x) SEP [0-9A-F]{12} $', device_name) or \
if not re.search(r'(?x) ^ SEP [0-9A-F]{12} $', device_name) or \
not os.path.exists(f'{config.tftpboot_dir}/{device_name}.cnf.xml'):
return Response('Invalid device', mimetype = 'text/plain'), 403

Expand Down

0 comments on commit f519f9d

Please sign in to comment.