Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/pyjson #339

Closed
wants to merge 57 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
774066c
add decision point, options, group implementations
ahouseholder Sep 20, 2023
fb41121
add base classes
ahouseholder Sep 20, 2023
b44a1a8
fix import (+27 squashed commits)
ahouseholder Sep 20, 2023
4fea25d
add decision point groups package, rearrange modules
ahouseholder Sep 20, 2023
ad2d9ff
add exploitation
ahouseholder Sep 21, 2023
3375011
add docstring
ahouseholder Sep 21, 2023
c1cb843
add technical impact, utility, virulence
ahouseholder Sep 21, 2023
0d4f8a7
add value density
ahouseholder Sep 21, 2023
9f8f0d5
add safety impact
ahouseholder Sep 21, 2023
7178885
add exposure
ahouseholder Sep 21, 2023
0bf5bea
add mission impact
ahouseholder Sep 21, 2023
8ece887
add patch developer and patch applier
ahouseholder Sep 21, 2023
9eb9887
refactor into modules
ahouseholder Sep 21, 2023
6567cf5
add ssvc2 changes
ahouseholder Sep 21, 2023
4dc6a56
condense patch applier and deployer
ahouseholder Sep 21, 2023
708d7d3
abstract out values, use tuples
ahouseholder Sep 21, 2023
9c03070
abstract out values, use tuples
ahouseholder Sep 21, 2023
142752e
drop aliases
ahouseholder Sep 21, 2023
61e09cd
add a nist and ossf criticality decision points
ahouseholder Sep 21, 2023
386039e
playing with generating docs
ahouseholder Sep 21, 2023
dc3bf34
uncenter column
ahouseholder Sep 21, 2023
2f29037
start adding table generator
ahouseholder Sep 21, 2023
07d145a
let's try generating tables
ahouseholder Sep 21, 2023
1f85978
undo aliases
ahouseholder Sep 21, 2023
8fb7249
make replace_in_list function
ahouseholder Sep 25, 2023
4a4bb47
add dirs to watch & change port
ahouseholder Sep 26, 2023
1e1a958
Merge branch 'main' of https://github.com/CERTCC/SSVC into feature/py…
ahouseholder Sep 27, 2023
d565ddb
new versions rebuild from scratch, add docstrings
ahouseholder Sep 27, 2023
c5a8e60
rebuild changes from scratch, add docstrings
ahouseholder Sep 27, 2023
e5ed54e
add docstrings
ahouseholder Sep 27, 2023
de90b32
don't use deepcopy, rebuild from scratch instead
ahouseholder Sep 27, 2023
bf795ae
Merge branch 'main' of https://github.com/CERTCC/SSVC into feature/py…
ahouseholder Sep 27, 2023
291af9c
we don't need replace in list anymore
ahouseholder Sep 27, 2023
1c24518
fix #319 make critical software decision point generic
ahouseholder Sep 27, 2023
a7a7ee0
test mixins
ahouseholder Sep 27, 2023
a254e9c
test base classes
ahouseholder Sep 28, 2023
57609f1
refactor out a _Keyed mixin
ahouseholder Oct 4, 2023
63a3ca1
drop key from dp_groups objects
ahouseholder Oct 4, 2023
99e7a4e
rename SsvcValue to SsvcDecisionPointValue to clarify what the object…
ahouseholder Oct 4, 2023
9fcdaa3
Update docstrings, move away from diff-based construction
ahouseholder Oct 4, 2023
54e5cbe
make decision point group a tuple not list
ahouseholder Oct 4, 2023
5881e85
make it easier to emit json and md tables from decision point groups
ahouseholder Oct 4, 2023
c7dc289
relocate tools
ahouseholder Oct 9, 2023
68b78d7
add High Value Asset decision point
ahouseholder Oct 9, 2023
52bf539
add pyproject.toml file
ahouseholder Oct 10, 2023
d1f4663
Merge commit '338cc456c9185339e98eaeaf8ceb34665867fb8a' into feature/…
ahouseholder Oct 10, 2023
4e67e02
make build work
ahouseholder Oct 10, 2023
83434f9
move analyzer to ssvc package
ahouseholder Oct 10, 2023
27e207e
add dataclasses-json to requirements
ahouseholder Oct 12, 2023
9c95b65
add new json schemas for decision points and dp groups
sei-vsarvepalli Oct 12, 2023
df02b13
Merge branch 'feature/new_json_schema' into feature/pyjson
ahouseholder Oct 12, 2023
d35c1d4
clean up example
ahouseholder Oct 12, 2023
f6d64a6
add optional comment field
ahouseholder Oct 12, 2023
30af5f8
use comment field in generated text
ahouseholder Oct 12, 2023
004c587
eliminate duplicates in get_all_decision_points_from
ahouseholder Oct 12, 2023
ffdbd31
add decision point registry for testing
ahouseholder Oct 12, 2023
31de409
add jsonschema to requirements
ahouseholder Oct 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make replace_in_list function
ahouseholder committed Sep 25, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 8fb72499b25dc2580e004db6fb2ffb8429259ba5
12 changes: 7 additions & 5 deletions src/ssvc/dp_groups/deployer.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
from ssvc.decision_points.utility import UTILITY_1_0_1
from ssvc.decision_points.value_density import VALUE_DENSITY_1
from ssvc.dp_groups.base import SsvcDecisionPointGroup

from ssvc.tools import replace_in_list

PATCH_APPLIER_1 = SsvcDecisionPointGroup(
name="SSVC Patch Applier",
@@ -43,8 +43,9 @@
DEPLOYER_2.key = "D"
DEPLOYER_2.version = "2.0.0"
# update exposure
DEPLOYER_2.decision_points.remove(SYSTEM_EXPOSURE_1)
DEPLOYER_2.decision_points.append(SYSTEM_EXPOSURE_1_0_1)
replace_in_list(
DEPLOYER_2.decision_points, old=SYSTEM_EXPOSURE_1, new=SYSTEM_EXPOSURE_1_0_1
)
# add UTILITY (AUTOMATABLE + VALUE DENSITY)
DEPLOYER_2.decision_points.append(UTILITY_1_0_1)
DEPLOYER_2.decision_points.append(AUTOMATABLE_1)
@@ -61,8 +62,9 @@
DEPLOYER_3.decision_points.remove(VALUE_DENSITY_1)

# update MISSION_IMPACT_1 to MISSION_IMPACT_2
DEPLOYER_3.decision_points.remove(MISSION_IMPACT_1)
DEPLOYER_3.decision_points.append(MISSION_IMPACT_2)
replace_in_list(
lst=DEPLOYER_3.decision_points, old=MISSION_IMPACT_1, new=MISSION_IMPACT_2
)


def main():
40 changes: 19 additions & 21 deletions src/ssvc/dp_groups/supplier.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python
'''
"""
file: supplier
author: adh
created_at: 9/21/23 11:41 AM
'''
"""
from copy import deepcopy

from ssvc.decision_points.automatable import AUTOMATABLE_1
@@ -15,35 +15,33 @@
from ssvc.decision_points.value_density import VALUE_DENSITY_1
from ssvc.decision_points.virulence import VIRULENCE_1
from ssvc.dp_groups.base import SsvcDecisionPointGroup


from ssvc.tools import replace_in_list

PATCH_DEVELOPER_1 = SsvcDecisionPointGroup(
name="SSVC Patch Developer",
description="The decision points used by the patch developer.",
key="PD",
version="1.0.0",
decision_points=[
EXPLOITATION_1,
UTILITY_1,
TECHNICAL_IMPACT_1,
VIRULENCE_1,
VALUE_DENSITY_1,
SAFETY_IMPACT_1,
],
name="SSVC Patch Developer",
description="The decision points used by the patch developer.",
key="PD",
version="1.0.0",
decision_points=[
EXPLOITATION_1,
UTILITY_1,
TECHNICAL_IMPACT_1,
VIRULENCE_1,
VALUE_DENSITY_1,
SAFETY_IMPACT_1,
],
)

# alias for forward compatibility
SUPPLIER_1 = PATCH_DEVELOPER_1

# SSVC v2 renamed to SSVC Supplier
SUPPLIER_2 = deepcopy(SUPPLIER_1)
SUPPLIER_2.name = "Supplier",
SUPPLIER_2.description = "The decision points used by the supplier.",
SUPPLIER_2.name = ("Supplier",)
SUPPLIER_2.description = ("The decision points used by the supplier.",)
SUPPLIER_2.version = "2.0.0"
# replace UTILITY 1 with UTILITY 1.0.1
SUPPLIER_2.decision_points.remove(UTILITY_1)
SUPPLIER_2.decision_points.append(UTILITY_1_0_1)
replace_in_list(SUPPLIER_2.decision_points, old=UTILITY_1, new=UTILITY_1_0_1)
# add PUBLIC_SAFETY_IMPACT_1
SUPPLIER_2.decision_points.append(PUBLIC_SAFETY_IMPACT_1)

@@ -53,5 +51,5 @@ def main():
print(SUPPLIER_2.to_json(indent=2))


if __name__ == '__main__':
if __name__ == "__main__":
main()
6 changes: 6 additions & 0 deletions src/ssvc/tools.py
Original file line number Diff line number Diff line change
@@ -22,3 +22,9 @@ def group_to_jsonfiles(group: SsvcDecisionPointGroup, path: str = ".") -> None:
print(f"Writing {table_fname}")
f.write(dp.to_table())
f.write("\n")


def replace_in_list(lst, old, new):
idx = lst.index(old)
lst[idx] = new
return lst