docs(managed): align normalized CIL claims with shipped v1 semantics
This commit is contained in:
@@ -4,9 +4,10 @@
|
||||
- Date: 2026-07-16
|
||||
- Implementation status: Read-only PE/CLI triage and exact identity are shipped
|
||||
through `inspect_managed_artifact` / `rea inspect-managed-artifact`. Bounded
|
||||
metadata, signatures, method bodies, normalized CIL, exception regions, call
|
||||
edges, and field-access anchors are shipped through `inspect_managed_members`
|
||||
/ `rea inspect-managed-members`. Static member comparison and build-local
|
||||
metadata, signatures, method bodies, raw CIL hashes, limited
|
||||
decoded-instruction-tuple v1 hashes, exception regions, call edges, and
|
||||
field-access anchors are shipped through `inspect_managed_members`; `rea
|
||||
inspect-managed-members` provides CLI parity. Static member comparison and build-local
|
||||
token remapping are shipped through `compare_managed_members` /
|
||||
`rea compare-managed-members`. Declaration-only managed/native boundary
|
||||
inventory for ModuleRef, ImplMap/PInvoke, ReadyToRun indicators, and non-IL
|
||||
@@ -216,22 +217,50 @@ Method observations add:
|
||||
declaring type + normalized CLI signature
|
||||
build-local metadata token
|
||||
RVA/file extent when present
|
||||
exact method-body SHA-256
|
||||
normalized-CIL schema version + SHA-256 when CIL is valid
|
||||
max stack + locals signature + exception-region commitment
|
||||
raw CIL byte length + SHA-256 when the body is admitted
|
||||
member-result schema version + decoded-instruction-tuple SHA-256 when CIL is valid
|
||||
separate max-stack, locals-token, and exception-region observations
|
||||
```
|
||||
|
||||
The exact body hash commits header bytes, CIL bytes, and admitted extra
|
||||
sections. Normalized CIL decodes instructions, converts branch operands to
|
||||
instruction coordinates, and resolves metadata operands to canonical
|
||||
signatures or literal identities under a versioned algorithm. It preserves
|
||||
opcode, prefix, constant, local/argument, generic, and exception semantics. It
|
||||
does not erase differences merely to make two builds match.
|
||||
The shipped `il_sha256` commits only the raw CIL byte stream identified by the
|
||||
method header's `il_size`. It does not commit the method header, local-signature
|
||||
blob, alignment padding, or extra sections such as exception clauses. Those
|
||||
facts remain separate observations and the enclosing artifact SHA-256 binds
|
||||
them to the exact file. A digest over the complete method body is not shipped.
|
||||
|
||||
The caller-visible field remains named `normalized_il_sha256`, but its shipped
|
||||
v1 meaning is deliberately narrower than a canonical semantic CIL identity.
|
||||
For a completely decoded method, REA serializes the instruction-order array of
|
||||
`[opcode, operand_kind, operand]` tuples with JavaScript `JSON.stringify`,
|
||||
encodes that text as UTF-8, and reports its lowercase SHA-256. The member
|
||||
result's `schema_version: 1` scopes this convention; there is no independent
|
||||
normalized-CIL algorithm-version field in v1.
|
||||
|
||||
Operands retain the current decoder projection: metadata and user-string
|
||||
operands are build-local lowercase hexadecimal tokens, scalar branch operands
|
||||
are decimal target CIL byte offsets, and `switch` retains only its decimal case
|
||||
count. Constants and variable indexes are decimal strings; an operand-free
|
||||
instruction uses kind `none` and value `null`. Opcode names preserve distinct
|
||||
short forms and prefix instructions, but instruction offsets, branch target
|
||||
instruction identity, switch targets, resolved token identities, method
|
||||
headers, locals, and exception regions are not part of this digest. A partial
|
||||
or malformed decode has no `normalized_il_sha256`.
|
||||
|
||||
Consequently v1 is a deterministic decoded-tuple fingerprint, not proof of
|
||||
semantic equivalence. In particular, methods with the same opcodes and switch
|
||||
case counts can share it despite different switch targets, and token movement
|
||||
can change it without a semantic change. Cross-build comparison may use it as
|
||||
one unique-only structural tier while retaining artifact/MVID commitments and
|
||||
ambiguity; it must not describe the digest itself as token-remapped canonical
|
||||
CIL. Canonical operand resolution, complete control-flow operands,
|
||||
exception/local commitments, and an explicit algorithm version require a new
|
||||
normalized-CIL schema.
|
||||
|
||||
Metadata tokens are reported because they are precise coordinates inside one
|
||||
module. Cross-version identity never consists of a token alone. A structural
|
||||
match cites both build commitments, both local tokens, the normalized inputs,
|
||||
the matching algorithm version, and all competing candidates.
|
||||
match cites both build commitments, both local tokens, the v1 tuple inputs, the
|
||||
member-result schema version, and all competing candidates. V1 cannot cite a
|
||||
separate matching-algorithm version because none is exposed.
|
||||
|
||||
### 5. Separate five evidence layers
|
||||
|
||||
@@ -356,8 +385,9 @@ requires its own threat model and admission decision.
|
||||
coverage; it never returns a partial list labeled complete.
|
||||
- Managed addresses distinguish file offsets, RVAs, native virtual addresses,
|
||||
metadata tokens, and CIL offsets. They are not interchangeable.
|
||||
- Cache compatibility is exact on artifact/component commitment, parser
|
||||
profile, normalized-CIL schema, and producer version.
|
||||
- Cache compatibility is exact on artifact/component commitment, member-result
|
||||
schema, parser profile, and producer version. For shipped v1,
|
||||
`normalized_il_sha256` has no independent algorithm-version field.
|
||||
- Provider-neutral workflows may compose canonical managed findings with the
|
||||
one native binding, but every source operation retains its actual producer.
|
||||
|
||||
@@ -400,7 +430,9 @@ or development-only oracles.
|
||||
## Rollout gates
|
||||
|
||||
1. Add read-only triage and identity with malformed-input bounds. Shipped.
|
||||
2. Add metadata, signatures, method bodies, normalized CIL, and exact Evidence. Shipped.
|
||||
2. Add metadata, signatures, method bodies, deterministic decoded-CIL tuple
|
||||
fingerprints, and exact artifact Evidence. Shipped with the v1 limitations
|
||||
above; full normalized-CIL semantics remain planned.
|
||||
3. Add obfuscation-resistant slices and cross-build match states. Shipped.
|
||||
4. Compose explicit managed/native boundaries with Hopper/Ghidra. Declaration
|
||||
inventory and native export/function Evidence matching shipped; native-body
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<h1>Type Alias ManagedArtifactInspection</h1></div>
|
||||
<div class="tsd-signature"><span class="tsd-kind-type-alias">ManagedArtifactInspection</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">z.infer</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-keyword">typeof</span> <a href="../variables/domain_managedArtifact.managedArtifactInspectionSchema.html" class="tsd-signature-type tsd-kind-variable">managedArtifactInspectionSchema</a><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L488">src/domain/managedArtifact.ts:488</a></li></ul></aside></div>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L496">src/domain/managedArtifact.ts:496</a></li></ul></aside></div>
|
||||
<div class="col-sidebar">
|
||||
<div class="page-menu">
|
||||
<div class="tsd-navigation settings">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<h1>Type Alias ManagedMemberInspection</h1></div>
|
||||
<div class="tsd-signature"><span class="tsd-kind-type-alias">ManagedMemberInspection</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">z.infer</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-keyword">typeof</span> <a href="../variables/domain_managedArtifact.managedMemberInspectionSchema.html" class="tsd-signature-type tsd-kind-variable">managedMemberInspectionSchema</a><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L491">src/domain/managedArtifact.ts:491</a></li></ul></aside></div>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L499">src/domain/managedArtifact.ts:499</a></li></ul></aside></div>
|
||||
<div class="col-sidebar">
|
||||
<div class="page-menu">
|
||||
<div class="tsd-navigation settings">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<h1>Type Alias ManagedNativeBoundaryInspection</h1></div>
|
||||
<div class="tsd-signature"><span class="tsd-kind-type-alias">ManagedNativeBoundaryInspection</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">z.infer</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-keyword">typeof</span> <a href="../variables/domain_managedArtifact.managedNativeBoundaryInspectionSchema.html" class="tsd-signature-type tsd-kind-variable">managedNativeBoundaryInspectionSchema</a><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L494">src/domain/managedArtifact.ts:494</a></li></ul></aside></div>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L502">src/domain/managedArtifact.ts:502</a></li></ul></aside></div>
|
||||
<div class="col-sidebar">
|
||||
<div class="page-menu">
|
||||
<div class="tsd-navigation settings">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<h1>Type Alias ManagedParseIssue</h1></div>
|
||||
<div class="tsd-signature"><span class="tsd-kind-type-alias">ManagedParseIssue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">z.infer</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-keyword">typeof</span> <span class="tsd-signature-type">managedParseIssueSchema</span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L497">src/domain/managedArtifact.ts:497</a></li></ul></aside></div>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L505">src/domain/managedArtifact.ts:505</a></li></ul></aside></div>
|
||||
<div class="col-sidebar">
|
||||
<div class="page-menu">
|
||||
<div class="tsd-navigation settings">
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -15,7 +15,7 @@
|
||||
<div class="tsd-comment tsd-typography"><p>Provider-neutral, execution-free PE/CLI triage and identity result.</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L308">src/domain/managedArtifact.ts:308</a></li></ul></aside></div>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L316">src/domain/managedArtifact.ts:316</a></li></ul></aside></div>
|
||||
<div class="col-sidebar">
|
||||
<div class="page-menu">
|
||||
<div class="tsd-navigation settings">
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<div class="tsd-comment tsd-typography"><p>Provider-neutral, execution-free metadata/signature/IL member inspection.</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L404">src/domain/managedArtifact.ts:404</a></li></ul></aside></div>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L412">src/domain/managedArtifact.ts:412</a></li></ul></aside></div>
|
||||
<div class="col-sidebar">
|
||||
<div class="page-menu">
|
||||
<div class="tsd-navigation settings">
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<div class="tsd-comment tsd-typography"><p>Provider-neutral managed/native boundary observations from PE/CLI metadata.</p>
|
||||
</div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L440">src/domain/managedArtifact.ts:440</a></li></ul></aside></div>
|
||||
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/domain/managedArtifact.ts#L448">src/domain/managedArtifact.ts:448</a></li></ul></aside></div>
|
||||
<div class="col-sidebar">
|
||||
<div class="page-menu">
|
||||
<div class="tsd-navigation settings">
|
||||
|
||||
@@ -104,8 +104,50 @@ EncBaseId because ECMA-335 metadata does not require those bit patterns.
|
||||
- row/heap/body locations expressed as typed file offsets, RVAs, or CIL
|
||||
offsets;
|
||||
- exact raw bytes or bounded value digest;
|
||||
- method body, normalized CIL, locals, exception-region, and generic-context
|
||||
commitments where applicable.
|
||||
- raw CIL digest plus separately reported method-header, locals-token, and
|
||||
exception-region observations where available;
|
||||
- a deterministic v1 decoded-instruction-tuple digest for completely decoded
|
||||
CIL, with the limitations below.
|
||||
|
||||
### Shipped decoded-CIL fingerprint v1
|
||||
|
||||
`inspect_managed_members` exposes two method CIL hashes with different byte
|
||||
boundaries:
|
||||
|
||||
| Field | Shipped v1 input | Excluded from the digest |
|
||||
| ---------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `il_sha256` | The exact `il_size` raw CIL bytes after the tiny or fat method header | Method header, locals signature blob, alignment, and extra sections including exception clauses |
|
||||
| `normalized_il_sha256` | UTF-8 `JSON.stringify` output for the instruction-order array of `[opcode, operand_kind, operand]` tuples | Instruction offsets except projected scalar branch targets, switch targets, resolved metadata/string identities, method header, locals, and exception regions |
|
||||
|
||||
The normalized field is available only when the entire CIL stream decodes with
|
||||
status `present`. A partial, malformed, absent, or over-limit body reports
|
||||
`null`. The containing member result's `schema_version: 1` scopes the tuple
|
||||
format; v1 does not expose a separate algorithm-version field.
|
||||
|
||||
Tuple operands use these exact projections:
|
||||
|
||||
- operand-free instructions: `none` and `null`;
|
||||
- metadata and user-string operands: the build-local token as lowercase
|
||||
`0x`-prefixed eight-digit hexadecimal;
|
||||
- scalar branches: the target CIL byte offset as a decimal string;
|
||||
- `switch`: the case count as a decimal string, without target offsets;
|
||||
- signed integer and variable operands: decimal strings; floating-point
|
||||
operands: JavaScript's `String` representation of the decoded IEEE value.
|
||||
|
||||
Opcode names retain short/long forms and prefix opcodes. This makes v1 a
|
||||
reproducible decoded-tuple fingerprint, not a canonical semantic CIL identity:
|
||||
it does not resolve tokens across MVIDs, does not commit full control flow or
|
||||
exception semantics, and does not replace the raw CIL digest. Cross-build
|
||||
comparison uses the value only as one unique-only structural tier and reports
|
||||
ambiguity when that evidence is insufficient. A future normalized-CIL v2 must
|
||||
have an explicit algorithm version, canonical token/literal identities,
|
||||
complete branch and switch targets, and explicit locals/exception semantics.
|
||||
|
||||
For example, a decoded `nop; ret` body serializes exactly as
|
||||
`[["nop","none",null],["ret","none",null]]` and has v1 digest
|
||||
`5e5fad7741cb44bca3a4f045546b7449990da343f612f5f34c0ca30e9eee0636`.
|
||||
This vector specifies the tuple order, `null` handling, absence of whitespace,
|
||||
UTF-8 encoding, and lowercase hexadecimal output.
|
||||
|
||||
### Epistemic commitment
|
||||
|
||||
@@ -163,7 +205,8 @@ bounded set of observations needed to investigate a proposition:
|
||||
- exact strings, numeric constants, enum-like values, and serialization keys;
|
||||
- branch, switch, exception, loop, call, and field-flow shape;
|
||||
- construction and generic-instantiation sites;
|
||||
- exact body and normalized-CIL commitments;
|
||||
- raw CIL and decoded-tuple-v1 commitments, plus separate header, locals, and
|
||||
exception observations;
|
||||
- callers, callees, shared fields, and competing candidates; and
|
||||
- limitations from reflection, dynamic dispatch, generated code, protection,
|
||||
native transitions, or incomplete coverage.
|
||||
@@ -174,12 +217,14 @@ turn that role into the method's durable identity.
|
||||
|
||||
Cross-version matching is two-stage:
|
||||
|
||||
1. Exact identity requires compatible artifact/module commitments and an exact
|
||||
entity/body identity.
|
||||
2. Structural identity compares schema-versioned signatures, normalized CIL,
|
||||
APIs, constants, and bounded graph context. It reports all candidates at the
|
||||
winning score and remains ambiguous when the evidence does not distinguish
|
||||
them.
|
||||
1. Exact identity requires compatible artifact/module commitments and exact
|
||||
raw CIL identity; v1 does not expose a standalone complete-method-body
|
||||
digest.
|
||||
2. Structural identity compares schema-versioned signatures, the limited v1
|
||||
decoded-CIL tuple fingerprint, constants, and bounded shape context. It
|
||||
reports all candidates at the winning score and remains ambiguous when the
|
||||
evidence does not distinguish them. The v1 digest does not itself remap
|
||||
metadata tokens.
|
||||
|
||||
Tokens are always remapped through observed structure. A caller cannot carry
|
||||
`0x06001234` into a new MVID and assume it names the same method.
|
||||
@@ -330,7 +375,8 @@ manifest supplies those fields. It then pages each declared MethodDef token
|
||||
directly by row, so selected methods do not need to appear in the first member
|
||||
page of a large application. `il_length` remains accepted as a legacy alias for
|
||||
`il_size`; optional `il_sha256` locks the exact raw CIL bytes in addition to
|
||||
REA's schema-versioned normalized instruction digest.
|
||||
REA's member-result-v1 decoded-instruction-tuple digest. That normalized field
|
||||
has the v1 limits documented above and is not a complete semantic CIL identity.
|
||||
|
||||
The optional `application_graph` block reuses those exact-build method
|
||||
commitments. For each referenced MethodDef token, the verifier builds a bounded
|
||||
@@ -378,7 +424,9 @@ The managed-code track advances as reviewable pull requests:
|
||||
|
||||
1. accepted evidence/provider boundary (this document and ADR);
|
||||
2. read-only artifact triage and exact identity (shipped);
|
||||
3. bounded metadata, signatures, method bodies, and normalized CIL (shipped);
|
||||
3. bounded metadata, signatures, method bodies, raw CIL hashes, and the limited
|
||||
decoded-instruction-tuple fingerprint v1 (shipped; normalized-CIL v2
|
||||
semantics remain planned);
|
||||
4. obfuscation-resistant slices and cross-version comparison (shipped for
|
||||
static member observations);
|
||||
5. decompiler reconstruction import (shipped as analyst inference; REA does
|
||||
|
||||
@@ -566,10 +566,10 @@
|
||||
"mcp_resource_templates": 8
|
||||
},
|
||||
"digests": {
|
||||
"tools_sha256": "b9cea5c401d28e7f2bbd32a058dab8cf5c1b044a60fb5b2ec90584dcd2c781bb",
|
||||
"tools_sha256": "4f19c5773a44980e176978f05626f2d82c95d49e4b86d024ce515c3ff1670bae",
|
||||
"prompts_sha256": "f6da3ad38a1000c11364d1710f122ac4990551f04efd8c53ffb2e819b5cf5707",
|
||||
"resources_sha256": "5dca0fcdad3e78d71a1b6ef7b4f0c12bdcd8e3ec11fcbdd9ccd3a68edadf5c80",
|
||||
"combined_sha256": "d0e2eae4dbc245ff58042a075276a501872a5bf7405a18d1b4e0163cbdf138f9"
|
||||
"combined_sha256": "b6840d7c79ffdfe8a2ef65fb66c1694f3631bacbc22a0456abbe12aca2d53969"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user