From 83d4447570dc4cc24caf10f59ba9edc59cffc2e5 Mon Sep 17 00:00:00 2001 From: Carlos Holguera Date: Fri, 2 Feb 2024 12:11:36 +0100 Subject: [PATCH 1/2] add masvs v1 IDs to tests table --- src/scripts/populate_dynamic_pages.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/scripts/populate_dynamic_pages.py b/src/scripts/populate_dynamic_pages.py index 052cf4c986..023ce315a5 100644 --- a/src/scripts/populate_dynamic_pages.py +++ b/src/scripts/populate_dynamic_pages.py @@ -78,7 +78,7 @@ def reorder_dict_keys(original_dict, key_order): # tests/index.md -column_titles = {'id': 'ID', 'title': 'Name', 'masvs_v2_id': "MASVS ID", 'last_updated': 'Last Updated'} #'id': 'ID', ... , 'refs': 'Refs', 'techniques': 'Techniques' +column_titles = {'id': 'ID', 'title': 'Name', 'masvs_v2_id': "MASVS v2 ID", 'masvs_v1_id': "MASVS v1 IDs", 'last_updated': 'Last Updated'} #'id': 'ID', ... , 'refs': 'Refs', 'techniques': 'Techniques' tests = get_mastg_components_dict("docs/MASTG/tests") test_types = ["android", "ios"] @@ -87,6 +87,8 @@ def reorder_dict_keys(original_dict, key_order): tests_of_type = [reorder_dict_keys(test, column_titles.keys()) for test in tests if test['platform'] == test_type] for test in tests_of_type: test['masvs_v2_id'] = test['masvs_v2_id'][0] + if test.get(masvs_v1_id): + test['masvs_v1_id'] = "\n".join([f"{v1_id}" for v1_id in test['masvs_v1_id']]) for group_id, checklist in CHECKLIST_DICT.items(): From ac23334aee54577dfc3e107f58c201c4b2dded7b Mon Sep 17 00:00:00 2001 From: Carlos Holguera Date: Fri, 2 Feb 2024 13:20:21 +0100 Subject: [PATCH 2/2] Refactor column_titles and masvs_v1_id formatting in populate_dynamic_pages.py --- src/scripts/populate_dynamic_pages.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scripts/populate_dynamic_pages.py b/src/scripts/populate_dynamic_pages.py index 023ce315a5..b37ab3b600 100644 --- a/src/scripts/populate_dynamic_pages.py +++ b/src/scripts/populate_dynamic_pages.py @@ -78,7 +78,7 @@ def reorder_dict_keys(original_dict, key_order): # tests/index.md -column_titles = {'id': 'ID', 'title': 'Name', 'masvs_v2_id': "MASVS v2 ID", 'masvs_v1_id': "MASVS v1 IDs", 'last_updated': 'Last Updated'} #'id': 'ID', ... , 'refs': 'Refs', 'techniques': 'Techniques' +column_titles = {'id': 'ID', 'title': 'Name', 'masvs_v2_id': "MASVS v2 ID", 'masvs_v1_id': "MASVS v1 IDs"} #'id': 'ID', ... , 'refs': 'Refs', 'techniques': 'Techniques', 'last_updated': 'Last Updated' tests = get_mastg_components_dict("docs/MASTG/tests") test_types = ["android", "ios"] @@ -87,8 +87,8 @@ def reorder_dict_keys(original_dict, key_order): tests_of_type = [reorder_dict_keys(test, column_titles.keys()) for test in tests if test['platform'] == test_type] for test in tests_of_type: test['masvs_v2_id'] = test['masvs_v2_id'][0] - if test.get(masvs_v1_id): - test['masvs_v1_id'] = "\n".join([f"{v1_id}" for v1_id in test['masvs_v1_id']]) + if test.get("masvs_v1_id"): + test['masvs_v1_id'] = "
".join([f"{v1_id}" for v1_id in test['masvs_v1_id']]) for group_id, checklist in CHECKLIST_DICT.items():