From 2b3c7a8091733afdcd0cf1692e96051e83560d10 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Thu, 10 Aug 2023 11:52:53 -0400 Subject: [PATCH 1/3] De-duplicate IRIs When SHACL-reviewing all of the example graphs of CASE-Examples concatenated together, some IRIs were found to have been copied and pasted from example to example with some properties changed. In particular, `uco-core:name`, required to be at most one value for an IRI, pointed out the IRI repurposing when it was found to have two values in the aggregate. A follow-on patch will regenerate Make-managed files. Signed-off-by: Alex Nelson --- .../illustrations/analysis/src/analysis-manual_malware.json | 4 ++-- .../analysis/src/analysis-multimedia_classification.json | 4 ++-- .../illustrations/network_connection/network_connection.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/illustrations/analysis/src/analysis-manual_malware.json b/examples/illustrations/analysis/src/analysis-manual_malware.json index 1f421260..6a79600e 100644 --- a/examples/illustrations/analysis/src/analysis-manual_malware.json +++ b/examples/illustrations/analysis/src/analysis-manual_malware.json @@ -1,6 +1,6 @@ [ { - "@id": "kb:organization-fb6c05a0-b6be-4a10-ba62-0e7b1da4c0ec", + "@id": "kb:organization-0dfaf75a-7b42-4d9a-9aa1-c84c176461ae", "@type": "uco-identity:Organization", "uco-core:name": "hex-rays" }, @@ -10,7 +10,7 @@ "uco-core:name": "IDA Pro", "uco-tool:toolType": "binary code analysis tool", "uco-tool:creator": { - "@id": "kb:organization-fb6c05a0-b6be-4a10-ba62-0e7b1da4c0ec" + "@id": "kb:organization-0dfaf75a-7b42-4d9a-9aa1-c84c176461ae" }, "uco-tool:version": "7.7" }, diff --git a/examples/illustrations/analysis/src/analysis-multimedia_classification.json b/examples/illustrations/analysis/src/analysis-multimedia_classification.json index 08e4e34c..6745cebb 100644 --- a/examples/illustrations/analysis/src/analysis-multimedia_classification.json +++ b/examples/illustrations/analysis/src/analysis-multimedia_classification.json @@ -1,6 +1,6 @@ [ { - "@id": "kb:organization-2b3b98e2-aea2-4270-876a-7f9917623cb7", + "@id": "kb:organization-db3e6578-ae0a-4e5c-8bfc-d4470774f20f", "@type": "uco-identity:Organization", "uco-core:name": "NFI" }, @@ -13,7 +13,7 @@ "uco-core:name": "Hansken", "uco-tool:toolType": "DFaaS", "uco-tool:creator": { - "@id": "kb:organization-2b3b98e2-aea2-4270-876a-7f9917623cb7" + "@id": "kb:organization-db3e6578-ae0a-4e5c-8bfc-d4470774f20f" }, "uco-tool:version": "1.0", "uco-configuration:usesConfiguration": [ diff --git a/examples/illustrations/network_connection/network_connection.json b/examples/illustrations/network_connection/network_connection.json index cbb5a992..7a77fca2 100644 --- a/examples/illustrations/network_connection/network_connection.json +++ b/examples/illustrations/network_connection/network_connection.json @@ -21,7 +21,7 @@ ], "uco-core:object": [ { - "@id": "kb:investigation-952d677d-6b62-4e53-9bac-1b113d268ac5", + "@id": "kb:investigation-6d58da47-0879-47f0-a1c8-d233dc4f090c", "@type": "case-investigation:Investigation", "uco-core:name": "NetTheft1234", "case-investigation:focus": "Media Theft", From 5e5c61ac031bb351cdc3e36fbddea1a618ad15af Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Thu, 10 Aug 2023 11:53:27 -0400 Subject: [PATCH 2/3] Regenerate Make-managed files Signed-off-by: Alex Nelson --- examples/illustrations/analysis/README.md | 8 ++++---- examples/illustrations/analysis/analysis.json | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/illustrations/analysis/README.md b/examples/illustrations/analysis/README.md index 22af69ca..bb203b4e 100644 --- a/examples/illustrations/analysis/README.md +++ b/examples/illustrations/analysis/README.md @@ -8,7 +8,7 @@ This example illustrates manual software malware analysis within the Cyber Threa ```json [ { - "@id": "kb:organization-fb6c05a0-b6be-4a10-ba62-0e7b1da4c0ec", + "@id": "kb:organization-0dfaf75a-7b42-4d9a-9aa1-c84c176461ae", "@type": "uco-identity:Organization", "uco-core:name": "hex-rays" }, @@ -18,7 +18,7 @@ This example illustrates manual software malware analysis within the Cyber Threa "uco-core:name": "IDA Pro", "uco-tool:toolType": "binary code analysis tool", "uco-tool:creator": { - "@id": "kb:organization-fb6c05a0-b6be-4a10-ba62-0e7b1da4c0ec" + "@id": "kb:organization-0dfaf75a-7b42-4d9a-9aa1-c84c176461ae" }, "uco-tool:version": "7.7" }, @@ -80,7 +80,7 @@ This example illustrates multimedia classification. ```json [ { - "@id": "kb:organization-2b3b98e2-aea2-4270-876a-7f9917623cb7", + "@id": "kb:organization-db3e6578-ae0a-4e5c-8bfc-d4470774f20f", "@type": "uco-identity:Organization", "uco-core:name": "NFI" }, @@ -93,7 +93,7 @@ This example illustrates multimedia classification. "uco-core:name": "Hansken", "uco-tool:toolType": "DFaaS", "uco-tool:creator": { - "@id": "kb:organization-2b3b98e2-aea2-4270-876a-7f9917623cb7" + "@id": "kb:organization-db3e6578-ae0a-4e5c-8bfc-d4470774f20f" }, "uco-tool:version": "1.0", "uco-configuration:usesConfiguration": [ diff --git a/examples/illustrations/analysis/analysis.json b/examples/illustrations/analysis/analysis.json index 588a2ebf..98c2765c 100644 --- a/examples/illustrations/analysis/analysis.json +++ b/examples/illustrations/analysis/analysis.json @@ -142,7 +142,7 @@ "@type": "uco-tool:AnalyticTool", "uco-core:name": "IDA Pro", "uco-tool:creator": { - "@id": "kb:organization-fb6c05a0-b6be-4a10-ba62-0e7b1da4c0ec" + "@id": "kb:organization-0dfaf75a-7b42-4d9a-9aa1-c84c176461ae" }, "uco-tool:toolType": "binary code analysis tool", "uco-tool:version": "7.7" @@ -175,7 +175,7 @@ ], "uco-core:name": "Hansken", "uco-tool:creator": { - "@id": "kb:organization-2b3b98e2-aea2-4270-876a-7f9917623cb7" + "@id": "kb:organization-db3e6578-ae0a-4e5c-8bfc-d4470774f20f" }, "uco-tool:toolType": "DFaaS", "uco-tool:version": "1.0" @@ -215,14 +215,14 @@ "@type": "uco-observable:Software" }, { - "@id": "kb:organization-2b3b98e2-aea2-4270-876a-7f9917623cb7", + "@id": "kb:organization-0dfaf75a-7b42-4d9a-9aa1-c84c176461ae", "@type": "uco-identity:Organization", - "uco-core:name": "NFI" + "uco-core:name": "hex-rays" }, { - "@id": "kb:organization-fb6c05a0-b6be-4a10-ba62-0e7b1da4c0ec", + "@id": "kb:organization-db3e6578-ae0a-4e5c-8bfc-d4470774f20f", "@type": "uco-identity:Organization", - "uco-core:name": "hex-rays" + "uco-core:name": "NFI" } ] } From 819edec4a634ecb9131195011a8fd40a3a52dc3c Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Thu, 10 Aug 2023 11:58:41 -0400 Subject: [PATCH 3/3] Add kb compilation This patch adds a compilation of all kb graphs as a non-persisted artifact. The benefit of this graph is, so far, finding duplicated-node errors. No effects were observed on Make-managed files. Signed-off-by: Alex Nelson --- examples/illustrations/.gitignore | 2 + examples/illustrations/Makefile | 6 +++ examples/illustrations/postvisit.mk | 61 +++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 examples/illustrations/postvisit.mk diff --git a/examples/illustrations/.gitignore b/examples/illustrations/.gitignore index 52e31c67..c516cc76 100644 --- a/examples/illustrations/.gitignore +++ b/examples/illustrations/.gitignore @@ -1,3 +1,5 @@ +all-drafting.ttl generated-*.md generated-*.sed generated-*.json +kb.ttl diff --git a/examples/illustrations/Makefile b/examples/illustrations/Makefile index 7a6f655e..ecf6629c 100644 --- a/examples/illustrations/Makefile +++ b/examples/illustrations/Makefile @@ -37,6 +37,9 @@ all-%: check: \ $(check_targets) + $(MAKE) \ + --file postvisit.mk \ + check check-%: export x=$@ \ @@ -46,6 +49,9 @@ check-%: clean: \ $(clean_targets) + @$(MAKE) \ + --file postvisit.mk \ + clean clean-%: @export x=$@ \ diff --git a/examples/illustrations/postvisit.mk b/examples/illustrations/postvisit.mk new file mode 100644 index 00000000..b76008ad --- /dev/null +++ b/examples/illustrations/postvisit.mk @@ -0,0 +1,61 @@ +#!/usr/bin/make -f + +# This software was developed at the National Institute of Standards +# and Technology by employees of the Federal Government in the course +# of their official duties. Pursuant to title 17 Section 105 of the +# United States Code this software is not subject to copyright +# protection and is in the public domain. NIST assumes no +# responsibility whatsoever for its use by other parties, and makes +# no guarantees, expressed or implied, about its quality, +# reliability, or any other characteristic. +# +# We would appreciate acknowledgement if the software is used. + +SHELL := /bin/bash + +top_srcdir := $(shell cd ../.. ; pwd) + +# Set up descending into each directory that has a Makefile. +illustration_dirs := $(shell ls */Makefile | xargs dirname) + +all_drafting_ttl := $(wildcard */drafting.ttl) + +all_jsonld := $(foreach illustration_dir,$(illustration_dirs),$(illustration_dir)/$(illustration_dir).json) + +all: \ + kb.ttl + +all-drafting.ttl: \ + $(all_drafting_ttl) + source $(top_srcdir)/venv/bin/activate \ + && rdfpipe \ + --output-format turtle \ + $^ \ + > _$@ + mv _$@ $@ + +check: \ + kb.ttl + +clean: + @rm -f \ + _all-drafting.ttl \ + _kb.ttl \ + all-drafting.ttl \ + kb.ttl + +kb.ttl: \ + $(all_jsonld) \ + all-drafting.ttl + source $(top_srcdir)/venv/bin/activate \ + && rdfpipe \ + --output-format turtle \ + $(all_jsonld) \ + > _$@ + source $(top_srcdir)/venv/bin/activate \ + && case_validate \ + --allow-infos \ + --metashacl \ + --ontology-graph all-drafting.ttl \ + _$@ + mv _$@ $@