From 5b8f62a16cd42b5b81a5d164b1c93cf1cf400c3b Mon Sep 17 00:00:00 2001 From: j3s Date: Sun, 17 May 2020 14:19:10 -0500 Subject: [PATCH 1/2] Correct regex with non-wildcard, always check name --- capsulflask/console.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/capsulflask/console.py b/capsulflask/console.py index 0b2e89d..80d2354 100644 --- a/capsulflask/console.py +++ b/capsulflask/console.py @@ -201,7 +201,7 @@ def create(): @account_required def ssh_public_keys(): errors = list() - + if request.method == "POST": method = request.form["method"] content = None @@ -216,7 +216,7 @@ def ssh_public_keys(): name = parts[0] else: errors.append("Name is required") - elif not re.match(r"^[0-9A-Za-z_@. -]+$", name): + if not re.match(r"^[0-9A-Za-z_@\. -]+$", name): errors.append("Name must match \"^[0-9A-Za-z_@. -]+$\"") if method == "POST": @@ -225,7 +225,7 @@ def ssh_public_keys(): errors.append("Content is required") else: content = content.replace("\r", "").replace("\n", "") - if not re.match(r"^(ssh|ecdsa)-[0-9A-Za-z+/_=@. -]+$", content): + if not re.match(r"^(ssh|ecdsa)-[0-9A-Za-z+/_=@\. -]+$", content): errors.append("Content must match \"^(ssh|ecdsa)-[0-9A-Za-z+/_=@. -]+$\"") if get_model().ssh_public_key_name_exists(session["account"], name): @@ -325,4 +325,4 @@ def account_balance(): )), has_payments=len(payments)>0, account_balance=format(balance_now, '.2f') - ) \ No newline at end of file + ) From 36fa867002de0cb5edefa628ea64ad959f06e39e Mon Sep 17 00:00:00 2001 From: j3s Date: Tue, 19 May 2020 22:21:08 -0500 Subject: [PATCH 2/2] Add OpenBSD 6.7 migrate scripts --- capsulflask/schema_migrations/03_down_openbsd67.sql | 3 +++ capsulflask/schema_migrations/03_up_openbsd67.sql | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 capsulflask/schema_migrations/03_down_openbsd67.sql create mode 100644 capsulflask/schema_migrations/03_up_openbsd67.sql diff --git a/capsulflask/schema_migrations/03_down_openbsd67.sql b/capsulflask/schema_migrations/03_down_openbsd67.sql new file mode 100644 index 0000000..b447d4e --- /dev/null +++ b/capsulflask/schema_migrations/03_down_openbsd67.sql @@ -0,0 +1,3 @@ +UPDATE os_images SET id = 'openbsd66' WHERE id = 'openbsd67' +UPDATE os_images SET template_image_file_name = 'openbsd-cloud-2020-05.qcow2' WHERE id = 'openbsd66' +UPDATE os_images SET description = 'OpenBSD 6.6' WHERE id = 'openbsd66' diff --git a/capsulflask/schema_migrations/03_up_openbsd67.sql b/capsulflask/schema_migrations/03_up_openbsd67.sql new file mode 100644 index 0000000..078dd5b --- /dev/null +++ b/capsulflask/schema_migrations/03_up_openbsd67.sql @@ -0,0 +1,3 @@ +UPDATE os_images SET id = 'openbsd67' WHERE id = 'openbsd66' +UPDATE os_images SET template_image_file_name = 'openbsd-6.7-x86_64.qcow2' WHERE id = 'openbsd67' +UPDATE os_images SET description = 'OpenBSD 6.7' WHERE id = 'openbsd67'