From 4e44dd3d8f5398aa73ae4545ac1dac6c5f32cc30 Mon Sep 17 00:00:00 2001 From: sayali Date: Thu, 29 Oct 2020 17:57:54 -0700 Subject: [PATCH 1/3] Check if authority options is JSON Array --- lemur/authorities/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lemur/authorities/models.py b/lemur/authorities/models.py index f042f773..61ab779e 100644 --- a/lemur/authorities/models.py +++ b/lemur/authorities/models.py @@ -93,9 +93,11 @@ class Authority(db.Model): if not self.options: return None - for option in json.loads(self.options): - if "name" in option and option["name"] == 'cab_compliant': - return option["value"] + options_array = json.loads(self.options) + if isinstance(options_array, list): + for option in options_array: + if "name" in option and option["name"] == 'cab_compliant': + return option["value"] return None From aec24ae132d2bbd14f78474735b7800d3954d865 Mon Sep 17 00:00:00 2001 From: sayali Date: Thu, 29 Oct 2020 17:58:37 -0700 Subject: [PATCH 2/3] Missing commit in downgrade --- lemur/migrations/versions/c301c59688d2_.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lemur/migrations/versions/c301c59688d2_.py b/lemur/migrations/versions/c301c59688d2_.py index 4da91b7b..c4213f49 100644 --- a/lemur/migrations/versions/c301c59688d2_.py +++ b/lemur/migrations/versions/c301c59688d2_.py @@ -74,6 +74,7 @@ def downgrade(): "update certificates set key_type=null where not_after > CURRENT_DATE - 32" ) op.execute(stmt) + commit() """ From 03dfbf535d4e21370235686b994081928167f32e Mon Sep 17 00:00:00 2001 From: sayali Date: Thu, 29 Oct 2020 17:59:31 -0700 Subject: [PATCH 3/3] Consistent algo in UI and API Removed '-' since UI displays only handful options --- .../app/angular/authorities/authority/options.tpl.html | 8 +------- .../app/angular/certificates/certificate/options.tpl.html | 7 +------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/lemur/static/app/angular/authorities/authority/options.tpl.html b/lemur/static/app/angular/authorities/authority/options.tpl.html index adf8eacc..91cf9953 100644 --- a/lemur/static/app/angular/authorities/authority/options.tpl.html +++ b/lemur/static/app/angular/authorities/authority/options.tpl.html @@ -21,13 +21,7 @@
diff --git a/lemur/static/app/angular/certificates/certificate/options.tpl.html b/lemur/static/app/angular/certificates/certificate/options.tpl.html index 11b8fe68..2f28a4de 100644 --- a/lemur/static/app/angular/certificates/certificate/options.tpl.html +++ b/lemur/static/app/angular/certificates/certificate/options.tpl.html @@ -32,12 +32,7 @@