Skip to content

Align CyTRICS v1.0.1 Schema#601

Draft
willis89pr wants to merge 16 commits intomainfrom
schema
Draft

Align CyTRICS v1.0.1 Schema#601
willis89pr wants to merge 16 commits intomainfrom
schema

Conversation

@willis89pr
Copy link
Copy Markdown
Collaborator

Summary

If merged this pull request will...

Proposed changes

- Replace epoch-based captureTime (int) with RFC 3339 strings (Optional[str])
  across hardware, software, SBOM, and provenance models
- Update Software creation to use RFC 3339 timestamps instead of time.time()
- Remove unused `time` import
- Add utility (utc_now_rfc3339) to generate schema-compliant UTC timestamps

This aligns with CyTRICS v1.0.1 schema requirements:
- type: ["string", "null"]
- format: "date-time" (RFC 3339)

Ensures consistent, timezone-aware timestamps across all captureTime fields.
@willis89pr willis89pr self-assigned this Mar 24, 2026
pre-commit-ci bot and others added 4 commits March 24, 2026 16:16
- Add tests/schema/test_cytrics_schema.py to validate captureTime against
  CyTRICS schema (docs/cytrics_schema/schema.json)
- Verify RFC 3339 date-time compliance for generated timestamps
- Ensure hardware and software captureTime accept string/null as defined
- Ensure file captureTime accepts string and rejects null
- Add negative tests for invalid formats (missing timezone, epoch integers)
- Include JSON Schema FormatChecker to enforce date-time validation

These tests prevent regression to epoch-based timestamps and ensure
alignment with CyTRICS v1.0.1 captureTime requirements.
Use correct relative import (`..utils`) to resolve ModuleNotFoundError
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

🧪 SBOM Results (16/16)

coff_files (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],

NET_app_config_test_no1 (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -80,7 +80,7 @@
     },
     {
       "UUID": "39b66a99-f18e-40ee-b76d-146d4643dde4",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -115,7 +115,7 @@
     },
     {
       "UUID": "ef7fb89c-8195-4c60-a2a3-43baff01bbc5",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],

sample_sboms (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -17,7 +17,7 @@
       "installPath": [
         "/home/runner/work/Surfactant/Surfactant/tests/data/sample_sboms/helics_sbom.json"
       ],
-      "md5": "746bec4e1a0e48c464e1f9472aabd4e1",
+      "md5": "bea34c1a620e34601f679f4f69a76975",
       "metadata": [
         {
           "collectedBy": "Surfactant",
@@ -32,16 +32,16 @@
       "provenance": null,
       "recordedInstitution": null,
       "relationshipAssertion": "Unknown",
-      "sha1": "8f246b4425bae57b8b40a955598e9c423d666f94",
-      "sha256": "957ae4c8dd42ca5f9e24afe426c589e505387057168eb7755031bfcf7bc3dae7",
-      "size": 21305,
+      "sha1": "c65f66f644983c0af540c5de3ed7f566d7b1a35a",
+      "sha256": "b5fa1b57c2d12bf520b2d896af4974202c25930a867ee4069d7177dbe3dc4396",
+      "size": 21401,
       "supplementaryFiles": [],
       "vendor": [],
       "version": ""
     },
     {
       "UUID": "39b66a99-f18e-40ee-b76d-146d4643dde4",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -52,7 +52,7 @@
       "installPath": [
         "/home/runner/work/Surfactant/Surfactant/tests/data/sample_sboms/helics_libs_sbom.json"
       ],
-      "md5": "ab9c4ae608f984bb4b9953da84a01a6a",
+      "md5": "662244945ef43f3eb3b6194e58f95c67",
       "metadata": [
         {
           "collectedBy": "Surfactant",
@@ -67,16 +67,16 @@
       "provenance": null,
       "recordedInstitution": null,
       "relationshipAssertion": "Unknown",
-      "sha1": "70b315950b86b7358f57458f553a6a8f59b1d6e3",
-      "sha256": "715a0f4cbc0d4e3bae29a5e3e35d77740415ee679fba53da71ff577c35519239",
-      "size": 6633,
+      "sha1": "f724a2264c482ef87f3dd1411984924511f3b879",
+      "sha256": "1188b423df75452acdaae5bb98aa1e759a30037d38e00a4b27ff741e10f05904",
+      "size": 6669,
       "supplementaryFiles": [],
       "vendor": [],
       "version": ""
     },
     {
       "UUID": "ef7fb89c-8195-4c60-a2a3-43baff01bbc5",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -87,7 +87,7 @@
       "installPath": [
         "/home/runner/work/Surfactant/Surfactant/tests/data/sample_sboms/helics_binaries_sbom.json"
       ],
-      "md5": "a55c1c444c7a7c13384f63796e97fad5",
+      "md5": "dc51ea7bf9bf27b483e11e68ca636b21",
       "metadata": [
         {
           "collectedBy": "Surfactant",
@@ -102,9 +102,9 @@
       "provenance": null,
       "recordedInstitution": null,
       "relationshipAssertion": "Unknown",
-      "sha1": "8bf5ff3d2ef89601aa6187f7baa3a866813c2bfe",
-      "sha256": "75713769fb29a02b50beff3a03f2de7e54aab201d91a21601f800130dfaa4d8a",
-      "size": 15436,
+      "sha1": "e07c82bbffbc40ed0e44e8630edd419ad4fb2aac",
+      "sha256": "e6f1d9c52c3e2190815034bae55f00ed8130f00170f39c38d0e25162199f9878",
+      "size": 15508,
       "supplementaryFiles": [],
       "vendor": [],
       "version": ""

mac_os_dmg (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],

ELF_shared_obj_test_no1 (Link)

---
+++
@@ -12,7 +12,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -98,7 +98,7 @@
     },
     {
       "UUID": "39b66a99-f18e-40ee-b76d-146d4643dde4",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],

rpm_pkg_files (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -79,7 +79,7 @@
     },
     {
       "UUID": "39b66a99-f18e-40ee-b76d-146d4643dde4",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -153,7 +153,7 @@
     },
     {
       "UUID": "ef7fb89c-8195-4c60-a2a3-43baff01bbc5",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],

cpio_files (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -41,7 +41,7 @@
     },
     {
       "UUID": "39b66a99-f18e-40ee-b76d-146d4643dde4",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -76,7 +76,7 @@
     },
     {
       "UUID": "ef7fb89c-8195-4c60-a2a3-43baff01bbc5",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -111,7 +111,7 @@
     },
     {
       "UUID": "ff94c3a0-6237-42fd-b041-20f7389b1077",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:26Z",
       "comments": "",
       "components": [],
       "containerPath": [],

mach_o_dylib_test_no1 (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -41,7 +41,7 @@
     },
     {
       "UUID": "39b66a99-f18e-40ee-b76d-146d4643dde4",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],

srectest_no1 (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],

Windows_dll_test_no1 (Link)

---
+++
@@ -12,7 +12,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -67,7 +67,7 @@
     },
     {
       "UUID": "39b66a99-f18e-40ee-b76d-146d4643dde4",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],

cd_iso_files (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -41,7 +41,7 @@
     },
     {
       "UUID": "39b66a99-f18e-40ee-b76d-146d4643dde4",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -76,7 +76,7 @@
     },
     {
       "UUID": "ef7fb89c-8195-4c60-a2a3-43baff01bbc5",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],

java_class_no1 (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],

a_out_files (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -44,7 +44,7 @@
     },
     {
       "UUID": "39b66a99-f18e-40ee-b76d-146d4643dde4",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -82,7 +82,7 @@
     },
     {
       "UUID": "ef7fb89c-8195-4c60-a2a3-43baff01bbc5",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -120,7 +120,7 @@
     },
     {
       "UUID": "ff94c3a0-6237-42fd-b041-20f7389b1077",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -158,7 +158,7 @@
     },
     {
       "UUID": "06d3de54-af8a-4365-8545-605d9ad5dfb1",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],

zstandard (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],

msitest_no1 (Link)

---
+++
@@ -12,7 +12,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "This is a test file to create an msi.",
       "components": [],
       "containerPath": [],
@@ -69,7 +69,7 @@
     },
     {
       "UUID": "ef7fb89c-8195-4c60-a2a3-43baff01bbc5",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [

uimage_files (Link)

---
+++
@@ -6,7 +6,7 @@
   "software": [
     {
       "UUID": "52f1e504-b79c-4e6d-b0d4-397882a55ee6",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -59,7 +59,7 @@
     },
     {
       "UUID": "39b66a99-f18e-40ee-b76d-146d4643dde4",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],
@@ -94,7 +94,7 @@
     },
     {
       "UUID": "ef7fb89c-8195-4c60-a2a3-43baff01bbc5",
-      "captureTime": 1609459200,
+      "captureTime": "2026-03-30T23:25:27Z",
       "comments": "",
       "components": [],
       "containerPath": [],

For commit 1fdced3 (Run 23769710634)
Compared against commit ddb6973 (Run 23759671851)

willis89pr and others added 11 commits March 24, 2026 17:01
- Add validate_capture_time utility enforcing RFC 3339 with required timezone
  using regex + datetime parsing
- Support nullable behavior and consistent error handling across models
- Add unit tests for capture_time validation (valid cases, null, and failures)
- Remove schema tests that incorrectly assumed jsonschema enforces timezone
- Keep schema tests focused on actual schema validation behavior

This separates schema validation from stricter application-level validation
and ensures captureTime values are consistently timezone-aware.
- add jsonschema to test dependency groups and optional test extras
- update pytest fixtures to use `name=` to avoid pylint redefined-outer-name warnings
- ensure schema validation tests run correctly in CI
- validate captureTime in dataclass __post_init__ (File, Hardware, Software, provenance)
- add validation at SBOM.create_software boundary
- enforce validation on captureTime updates in Software

Aligns runtime behavior with CyTRICS schema requirements.
…dling

- validate captureTime for software entries and nested components in CLI add path
- fix installPath update logic to handle None containerPath/installPath safely
- remove deprecated system-related CLI options and merge logic
- drop create_system_object and captureStart/captureEnd handling
- standardize graph node type comparison ("path" vs "Path")

Aligns CLI and merge behavior with CyTRICS v1.0.1 schema and improves input validation robustness.
…idation tests

- replace legacy epoch-based captureTime values with RFC 3339 strings in test data
- update CLI tests to use schema-compliant captureTime values
- add tests for nested SoftwareComponent captureTime validation
- add negative test for invalid component captureTime
- ensure test fixtures align with CyTRICS v1.0.1 date-time requirements

Fixes test failures caused by stricter captureTime validation and completes schema migration.
- remove legacy system config helper from merge tests
- update merge test calls to use the new three-argument signature
- delete tests for deprecated add_system and system_uuid behavior
- add coverage to assert merged output does not emit systems

Aligns merge tests with the CyTRICS v1.0.1 merge behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant