feat(native): report code-signing posture in inspect_signature

inspect_signature reduced the CodeDirectory to a hardened-runtime boolean
and never verified the signature. It now also reports:

- the parsed CodeDirectory: version, flags decoded from their numeric
  value (runtime, library-validation, restrict, kill, adhoc,
  linker-signed, unknown bits in hex), code and special slot counts,
  location, hash type, platform identifier, runtime version, and
  executable-segment flags;
- sealed resources (version, rules, files, or none);
- a local `codesign --verify --strict` result on the opened bundle or
  Mach-O, with diagnostics and the sorted nested code it validated;
- whether a notarization ticket is stapled at Contents/CodeResources,
  with its digest. The ticket and Apple's records are not checked
  because that needs the network;
- derived security facets with their supporting evidence: library
  validation, DYLD_* handling, debugger attach, executable-memory
  policy, and App Sandbox. Facets stay unknown when flags or aggregate
  entitlements are unavailable.

verify:code-signature re-signs copies of the clang-built fixture with
real codesign (ad hoc, hardened runtime, hardened runtime with relaxing
entitlements, library,restrict). It also checks a platform binary and a
tampered bundle, with CLI/MCP parity, and runs in the macOS CI job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-07 11:16:55 +00:00
co-authored by Claude Opus 5.5
parent dcde958450
commit 25ca63f231
19 changed files with 1247 additions and 10 deletions
+22
View File
@@ -12,6 +12,28 @@ input file and include the observed lipo slice offset for universal binaries.
If that offset is unavailable, segment evidence locations are omitted with an
explicit limitation; architecture inventory locations remain available.
- `inspect_signature` / `rea inspect-signature <app-or-mach-o>` reports
codesign identity, requirements and entitlements, and adds:
- **Observed facts:**
- the parsed CodeDirectory, with flags decoded from their numeric value
(`runtime`, `library-validation`, `restrict`, `kill`, `adhoc`,
`linker-signed`, …), slot counts, platform identifier and runtime
version;
- sealed resources;
- a local `codesign --verify --strict` result, with diagnostics and the
nested code it validated;
- whether a notarization ticket is stapled at `Contents/CodeResources`.
The ticket itself and Apple's notarization record are not checked,
because that needs the network.
- **Derived `security_facets`**, each with the flags or entitlements that
support it:
- library validation;
- whether dyld honors `DYLD_*` variables;
- debugger attach;
- executable-memory policy;
- App Sandbox.
System Integrity Protection, AMFI and setuid policy are not evaluated.
- `inspect_asset_catalog` / `rea inspect-asset-catalog <app>` reads compiled
`Assets.car` metadata through macOS `assetutil --info`. Catalog digests, raw
rendition fields, pagination and exact UI resource-name matches are returned.
+3 -3
View File
@@ -7,7 +7,7 @@
"client": "2.3.1",
"core": "2.3.1"
},
"skill_version": "27"
"skill_version": "28"
},
"tools": {
"total": 131,
@@ -669,9 +669,9 @@
"mcp_prompts": 6
},
"digests": {
"tools_sha256": "d0b9e5c99d6a2c9bdf065429db901231326a7de5910f2d878cee124891dba57e",
"tools_sha256": "1b01577d3ad5b8815e08a52a5681c2af738935c43695b4a21d36f1d26333e680",
"prompts_sha256": "ef2de8814390b340623c32001610aa2709d90bed51537b6e562ab3abf144ab4d",
"combined_sha256": "188d726867808cd63764625b93d89e2936af29d9943dbc0e5d22044294521e1d",
"combined_sha256": "07b4bcbc620ade41ffa4da3a5676d92fe3e7366fc60eebdb543bec7ba359d3f8",
"providers_sha256": "a7d885531ee25d42c51385444faec544d34cd7eba6250a7dc75c4faedd4454a3"
}
}
+7
View File
@@ -71,6 +71,13 @@ an XML graph golden. `verify:asset-catalog` compiles source-owned colors with
`actool`, invokes real `assetutil`, then checks CLI/MCP results, exact catalog
digest, every raw metadata field, pagination and malformed input rejection.
Neither artifact workflow requires Hopper or launches it. Both run in macOS CI.
`verify:code-signature` needs only macOS with Command Line Tools. It re-signs
copies of a clang-built fixture with real `codesign`: ad hoc, hardened
runtime, hardened runtime with relaxing entitlements, and `library,restrict`
flags. It checks that `inspect-signature` decodes those flags and derives the
expected security facets. It also checks a platform binary, which must report a
platform identifier, and a bundle with an added unsealed file, which must fail
strict verification. CLI and stdio MCP results must match.
`verify:macos-bundle` needs only macOS with Command Line Tools. It compiles a
source-owned app with `clang`: a versioned framework, XPC services, an app
extension, a login item, a privileged helper, launchd plists, and a helper tool,
@@ -1,5 +1,5 @@
{
"manifest_id": "ecm_4bb7d6acd148fffbd7e696cd56b22ed7a031fcb4b51473170058b4a9e902ee44",
"manifest_id": "ecm_7c023e043e069545c78f60e894c1f66a357a9b9435a1f1b3ade09eb7b1a821f1",
"verifier": {
"id": "rea-managed-conformance",
"version": "1"
@@ -13,7 +13,7 @@
"skill_digests": [
{
"skill_id": "reverse-engineer-anything",
"sha256": "1738df3db4b39d4967e40cc147d24393fd8e1e21fc4f7b7b45da30ce8880c2a9"
"sha256": "81e7b30e94cec01efa31f18553919665b3617282f5cc23ee01a3e158ef665468"
}
],
"claims": [