Skip to content

Commit 206c4b0

Browse files
Biases entries (#416)
* Biases entries * Update vulnerability-rating-taxonomy.json * * Fixing Indentation in JSONs * Fixing cvss_v3 file * Adding secure-code-warrior-links.json * * Fixing mixup of entries in remediation_advice.json * Adding CVSS Fix * Modifying tests and Python Upgrade * Reverting changes * Fixing CWE Mapping in JSON --------- Co-authored-by: Abhinav Nain <[email protected]>
1 parent c39d933 commit 206c4b0

File tree

9 files changed

+474
-142
lines changed

9 files changed

+474
-142
lines changed

.github/workflows/validate_artifacts.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v1
19-
- name: Set up Python 3.7
19+
- name: Set up Python 3.11
2020
uses: actions/setup-python@v1
2121
with:
22-
python-version: 3.7
22+
python-version: 3.11
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip

.github/workflows/validate_vrt.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99

1010
steps:
1111
- uses: actions/checkout@v1
12-
- name: Set up Python 3.7
12+
- name: Set up Python 3.11
1313
uses: actions/setup-python@v1
1414
with:
15-
python-version: 3.7
15+
python-version: 3.11
1616
- name: Install dependencies
1717
run: |
1818
python -m pip install --upgrade pip

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
FROM python:3.6
2-
3-
RUN pip install jsonschema GitPython semantic_version
1+
FROM python:3.11
42

53
WORKDIR /tmp/vrt
4+
ADD . /tmp/vrt
5+
6+
RUN pip install -r lib/requirements.txt
7+
68
CMD [ "python3", "-B" , "./lib/validate_vrt.py" ]

lib/tests/test_vrt.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
class TestVrt(unittest.TestCase):
99
def setUp(self):
10+
print("\n`---{}---`".format(self._testMethodName))
11+
self.vrt = utils.get_json(utils.VRT_FILENAME)
1012
self.mappings = [
1113
{ 'filename': f, 'name': os.path.splitext(os.path.basename(f))[0] }
1214
for f in glob.glob(utils.MAPPING_DIR + '/**/*.json', recursive=True) if 'schema' not in f
@@ -43,19 +45,22 @@ def test_mapping_schemas(self):
4345
self.validate_schema(schema_file, mapping['filename'])
4446

4547
def all_vrt_ids_have_mapping(self, mappping_filename, key):
46-
vrt = utils.get_json(utils.VRT_FILENAME)
4748
mapping = utils.get_json(mappping_filename)
4849
keyed_mapping = utils.key_by_id(mapping['content'])
49-
for vrt_id_list in utils.all_id_lists(vrt, include_internal=False):
50-
self.assertTrue(utils.has_mapping(keyed_mapping, vrt_id_list, key),
51-
'no ' + key + ' mapping for ' + '.'.join(vrt_id_list))
50+
for vrt_id_list in utils.all_id_lists(self.vrt, include_internal=False):
51+
result = utils.has_mapping(keyed_mapping, vrt_id_list, key)
52+
if key == 'cwe' and not result:
53+
print('WARNING: no ' + key + ' mapping for ' + '.'.join(vrt_id_list))
54+
else:
55+
self.assertTrue(utils.has_mapping(keyed_mapping, vrt_id_list, key),
56+
'no ' + key + ' mapping for ' + '.'.join(vrt_id_list))
5257

5358
def test_all_vrt_ids_have_all_mappings(self):
5459
for mapping in self.mappings:
5560
self.all_vrt_ids_have_mapping(mapping['filename'], mapping['name'])
5661

5762
def only_map_valid_ids(self, mapping_filename):
58-
vrt_ids = utils.all_id_lists(utils.get_json(utils.VRT_FILENAME))
63+
vrt_ids = utils.all_id_lists(self.vrt)
5964
mapping_ids = utils.all_id_lists(utils.get_json(mapping_filename))
6065
for id_list in mapping_ids:
6166
self.assertIn(id_list, vrt_ids, 'invalid id in ' + mapping_filename + ' - ' + '.'.join(id_list))

mappings/cvss_v3/cvss_v3.json

Lines changed: 131 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,63 @@
447447
}
448448
]
449449
},
450+
{
451+
"id": "data_biases",
452+
"children": [
453+
{
454+
"id": "representation_bias",
455+
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N"
456+
},
457+
{
458+
"id": "pre_existing_bias",
459+
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N"
460+
}
461+
]
462+
},
463+
{
464+
"id": "algorithmic_biases",
465+
"children": [
466+
{
467+
"id": "processing_bias",
468+
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N"
469+
},
470+
{
471+
"id": "aggregation_bias",
472+
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N"
473+
}
474+
]
475+
},
476+
{
477+
"id": "societal_biases",
478+
"children": [
479+
{
480+
"id": "confirmation_bias",
481+
"cvss_v3": "AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N"
482+
},
483+
{
484+
"id": "systemic_bias",
485+
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N"
486+
}
487+
]
488+
},
489+
{
490+
"id": "misinterpretation_biases",
491+
"children": [
492+
{
493+
"id": "context_ignorance",
494+
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
495+
}
496+
]
497+
},
498+
{
499+
"id": "developer_biases",
500+
"children": [
501+
{
502+
"id": "implicit_bias",
503+
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:N/A:N"
504+
}
505+
]
506+
},
450507
{
451508
"id": "sensitive_data_exposure",
452509
"children": [
@@ -828,31 +885,31 @@
828885
]
829886
},
830887
{
831-
"id": "physical_security_issues",
832-
"children": [
833-
{
834-
"id": "bypass_of_physical_access_control",
835-
"cvss_v3": "AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:L"
836-
},
837-
{
838-
"id": "weakness_in_physical_access_control",
839-
"children": [
840-
{
841-
"id": "cloneable_key",
842-
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N"
843-
},
844-
{
845-
"id": "master_key_identification",
846-
"cvss_v3": "AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:L"
847-
},
848-
{
849-
"id": "commonly_keyed_system",
850-
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N"
851-
}
852-
]
853-
}
854-
]
855-
},
888+
"id": "physical_security_issues",
889+
"children": [
890+
{
891+
"id": "bypass_of_physical_access_control",
892+
"cvss_v3": "AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:L"
893+
},
894+
{
895+
"id": "weakness_in_physical_access_control",
896+
"children": [
897+
{
898+
"id": "cloneable_key",
899+
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N"
900+
},
901+
{
902+
"id": "master_key_identification",
903+
"cvss_v3": "AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:N/A:L"
904+
},
905+
{
906+
"id": "commonly_keyed_system",
907+
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N"
908+
}
909+
]
910+
}
911+
]
912+
},
856913
{
857914
"id": "insecure_os_firmware",
858915
"children": [
@@ -873,7 +930,7 @@
873930
}
874931
]
875932
},
876-
{
933+
{
877934
"id": "weakness_in_firmware_updates",
878935
"children": [
879936
{
@@ -889,54 +946,54 @@
889946
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
890947
}
891948
]
892-
},
893-
{
894-
"id": "kiosk_escape_or_breakout",
895-
"cvss_v3": "AV:P/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L"
896-
},
897-
{
898-
"id": "poorly_configured_disk_encryption",
899-
"cvss_v3": "AV:P/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
900-
},
901-
{
902-
"id": "shared_credentials_on_storage",
903-
"cvss_v3": "AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
904-
},
905-
{
906-
"id": "over_permissioned_credentials_on_storage",
907-
"cvss_v3": "AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
908-
},
909-
{
910-
"id": "local_administrator_on_default_environment",
911-
"cvss_v3": "AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
912-
},
913-
{
914-
"id": "poorly_configured_operating_system_security",
915-
"cvss_v3": "AV:L/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L"
916-
},
917-
{
918-
"id": "recovery_of_disk_contains_sensitive_material",
919-
"cvss_v3": "AV:P/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
920-
},
921-
{
922-
"id": "failure_to_remove_sensitive_artifacts_from_disk",
923-
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
924-
},
925-
{
926-
"id": "data_not_encrypted_at_rest",
927-
"children": [
928-
{
929-
"id": "non_sensitive",
930-
"cvss_v3": "AV:P/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N"
931-
},
932-
{
933-
"id": "sensitive",
934-
"cvss_v3": "AV:P/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
935-
}
936-
]
937-
}
938-
]
939-
},
949+
},
950+
{
951+
"id": "kiosk_escape_or_breakout",
952+
"cvss_v3": "AV:P/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L"
953+
},
954+
{
955+
"id": "poorly_configured_disk_encryption",
956+
"cvss_v3": "AV:P/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
957+
},
958+
{
959+
"id": "shared_credentials_on_storage",
960+
"cvss_v3": "AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
961+
},
962+
{
963+
"id": "over_permissioned_credentials_on_storage",
964+
"cvss_v3": "AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
965+
},
966+
{
967+
"id": "local_administrator_on_default_environment",
968+
"cvss_v3": "AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
969+
},
970+
{
971+
"id": "poorly_configured_operating_system_security",
972+
"cvss_v3": "AV:L/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L"
973+
},
974+
{
975+
"id": "recovery_of_disk_contains_sensitive_material",
976+
"cvss_v3": "AV:P/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
977+
},
978+
{
979+
"id": "failure_to_remove_sensitive_artifacts_from_disk",
980+
"cvss_v3": "AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
981+
},
982+
{
983+
"id": "data_not_encrypted_at_rest",
984+
"children": [
985+
{
986+
"id": "non_sensitive",
987+
"cvss_v3": "AV:P/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N"
988+
},
989+
{
990+
"id": "sensitive",
991+
"cvss_v3": "AV:P/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
992+
}
993+
]
994+
}
995+
]
996+
},
940997
{
941998
"id": "cryptographic_weakness",
942999
"children": [

mappings/cwe/cwe.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,68 @@
751751
{
752752
"id": "indicators_of_compromise",
753753
"cwe": null
754+
},
755+
{
756+
"id": "data_biases",
757+
"cwe": null,
758+
"children": [
759+
{
760+
"id": "representation_bias",
761+
"cwe": null
762+
},
763+
{
764+
"id": "pre_existing_bias",
765+
"cwe": null
766+
}
767+
]
768+
},
769+
{
770+
"id": "algorithmic_biases",
771+
"cwe": null,
772+
"children": [
773+
{
774+
"id": "processing_bias",
775+
"cwe": null
776+
},
777+
{
778+
"id": "aggregation_bias",
779+
"cwe": null
780+
}
781+
]
782+
},
783+
{
784+
"id": "societal_biases",
785+
"cwe": null,
786+
"children": [
787+
{
788+
"id": "confirmation_bias",
789+
"cwe": null
790+
},
791+
{
792+
"id": "systemic_bias",
793+
"cwe": null
794+
}
795+
]
796+
},
797+
{
798+
"id": "misinterpretation_biases",
799+
"cwe": null,
800+
"children": [
801+
{
802+
"id": "context_ignorance",
803+
"cwe": null
804+
}
805+
]
806+
},
807+
{
808+
"id": "developer_biases",
809+
"cwe": null,
810+
"children": [
811+
{
812+
"id": "implicit_bias",
813+
"cwe": null
814+
}
815+
]
754816
}
755817
]
756818
}

0 commit comments

Comments
 (0)