Skip to content

Commit 79e5989

Browse files
committed
Update CASE validation to 1.4.0 and add necessary API and example adjustments
A follow-on patch will regenerate Make-managed files. Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
1 parent 3019794 commit 79e5989

File tree

4 files changed

+46
-30
lines changed

4 files changed

+46
-30
lines changed

.github/workflows/ci.yml

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

4242
# Ensure that the example output is a valid CASE JSON-LD graph
4343
- name: CASE Export Validation
44-
uses: kchason/case-validation-action@v2.9.0
44+
uses: kchason/case-validation-action@v2.10.0
4545
with:
4646
case-path: ./
47-
case-version: "case-1.3.0"
47+
case-version: "case-1.4.0"
4848
extension-filter: "jsonld"
4949

5050
- name: Convert example

case_mapping/uco/action.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ def __init__(
4848
}
4949
)
5050
if action_status:
51-
self["uco-action:actionStatus"] = {
52-
"@type": "uco-vocabulary:ActionStatusTypeVocab",
53-
"@value": action_status,
54-
}
51+
self["uco-action:actionStatus"] = action_status
5552
self._datetime_vars(
5653
**{"uco-action:startTime": start_time, "uco-action:endTime": end_time}
5754
)

case_mapping/uco/observable.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -332,21 +332,15 @@ def __init__(
332332
self._bool_vars(**{"uco-observable:isEncrypted": is_encrypted})
333333

334334
if byte_order:
335-
self["uco-observable:byteOrder"] = {
336-
"@type": "uco-vocabulary:EndiannessTypeVocab",
337-
"@value": byte_order,
338-
}
335+
self["uco-observable:byteOrder"] = byte_order
339336

340337
if hash_method is not None or hash_value is not None or hash_value != "-":
341338
data: dict[str, Any] = {
342339
"@id": self.prefix_label + ":" + str(local_uuid()),
343340
"@type": "uco-types:Hash",
344341
}
345342
if hash_method is not None:
346-
data["uco-types:hashMethod"] = {
347-
"@type": "uco-vocabulary:HashNameVocab",
348-
"@value": hash_method,
349-
}
343+
data["uco-types:hashMethod"] = hash_method
350344
if hash_value is not None:
351345
data["uco-types:hashValue"] = {
352346
"@type": "xsd:hexBinary",
@@ -1300,17 +1294,39 @@ def __init__(
13001294
)
13011295

13021296

1297+
class SoftwareFacet(Facet):
1298+
def __init__(
1299+
self,
1300+
*args: Any,
1301+
manufacturer: Optional[Identity] = None,
1302+
version: Optional[str] = None,
1303+
**kwargs: Any,
1304+
) -> None:
1305+
super().__init__()
1306+
1307+
self["@type"] = "uco-observable:SoftwareFacet"
1308+
1309+
self._str_vars(
1310+
**{
1311+
"uco-observable:version": version,
1312+
}
1313+
)
1314+
self._node_reference_vars(
1315+
**{
1316+
"uco-observable:manufacturer": manufacturer,
1317+
}
1318+
)
1319+
1320+
13031321
class OperatingSystemFacet(Facet):
13041322
def __init__(
13051323
self,
13061324
*args: Any,
13071325
os_advertisingID: Optional[str] = None,
13081326
os_bitness: Optional[str] = None,
1327+
os_environment_variables: Union[None, Dict, Dictionary] = None,
13091328
os_install_date: Optional[datetime] = None,
13101329
os_isLimitAdTrackingEnabled: Optional[bool] = None,
1311-
os_manufacturer: Union[None, Identity] = None,
1312-
os_version: Optional[str] = None,
1313-
os_environment_variables: Union[None, Dict, Dictionary] = None,
13141330
**kwargs: Any,
13151331
):
13161332
super().__init__()
@@ -1334,19 +1350,13 @@ def __init__(
13341350
**{
13351351
"uco-observable:advertisingID": os_advertisingID,
13361352
"uco-observable:bitness": os_bitness,
1337-
"uco-observable:version": os_version,
13381353
}
13391354
)
13401355
self._datetime_vars(**{"uco-observable:installDate": os_install_date})
13411356

13421357
self._bool_vars(
13431358
**{"uco-observable:isLimitAdTrackingEnabled": os_isLimitAdTrackingEnabled}
13441359
)
1345-
self._node_reference_vars(
1346-
**{
1347-
"uco-observable:manufacturer": os_manufacturer,
1348-
}
1349-
)
13501360

13511361

13521362
class PathRelationFacet(Facet):

example.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _next_timestamp() -> datetime:
4545
modified_time=bundle_modified_time,
4646
name="json ld file",
4747
object_created_time=bundle_created_time,
48-
spec_version="UCO/CASE 1.3",
48+
spec_version="UCO/CASE 1.4",
4949
tag="Artifacts extracted from a mobile phone",
5050
)
5151

@@ -67,17 +67,24 @@ def _next_timestamp() -> datetime:
6767
}
6868
manufacturer_apple = uco.identity.Organization(name="Apple")
6969

70+
# TODO AJN: Modeling suggestion - The SoftwareFacet and
71+
# OperatingSystemFacet pertain to an OperatingSystem object, not the
72+
# Device object. There needs to be a model of the time-bounded
73+
# relationship between device and OS, whether a Relationship or a
74+
# time-bounding on the OperatingSystem object.
75+
software_facet = uco.observable.SoftwareFacet(
76+
manufacturer=manufacturer_apple,
77+
version="17.4.1",
78+
)
7079
os_facet = uco.observable.OperatingSystemFacet(
71-
os_manufacturer=manufacturer_apple,
7280
os_advertisingID="DX4CDXKN",
7381
os_bitness="64-bit",
7482
os_install_date=os_date,
7583
os_isLimitAdTrackingEnabled=True,
76-
os_version="17.4.1",
7784
os_environment_variables=os_env_vars,
7885
)
7986

80-
device_camera.append_facets(device1, os_facet)
87+
device_camera.append_facets(device1, software_facet, os_facet)
8188
bundle.append_to_uco_object(device_camera)
8289

8390
##################################
@@ -863,16 +870,18 @@ def _next_timestamp() -> datetime:
863870
)
864871

865872
os_object = uco.observable.ObservableObject()
873+
software_facet = uco.observable.SoftwareFacet(
874+
manufacturer=manufacturer_apple,
875+
version="17.4.1",
876+
)
866877
os_facet = uco.observable.OperatingSystemFacet(
867-
os_manufacturer=manufacturer_apple,
868878
os_advertisingID="XX908WN",
869879
os_bitness="64-bit",
870880
os_install_date=os_date,
871881
os_isLimitAdTrackingEnabled=True,
872-
os_version="17.4.1",
873882
os_environment_variables=os_env_vars,
874883
)
875-
os_object.append_facets(os_facet)
884+
os_object.append_facets(software_facet, os_facet)
876885
bundle.append_to_uco_object(os_object)
877886

878887
app_telegram_facet = uco.observable.ApplicationFacet(

0 commit comments

Comments
 (0)