feat: scaffold v0.1 foundation
This commit is contained in:
parent
c4fb0c6a01
commit
170ca32f58
34 changed files with 6175 additions and 5 deletions
507
schemas/v1/decompilation.schema.json
Normal file
507
schemas/v1/decompilation.schema.json
Normal file
|
|
@ -0,0 +1,507 @@
|
|||
{
|
||||
"$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/DecompilationData"
|
||||
},
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"const": "decompilation"
|
||||
},
|
||||
"provenance": {
|
||||
"description": "Reproducibility and execution context.",
|
||||
"$ref": "#/$defs/QueryProvenance"
|
||||
},
|
||||
"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": {
|
||||
"Address": {
|
||||
"description": "A Ghidra address with an explicit, case-sensitive address space.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"offset": {
|
||||
"description": "Canonical lowercase, `0x`-prefixed, even-width hexadecimal offset.",
|
||||
"type": "string"
|
||||
},
|
||||
"space": {
|
||||
"description": "Exact Ghidra address-space name.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"space",
|
||||
"offset"
|
||||
]
|
||||
},
|
||||
"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"
|
||||
]
|
||||
},
|
||||
"DecompilationData": {
|
||||
"description": "Successful targeted decompilation data.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"decompilation": {
|
||||
"description": "Complete normalized Ghidra C-like text.",
|
||||
"$ref": "#/$defs/DecompiledText"
|
||||
},
|
||||
"function": {
|
||||
"description": "Unambiguously resolved Function.",
|
||||
"$ref": "#/$defs/SelectedFunction"
|
||||
},
|
||||
"requested_selector": {
|
||||
"description": "Exact selector supplied by the caller.",
|
||||
"$ref": "#/$defs/FunctionSelector"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"requested_selector",
|
||||
"function",
|
||||
"decompilation"
|
||||
]
|
||||
},
|
||||
"DecompilationSyntax": {
|
||||
"description": "Decompiled text representation.",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "Ghidra's C-like representation.",
|
||||
"type": "string",
|
||||
"const": "ghidra_c"
|
||||
}
|
||||
]
|
||||
},
|
||||
"DecompiledText": {
|
||||
"description": "Complete decompiler text.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"syntax": {
|
||||
"description": "Always `ghidra_c` in version 0.1.",
|
||||
"$ref": "#/$defs/DecompilationSyntax"
|
||||
},
|
||||
"text": {
|
||||
"description": "Complete text with only line endings normalized to LF.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"syntax",
|
||||
"text"
|
||||
]
|
||||
},
|
||||
"Digest": {
|
||||
"description": "A lowercase SHA-256 digest.",
|
||||
"type": "string"
|
||||
},
|
||||
"FunctionSelector": {
|
||||
"description": "Exactly one explicit Function Selector.",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "Exact, case-sensitive Ghidra function name.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"const": "name"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind",
|
||||
"value"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Exact function entry address.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"const": "address"
|
||||
},
|
||||
"value": {
|
||||
"$ref": "#/$defs/Address"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind",
|
||||
"value"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"Limits": {
|
||||
"description": "Resource policy selected for one invocation.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"analysis_timeout_seconds": {
|
||||
"description": "Native analysis timeout.",
|
||||
"$ref": "#/$defs/PositiveU64"
|
||||
},
|
||||
"child_watchdog_seconds": {
|
||||
"description": "Derived process watchdog.",
|
||||
"$ref": "#/$defs/PositiveU64"
|
||||
},
|
||||
"decompile_timeout_seconds": {
|
||||
"description": "Optional native decompilation timeout.",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/$defs/PositiveU64"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"max_cpu": {
|
||||
"description": "Maximum Ghidra analysis CPU count.",
|
||||
"$ref": "#/$defs/PositiveU64"
|
||||
},
|
||||
"max_heap_mib": {
|
||||
"description": "Maximum Java heap, in MiB.",
|
||||
"$ref": "#/$defs/PositiveU64"
|
||||
},
|
||||
"max_inline_bytes": {
|
||||
"description": "Maximum serialized successful stdout size.",
|
||||
"$ref": "#/$defs/PositiveU64"
|
||||
},
|
||||
"max_sample_bytes": {
|
||||
"description": "Maximum accepted Sample size.",
|
||||
"$ref": "#/$defs/PositiveU64"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"max_heap_mib",
|
||||
"max_cpu",
|
||||
"analysis_timeout_seconds",
|
||||
"child_watchdog_seconds",
|
||||
"max_sample_bytes",
|
||||
"max_inline_bytes"
|
||||
]
|
||||
},
|
||||
"PositiveU64": {
|
||||
"description": "A validated positive integer accepted by resource-limit flags.",
|
||||
"type": "integer",
|
||||
"format": "uint64",
|
||||
"minimum": 1
|
||||
},
|
||||
"QueryProvenance": {
|
||||
"description": "Fixed provenance for every Sample-backed Query.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"adapter_protocol_version": {
|
||||
"description": "Rust/Java protocol version.",
|
||||
"type": "integer",
|
||||
"format": "uint32",
|
||||
"minimum": 0
|
||||
},
|
||||
"analysis_profile_sha256": {
|
||||
"description": "Canonical Analysis Profile identity.",
|
||||
"$ref": "#/$defs/Digest"
|
||||
},
|
||||
"analysis_store": {
|
||||
"description": "Selected Analysis Store.",
|
||||
"$ref": "#/$defs/AnalysisStoreProvenance"
|
||||
},
|
||||
"ghidr_version": {
|
||||
"description": "CLI package version.",
|
||||
"type": "string"
|
||||
},
|
||||
"ghidra_version": {
|
||||
"description": "Ghidra version.",
|
||||
"type": "string"
|
||||
},
|
||||
"java_version": {
|
||||
"description": "Java major version.",
|
||||
"type": "string"
|
||||
},
|
||||
"limits": {
|
||||
"description": "Selected and derived resource limits.",
|
||||
"$ref": "#/$defs/Limits"
|
||||
},
|
||||
"sample_sha256": {
|
||||
"description": "Sample content identity.",
|
||||
"$ref": "#/$defs/Digest"
|
||||
},
|
||||
"sandbox": {
|
||||
"description": "Selected sandbox policy.",
|
||||
"$ref": "#/$defs/SandboxProvenance"
|
||||
},
|
||||
"source_path": {
|
||||
"description": "Exact caller-supplied path.",
|
||||
"$ref": "#/$defs/TaggedPath"
|
||||
},
|
||||
"target": {
|
||||
"description": "Resolved Target Specification and verification.",
|
||||
"$ref": "#/$defs/TargetProvenance"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"ghidr_version",
|
||||
"adapter_protocol_version",
|
||||
"ghidra_version",
|
||||
"java_version",
|
||||
"sample_sha256",
|
||||
"source_path",
|
||||
"analysis_profile_sha256",
|
||||
"target",
|
||||
"analysis_store",
|
||||
"sandbox",
|
||||
"limits"
|
||||
]
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
},
|
||||
"SelectedFunction": {
|
||||
"description": "Identity of a selected Function.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"entry": {
|
||||
"description": "Entry Address.",
|
||||
"$ref": "#/$defs/Address"
|
||||
},
|
||||
"name": {
|
||||
"description": "Exact basename.",
|
||||
"type": "string"
|
||||
},
|
||||
"qualified_name": {
|
||||
"description": "Exact fully-qualified name.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"qualified_name",
|
||||
"entry"
|
||||
]
|
||||
},
|
||||
"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"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"TargetProvenance": {
|
||||
"description": "Target Specification provenance.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"compiler_specification": {
|
||||
"description": "Exact compiler-specification identifier.",
|
||||
"type": "string"
|
||||
},
|
||||
"format": {
|
||||
"description": "Executable format name.",
|
||||
"type": "string"
|
||||
},
|
||||
"loader": {
|
||||
"description": "Exact loader identifier.",
|
||||
"type": "string"
|
||||
},
|
||||
"processor_language": {
|
||||
"description": "Exact processor-language identifier.",
|
||||
"type": "string"
|
||||
},
|
||||
"verification": {
|
||||
"description": "Project integration-test coverage.",
|
||||
"$ref": "#/$defs/TargetVerification"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"loader",
|
||||
"format",
|
||||
"processor_language",
|
||||
"compiler_specification",
|
||||
"verification"
|
||||
]
|
||||
},
|
||||
"TargetVerification": {
|
||||
"description": "Project integration-test coverage for a recognized target.",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "Covered by version 0.1 real-Ghidra fixtures.",
|
||||
"type": "string",
|
||||
"const": "verified"
|
||||
},
|
||||
{
|
||||
"description": "Recognized by Ghidra but outside the tested matrix.",
|
||||
"type": "string",
|
||||
"const": "unverified"
|
||||
}
|
||||
]
|
||||
},
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue