From 1adb2913df44ba191a00cdc85315b33742377e07 Mon Sep 17 00:00:00 2001 From: Agent IX Date: Sun, 15 Nov 2026 21:02:43 -0800 Subject: [PATCH 1/7] Add control safeguards and protected targets --- spec/tests.md | 5 + spec_objects_security/manifest.yaml | 8 +- spec_objects_security/schemas/Control.json | 8 + .../schemas/ControlFrontmatter.json | 16 ++ .../DataClassificationFrontmatter.json | 16 ++ spec_objects_security/schemas/Safeguard.json | 15 ++ spec_objects_security/skeletons/control.md | 2 + tests/test_control_safeguards.py | 187 ++++++++++++++++++ typespec/main.tsp | 28 +++ 9 files changed, 284 insertions(+), 1 deletion(-) create mode 100644 spec_objects_security/schemas/ControlFrontmatter.json create mode 100644 spec_objects_security/schemas/DataClassificationFrontmatter.json create mode 100644 spec_objects_security/schemas/Safeguard.json create mode 100644 tests/test_control_safeguards.py diff --git a/spec/tests.md b/spec/tests.md index d09b06a..ef648a3 100644 --- a/spec/tests.md +++ b/spec/tests.md @@ -152,6 +152,7 @@ the Python package only: neither Node script is measured by it. | NFR-003 | NFR-003-AC-1..2, NFR-003-M-1..2 | TC-204, TC-205 | ✅ | | FR-023 | FR-023-AC-1..10 | TC-206..TC-217 | ✅ AC-7 is an inspection | | FR-024 | FR-024-AC-1..7 | TC-220..TC-223 | ✅ | +| FR-025 | FR-025-AC-8..9, FR-025-AC-11 | TC-244..TC-247 | 🚧 AC-11 starter-rule enum coverage remains with PLAT-1540; other FR-025 criteria remain with their owning tickets | | NFR-004 | NFR-004-AC-1..3, NFR-004-M-1..2 | TC-207, TC-211, TC-213, TC-214 | ✅ | | FR-017 | FR-017-AC-1..7 | TC-175..TC-186 | ✅ `quire clauses` loads strictly and cannot load the real module (the object-type edges come from another module), so TC-181, TC-183, TC-185 and TC-186 evaluate a module that holds only the set files | | FR-026 | FR-026-AC-1..7, FR-026-AC-9..10 | TC-224..TC-236, TC-242..TC-243 | ✅ | @@ -366,6 +367,10 @@ the Python package only: neither Node script is measured by it. | TC-241 | The risk skeleton states `decision: undecided` | Unit | P0 | FR-027-AC-6 | ✅ | | TC-242 | An empty `## Out of scope` section fails validation naming the section | Integration | P0 | FR-026-AC-6 | ✅ | | TC-243 | `semantic.exports` contains twenty-six types including `threat_model` | Unit | P0 | FR-026-AC-10 | ✅ | +| TC-244 | Safeguard and frontmatter schemas admit the declared non-empty unique safeguard lists and reject undeclared values | Unit | P0 | FR-025-AC-8, FR-025-AC-11 | ✅ | +| TC-245 | Control safeguards are optional authored frontmatter, are extracted when present, and the skeleton validates | Integration | P0 | FR-025-AC-8, FR-025-AC-9 | ✅ | +| TC-246 | A control protects a connection and a data sink without a disallowed-target diagnostic | Integration | P0 | FR-025-AC-9 | ✅ | +| TC-247 | Control and data-classification manifests reference their open frontmatter schemas and declare the field locators | Unit | P0 | FR-025-AC-9, FR-025-AC-11 | ✅ | ## Test Environment diff --git a/spec_objects_security/manifest.yaml b/spec_objects_security/manifest.yaml index cca68cf..a58f741 100644 --- a/spec_objects_security/manifest.yaml +++ b/spec_objects_security/manifest.yaml @@ -234,6 +234,7 @@ object_types: after_heading: Invariants required: false - name: data_classification + frontmatter_schema_ref: schemas/DataClassificationFrontmatter.json allowed_links: classifies: [persistable, externally-exposed, sensitive] references: [data_classification] @@ -470,10 +471,11 @@ object_types: after_heading: Properties required: false - name: control + frontmatter_schema_ref: schemas/ControlFrontmatter.json allowed_links: mitigates: [threat, risk, vulnerability, hazard, failure_mode] implements: [policy] - protects: [externally-exposed, asset] + protects: [externally-exposed, asset, connection, data_sink] data_schema: schema: schemas/Control.json body_extraction: @@ -490,6 +492,10 @@ object_types: from: section_body after_heading: Effectiveness required: false + safeguards: + from: frontmatter_field + path: [safeguards] + required: false # FR-005: the typed `## Properties` table the # semantic layer reads. Optional, so existing artifacts stay valid. properties: diff --git a/spec_objects_security/schemas/Control.json b/spec_objects_security/schemas/Control.json index e2f59c4..65309d5 100644 --- a/spec_objects_security/schemas/Control.json +++ b/spec_objects_security/schemas/Control.json @@ -29,6 +29,14 @@ "effectiveness": { "$ref": "https://schemas.agent-ix.org/agent-ix/spec-objects-security/ControlEffectiveness.json" }, + "safeguards": { + "type": "array", + "items": { + "$ref": "https://schemas.agent-ix.org/agent-ix/spec-objects-security/Safeguard.json" + }, + "minItems": 1, + "uniqueItems": true + }, "mitigates": { "type": "array", "items": { diff --git a/spec_objects_security/schemas/ControlFrontmatter.json b/spec_objects_security/schemas/ControlFrontmatter.json new file mode 100644 index 0000000..4f19b33 --- /dev/null +++ b/spec_objects_security/schemas/ControlFrontmatter.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.agent-ix.org/agent-ix/spec-objects-security/ControlFrontmatter.json", + "type": "object", + "properties": { + "safeguards": { + "type": "array", + "items": { + "$ref": "https://schemas.agent-ix.org/agent-ix/spec-objects-security/Safeguard.json" + }, + "minItems": 1, + "uniqueItems": true + } + }, + "description": "Frontmatter keys authored on a control document." +} diff --git a/spec_objects_security/schemas/DataClassificationFrontmatter.json b/spec_objects_security/schemas/DataClassificationFrontmatter.json new file mode 100644 index 0000000..928b20d --- /dev/null +++ b/spec_objects_security/schemas/DataClassificationFrontmatter.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.agent-ix.org/agent-ix/spec-objects-security/DataClassificationFrontmatter.json", + "type": "object", + "properties": { + "regulated_categories": { + "type": "array", + "items": { + "$ref": "https://schemas.agent-ix.org/agent-ix/spec-objects-security/RegulatedDataCategory.json" + }, + "minItems": 1, + "uniqueItems": true + } + }, + "description": "Frontmatter keys authored on a data-classification document." +} diff --git a/spec_objects_security/schemas/Safeguard.json b/spec_objects_security/schemas/Safeguard.json new file mode 100644 index 0000000..d3342cf --- /dev/null +++ b/spec_objects_security/schemas/Safeguard.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.agent-ix.org/agent-ix/spec-objects-security/Safeguard.json", + "type": "string", + "enum": [ + "encrypt-in-transit", + "encrypt-at-rest", + "anonymize", + "pseudonymize", + "obtain-consent", + "restrict-region", + "validate-before-display" + ], + "description": "Safeguards a person may state for a control." +} diff --git a/spec_objects_security/skeletons/control.md b/spec_objects_security/skeletons/control.md index d9b6ac5..f1d6ceb 100644 --- a/spec_objects_security/skeletons/control.md +++ b/spec_objects_security/skeletons/control.md @@ -3,10 +3,12 @@ id: CTRL-001 title: "RefreshTokenRotation" type: control object: control +safeguards: [encrypt-in-transit] ---