mirror of
https://github.com/openai/codex.git
synced 2026-05-18 18:22:39 +00:00
# Why We want shared hook trust that both the app and the TUI can build on, but the metadata is only useful if runtime behavior agrees with it. This PR adds a single backend trust model for hooks so unmanaged hooks cannot run until the current definition has been reviewed, while managed hooks remain runnable and non-configurable. # What - persist `trusted_hash` alongside hook state in `config.toml` - expose `currentHash` and derived `trustStatus` through `hooks/list` - derive trust from normalized hook definitions so equivalent hooks from `config.toml` and `hooks.json` share the same trust identity - gate unmanaged hooks on trust before they enter the runnable handler set # Reviewer Notes - key file to review is `codex-rs/hooks/src/engine/discovery.rs` - the only **core** change is schema related
190 lines
4.0 KiB
JSON
Generated
190 lines
4.0 KiB
JSON
Generated
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"definitions": {
|
|
"AbsolutePathBuf": {
|
|
"description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.",
|
|
"type": "string"
|
|
},
|
|
"HookErrorInfo": {
|
|
"properties": {
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"path": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"message",
|
|
"path"
|
|
],
|
|
"type": "object"
|
|
},
|
|
"HookEventName": {
|
|
"enum": [
|
|
"preToolUse",
|
|
"permissionRequest",
|
|
"postToolUse",
|
|
"sessionStart",
|
|
"userPromptSubmit",
|
|
"stop"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"HookHandlerType": {
|
|
"enum": [
|
|
"command",
|
|
"prompt",
|
|
"agent"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"HookMetadata": {
|
|
"properties": {
|
|
"command": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"currentHash": {
|
|
"type": "string"
|
|
},
|
|
"displayOrder": {
|
|
"format": "int64",
|
|
"type": "integer"
|
|
},
|
|
"enabled": {
|
|
"type": "boolean"
|
|
},
|
|
"eventName": {
|
|
"$ref": "#/definitions/HookEventName"
|
|
},
|
|
"handlerType": {
|
|
"$ref": "#/definitions/HookHandlerType"
|
|
},
|
|
"isManaged": {
|
|
"type": "boolean"
|
|
},
|
|
"key": {
|
|
"type": "string"
|
|
},
|
|
"matcher": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"pluginId": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"source": {
|
|
"$ref": "#/definitions/HookSource"
|
|
},
|
|
"sourcePath": {
|
|
"$ref": "#/definitions/AbsolutePathBuf"
|
|
},
|
|
"statusMessage": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"timeoutSec": {
|
|
"format": "uint64",
|
|
"minimum": 0.0,
|
|
"type": "integer"
|
|
},
|
|
"trustStatus": {
|
|
"$ref": "#/definitions/HookTrustStatus"
|
|
}
|
|
},
|
|
"required": [
|
|
"currentHash",
|
|
"displayOrder",
|
|
"enabled",
|
|
"eventName",
|
|
"handlerType",
|
|
"isManaged",
|
|
"key",
|
|
"source",
|
|
"sourcePath",
|
|
"timeoutSec",
|
|
"trustStatus"
|
|
],
|
|
"type": "object"
|
|
},
|
|
"HookSource": {
|
|
"enum": [
|
|
"system",
|
|
"user",
|
|
"project",
|
|
"mdm",
|
|
"sessionFlags",
|
|
"plugin",
|
|
"cloudRequirements",
|
|
"legacyManagedConfigFile",
|
|
"legacyManagedConfigMdm",
|
|
"unknown"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"HookTrustStatus": {
|
|
"enum": [
|
|
"managed",
|
|
"untrusted",
|
|
"trusted",
|
|
"modified"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"HooksListEntry": {
|
|
"properties": {
|
|
"cwd": {
|
|
"type": "string"
|
|
},
|
|
"errors": {
|
|
"items": {
|
|
"$ref": "#/definitions/HookErrorInfo"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"hooks": {
|
|
"items": {
|
|
"$ref": "#/definitions/HookMetadata"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"warnings": {
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"type": "array"
|
|
}
|
|
},
|
|
"required": [
|
|
"cwd",
|
|
"errors",
|
|
"hooks",
|
|
"warnings"
|
|
],
|
|
"type": "object"
|
|
}
|
|
},
|
|
"properties": {
|
|
"data": {
|
|
"items": {
|
|
"$ref": "#/definitions/HooksListEntry"
|
|
},
|
|
"type": "array"
|
|
}
|
|
},
|
|
"required": [
|
|
"data"
|
|
],
|
|
"title": "HooksListResponse",
|
|
"type": "object"
|
|
} |