483 lines
12 KiB
JSON
483 lines
12 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"title": "SuccessEnvelope",
|
|
"description": "Versioned successful response.",
|
|
"type": "object",
|
|
"properties": {
|
|
"data": {
|
|
"description": "Operation-specific result.",
|
|
"$ref": "#/$defs/InlineOrArtifact"
|
|
},
|
|
"kind": {
|
|
"type": "string",
|
|
"const": "cleanup"
|
|
},
|
|
"provenance": {
|
|
"description": "Reproducibility and execution context.",
|
|
"$ref": "#/$defs/ToolProvenance"
|
|
},
|
|
"schema_version": {
|
|
"type": "integer",
|
|
"const": 1
|
|
},
|
|
"warnings": {
|
|
"description": "Deduplicated stable warnings.",
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/Warning"
|
|
}
|
|
}
|
|
},
|
|
"required": [
|
|
"schema_version",
|
|
"kind",
|
|
"provenance",
|
|
"data",
|
|
"warnings"
|
|
],
|
|
"$defs": {
|
|
"AnalysisStoreProvenance": {
|
|
"description": "Analysis Store provenance.",
|
|
"type": "object",
|
|
"properties": {
|
|
"path": {
|
|
"description": "Tagged absolute store path.",
|
|
"$ref": "#/$defs/TaggedPath"
|
|
},
|
|
"source": {
|
|
"description": "Store resolution source.",
|
|
"$ref": "#/$defs/StoreSource"
|
|
}
|
|
},
|
|
"required": [
|
|
"path",
|
|
"source"
|
|
]
|
|
},
|
|
"ArtifactDescriptor": {
|
|
"description": "Artifact descriptor returned instead of oversized inline data.",
|
|
"type": "object",
|
|
"properties": {
|
|
"bytes": {
|
|
"description": "Exact file bytes including trailing LF.",
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0
|
|
},
|
|
"contains": {
|
|
"description": "Always `complete_success_response`.",
|
|
"type": "string"
|
|
},
|
|
"media_type": {
|
|
"description": "Always `application/json`.",
|
|
"type": "string"
|
|
},
|
|
"path": {
|
|
"description": "Tagged absolute Artifact path.",
|
|
"$ref": "#/$defs/TaggedPath"
|
|
},
|
|
"sha256": {
|
|
"description": "SHA-256 of exact file bytes.",
|
|
"$ref": "#/$defs/Digest"
|
|
}
|
|
},
|
|
"required": [
|
|
"path",
|
|
"bytes",
|
|
"sha256",
|
|
"media_type",
|
|
"contains"
|
|
]
|
|
},
|
|
"CleanupData": {
|
|
"description": "Cleanup result data; detailed count contracts are carried as typed snapshots.",
|
|
"type": "object",
|
|
"properties": {
|
|
"matched": {
|
|
"description": "Preflight match snapshot.",
|
|
"$ref": "#/$defs/CleanupSnapshot"
|
|
},
|
|
"mode": {
|
|
"description": "Execution or dry-run mode.",
|
|
"$ref": "#/$defs/CleanupMode"
|
|
},
|
|
"removed": {
|
|
"description": "Exact removed snapshot, null for dry runs.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/$defs/CleanupSnapshot"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"target": {
|
|
"description": "Resolved cleanup target.",
|
|
"$ref": "#/$defs/CleanupTarget"
|
|
}
|
|
},
|
|
"required": [
|
|
"mode",
|
|
"target",
|
|
"matched"
|
|
]
|
|
},
|
|
"CleanupMode": {
|
|
"description": "Cleanup mode.",
|
|
"oneOf": [
|
|
{
|
|
"description": "Data was removed.",
|
|
"type": "string",
|
|
"const": "executed"
|
|
},
|
|
{
|
|
"description": "No data was removed.",
|
|
"type": "string",
|
|
"const": "dry_run"
|
|
}
|
|
]
|
|
},
|
|
"CleanupSnapshot": {
|
|
"description": "Counts and disk usage associated with cleanup targets.",
|
|
"type": "object",
|
|
"properties": {
|
|
"analyses": {
|
|
"description": "Complete Analyses.",
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0
|
|
},
|
|
"analysis_profile_sha256": {
|
|
"description": "Unique bytewise-sorted Analysis Profile digests.",
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/Digest"
|
|
}
|
|
},
|
|
"artifacts": {
|
|
"description": "Query Artifacts.",
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0
|
|
},
|
|
"diagnostic_logs": {
|
|
"description": "Diagnostic Log bundles.",
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0
|
|
},
|
|
"quarantined_analyses": {
|
|
"description": "Quarantined Analyses.",
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0
|
|
},
|
|
"usage": {
|
|
"description": "Logical and allocated usage.",
|
|
"$ref": "#/$defs/StorageUsage"
|
|
}
|
|
},
|
|
"required": [
|
|
"analyses",
|
|
"quarantined_analyses",
|
|
"artifacts",
|
|
"diagnostic_logs",
|
|
"usage",
|
|
"analysis_profile_sha256"
|
|
]
|
|
},
|
|
"CleanupTarget": {
|
|
"description": "Resolved cleanup target.",
|
|
"oneOf": [
|
|
{
|
|
"description": "Digest resolved from a caller Sample.",
|
|
"type": "object",
|
|
"properties": {
|
|
"kind": {
|
|
"type": "string",
|
|
"const": "sample"
|
|
},
|
|
"sha256": {
|
|
"description": "Resolved content identity.",
|
|
"$ref": "#/$defs/Digest"
|
|
},
|
|
"source_path": {
|
|
"description": "Exact caller path.",
|
|
"$ref": "#/$defs/TaggedPath"
|
|
}
|
|
},
|
|
"required": [
|
|
"kind",
|
|
"source_path",
|
|
"sha256"
|
|
]
|
|
},
|
|
{
|
|
"description": "Caller-supplied digest.",
|
|
"type": "object",
|
|
"properties": {
|
|
"kind": {
|
|
"type": "string",
|
|
"const": "digest"
|
|
},
|
|
"sha256": {
|
|
"description": "Selected content identity.",
|
|
"$ref": "#/$defs/Digest"
|
|
}
|
|
},
|
|
"required": [
|
|
"kind",
|
|
"sha256"
|
|
]
|
|
},
|
|
{
|
|
"description": "Entire Analysis Store.",
|
|
"type": "object",
|
|
"properties": {
|
|
"kind": {
|
|
"type": "string",
|
|
"const": "all"
|
|
}
|
|
},
|
|
"required": [
|
|
"kind"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"Digest": {
|
|
"description": "A lowercase SHA-256 digest.",
|
|
"type": "string"
|
|
},
|
|
"InlineOrArtifact": {
|
|
"description": "Successful command data emitted inline or represented by a complete Artifact.",
|
|
"anyOf": [
|
|
{
|
|
"description": "Complete command-specific data.",
|
|
"$ref": "#/$defs/CleanupData"
|
|
},
|
|
{
|
|
"description": "Bounded descriptor for the complete stored success response.",
|
|
"$ref": "#/$defs/SpilledData"
|
|
}
|
|
]
|
|
},
|
|
"SandboxBackend": {
|
|
"description": "Sandbox backend.",
|
|
"oneOf": [
|
|
{
|
|
"description": "Bubblewrap namespaces.",
|
|
"type": "string",
|
|
"const": "bubblewrap"
|
|
},
|
|
{
|
|
"description": "Caller-supplied isolation.",
|
|
"type": "string",
|
|
"const": "external"
|
|
},
|
|
{
|
|
"description": "Isolation disabled.",
|
|
"type": "string",
|
|
"const": "off"
|
|
}
|
|
]
|
|
},
|
|
"SandboxProvenance": {
|
|
"description": "Worker sandbox provenance.",
|
|
"type": "object",
|
|
"properties": {
|
|
"backend": {
|
|
"description": "Selected backend.",
|
|
"$ref": "#/$defs/SandboxBackend"
|
|
},
|
|
"verification": {
|
|
"description": "Isolation verification state.",
|
|
"$ref": "#/$defs/SandboxVerification"
|
|
}
|
|
},
|
|
"required": [
|
|
"backend",
|
|
"verification"
|
|
]
|
|
},
|
|
"SandboxVerification": {
|
|
"description": "Sandbox verification state.",
|
|
"oneOf": [
|
|
{
|
|
"description": "Verified by `ghidr`.",
|
|
"type": "string",
|
|
"const": "verified"
|
|
},
|
|
{
|
|
"description": "Declared but not verifiable by `ghidr`.",
|
|
"type": "string",
|
|
"const": "unverified"
|
|
},
|
|
{
|
|
"description": "Explicitly disabled.",
|
|
"type": "string",
|
|
"const": "disabled"
|
|
}
|
|
]
|
|
},
|
|
"SpilledData": {
|
|
"description": "Public data shape returned when a complete success exceeds the inline byte budget.",
|
|
"type": "object",
|
|
"properties": {
|
|
"artifact": {
|
|
"description": "Immutable complete-success Artifact.",
|
|
"$ref": "#/$defs/ArtifactDescriptor"
|
|
},
|
|
"spilled": {
|
|
"description": "Always true for this variant.",
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"spilled",
|
|
"artifact"
|
|
]
|
|
},
|
|
"StorageUsage": {
|
|
"description": "Filesystem usage represented without implying freed space.",
|
|
"type": "object",
|
|
"properties": {
|
|
"allocated_bytes": {
|
|
"description": "Sum of Linux allocated blocks including directories.",
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0
|
|
},
|
|
"logical_bytes": {
|
|
"description": "Sum of file lengths.",
|
|
"type": "integer",
|
|
"format": "uint64",
|
|
"minimum": 0
|
|
}
|
|
},
|
|
"required": [
|
|
"logical_bytes",
|
|
"allocated_bytes"
|
|
]
|
|
},
|
|
"StoreSource": {
|
|
"description": "Analysis Store resolution source.",
|
|
"oneOf": [
|
|
{
|
|
"description": "Explicit `--store` flag.",
|
|
"type": "string",
|
|
"const": "cli"
|
|
},
|
|
{
|
|
"description": "`GHIDR_STORE` environment variable.",
|
|
"type": "string",
|
|
"const": "environment"
|
|
},
|
|
{
|
|
"description": "Explicit `XDG_CACHE_HOME` fallback.",
|
|
"type": "string",
|
|
"const": "xdg"
|
|
},
|
|
{
|
|
"description": "Home-directory fallback.",
|
|
"type": "string",
|
|
"const": "home_fallback"
|
|
}
|
|
]
|
|
},
|
|
"TaggedPath": {
|
|
"description": "A path preserving either UTF-8 text or exact Unix bytes.",
|
|
"oneOf": [
|
|
{
|
|
"description": "An unmodified UTF-8 path.",
|
|
"type": "object",
|
|
"properties": {
|
|
"encoding": {
|
|
"type": "string",
|
|
"const": "utf8"
|
|
},
|
|
"value": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"encoding",
|
|
"value"
|
|
]
|
|
},
|
|
{
|
|
"description": "Standard padded Base64 over exact Unix path bytes.",
|
|
"type": "object",
|
|
"properties": {
|
|
"encoding": {
|
|
"type": "string",
|
|
"const": "unix_bytes_base64"
|
|
},
|
|
"value": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"encoding",
|
|
"value"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"ToolProvenance": {
|
|
"description": "Minimal provenance available to non-Sample operations.",
|
|
"type": "object",
|
|
"properties": {
|
|
"adapter_protocol_version": {
|
|
"description": "Rust/Java protocol version.",
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0
|
|
},
|
|
"analysis_store": {
|
|
"description": "Selected Analysis Store.",
|
|
"$ref": "#/$defs/AnalysisStoreProvenance"
|
|
},
|
|
"ghidr_version": {
|
|
"description": "CLI package version.",
|
|
"type": "string"
|
|
},
|
|
"sandbox": {
|
|
"description": "Selected sandbox policy.",
|
|
"$ref": "#/$defs/SandboxProvenance"
|
|
}
|
|
},
|
|
"required": [
|
|
"ghidr_version",
|
|
"adapter_protocol_version",
|
|
"analysis_store",
|
|
"sandbox"
|
|
]
|
|
},
|
|
"Warning": {
|
|
"description": "Stable non-fatal warning.",
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"description": "Stable machine identifier.",
|
|
"type": "string"
|
|
},
|
|
"details": {
|
|
"description": "Warning-specific context, always an object.",
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
},
|
|
"message": {
|
|
"description": "Concise human context.",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"code",
|
|
"message",
|
|
"details"
|
|
]
|
|
}
|
|
}
|
|
}
|