Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 28 additions & 6 deletions docs/schemas/agent-session-manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,37 @@ redaction:
- `#241` — Secret Inventory SSOT 化(session recording 前提条件)
- `#242` — Session Recording Kill Switch policy(session recording 前提条件)

## `secret_policy` オブジェクト(optional, #412 追加)
## `secret_policy` オブジェクト(optional, #412 follow-up redesign)

Secret boundary policy の状態を記録する。`#412` の fail-closed boundary 実装により追加。
Secret 値を manifest に含めない static producer contract と、runtime boundary attestation を分離して記録する。

| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
| `value_exposed` | boolean | no | Secret 値がこの manifest に露出しているか。public-safe manifest では必ず `false` |
| `boundary_enforced` | boolean | no | このセッションで `secret_boundary_guard` PreToolUse hook が有効だったか |
| `mode` | enum | no | `presence_only \| value_included \| not_applicable`。Secret を presence boolean / metadata のみで扱う場合は `presence_only`。`value_included` は unsafe |
| `value_exposed` | boolean const false | yes | Secret 値がこの manifest に露出していないこと |
| `mode` | enum `"presence_only"` | yes | Secret は presence-only metadata として扱う |
| `producer_contract` | object | yes | static producer declaration。runtime attestation ではない |
| `runtime_boundary` | object | yes | runtime boundary enforcement の attestation 状態 |

### `producer_contract`

| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
| `declared` | boolean const true | yes | producer が static contract を明示的に宣言したこと |
| `id` | string const `presence_only_no_secret_values` | yes | machine-readable static contract identifier |
| `version` | string (`^v[0-9]+$`) | yes | static contract version |
| `claims.secret_values_not_serialized` | boolean const true | yes | Secret 値を manifest に serialize しない |
| `claims.presence_only` | boolean const true | yes | presence-only metadata のみを emit する |

### `runtime_boundary`

| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
| `attested` | boolean | yes | runtime secret boundary enforcement が実際に attestation されたか |
| `evidence_ref` | string \| null | yes | runtime evidence への参照 |

- `attested: true` のとき、`evidence_ref` は非空・非空白 string でなければならない
- `attested: false` のとき、`evidence_ref` は `null` でなければならない
- `boundary_enforced` は廃止。旧 shape は invalid

`value_exposed: false` かつ `mode: presence_only` が manifest の public-safe 要件。
`#412` 完了後、manifest producer は `secret_policy.value_exposed: false` を生成するよう更新される。
producer 実装の新 shape 追随は Issue #500 / PR #532 側で行う。
127 changes: 122 additions & 5 deletions docs/schemas/agent-session-manifest.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,23 +614,140 @@
"secret_policy": {
"type": "object",
"additionalProperties": false,
"description": "Secret boundary policy status for this manifest (#412). value_exposed must be false and mode must be presence_only.",
"required": [
"value_exposed",
"mode",
"producer_contract",
"runtime_boundary"
],
"description": "Secret boundary policy status for this manifest (#412). Static producer contract and runtime attestation are represented separately.",
"properties": {
"value_exposed": {
"type": "boolean",
"const": false,
"description": "Whether any Secret value was exposed in this manifest. MUST be false — value_exposed: true is prohibited."
},
"boundary_enforced": {
"type": "boolean",
"description": "Whether secret_boundary_guard PreToolUse hook was active during this session."
},
"mode": {
"type": "string",
"enum": [
"presence_only"
],
"description": "How secrets are represented. Only presence_only is permitted; value_included and not_applicable are prohibited."
},
"producer_contract": {
"type": "object",
"required": [
"declared",
"id",
"version",
"claims"
],
"additionalProperties": false,
"description": "Static producer-side declaration. This MUST NOT be interpreted as runtime attestation.",
"properties": {
"declared": {
"type": "boolean",
"const": true,
"description": "Whether the producer explicitly declares this static contract."
},
"id": {
"type": "string",
"const": "presence_only_no_secret_values",
"description": "Machine-readable static contract identifier."
},
"version": {
"type": "string",
"pattern": "^v[0-9]+$",
"description": "Static contract version."
},
"claims": {
"type": "object",
"required": [
"secret_values_not_serialized",
"presence_only"
],
"additionalProperties": false,
"properties": {
"secret_values_not_serialized": {
"type": "boolean",
"const": true,
"description": "Producer guarantees secret values are not serialized into the manifest."
},
"presence_only": {
"type": "boolean",
"const": true,
"description": "Producer only emits presence-only metadata."
}
}
}
}
},
"runtime_boundary": {
"type": "object",
"required": [
"attested",
"evidence_ref"
],
"additionalProperties": false,
"description": "Runtime attestation status for secret boundary enforcement.",
"properties": {
"attested": {
"type": "boolean",
"description": "Whether runtime secret boundary enforcement was actually attested for this session."
},
"evidence_ref": {
"type": [
"string",
"null"
],
"description": "Reference to runtime evidence when attested is true."
}
},
"allOf": [
{
"if": {
"properties": {
"attested": {
"const": true
}
},
"required": [
"attested"
]
},
"then": {
"required": [
"evidence_ref"
],
"properties": {
"evidence_ref": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
}
}
}
},
{
"if": {
"properties": {
"attested": {
"const": false
}
},
"required": [
"attested"
]
},
"then": {
"properties": {
"evidence_ref": {
"type": "null"
}
}
}
}
]
}
}
}
Expand Down
35 changes: 35 additions & 0 deletions scripts/lib/agent-session-manifest-validation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ function validateSemantics(manifest) {
const producerMetadataSafetyErrors = validateProducerMetadataSafety(manifest).errors
errors.push(...producerMetadataSafetyErrors)

const runtimeBoundaryErrors = validateRuntimeBoundarySemantics(manifest).errors
errors.push(...runtimeBoundaryErrors)

return errors
}

Expand Down Expand Up @@ -208,6 +211,38 @@ export function validateManifestSemantics(json) {
}
}

export function validateRuntimeBoundarySemantics(manifest) {
const errors = []
const runtimeBoundary = manifest.secret_policy?.runtime_boundary

if (!runtimeBoundary || runtimeBoundary.attested !== true) {
return {
valid: true,
errors,
}
}

const evidenceRef = runtimeBoundary.evidence_ref
const evidenceList = Array.isArray(manifest.evidence) ? manifest.evidence : []
const matched = evidenceList.some((evidence) =>
evidence.source_ref === evidenceRef &&
PRODUCER_EVIDENCE_SOURCE_KINDS.includes(evidence.source_kind)
)

if (!matched) {
errors.push({
path: 'secret_policy.runtime_boundary.evidence_ref',
message:
'runtime_boundary.evidence_ref must match an evidence[].source_ref with source_kind hook_jsonl, ci_check, or artifact',
})
}

return {
valid: errors.length === 0,
errors,
}
}

// ============================================================================
// Producer Contract Validation
// ============================================================================
Expand Down
Loading
Loading