Skip to content

InterpreterCallerMeta::try_from(RainMetaDocumentV1Item) ignores the item's magic, accepting a mismatched intent signal #194

Description

@thedavidmeister

Unit

crates/cli/src/meta/types/interpreter_caller/v1.rsimpl TryFrom<RainMetaDocumentV1Item> for InterpreterCallerMeta (group g5-interpretercallermeta-v1, adversarial mutation-test pass).

Intent oracle

Rain metadata-v1 spec: the per-item magic number is the "signal of intent for the payload" that tooling reads "in O(1)... without needing to first parse". A meta map's magic says what the payload is.

Violated property

InterpreterCallerMeta::try_from(item: RainMetaDocumentV1Item) never inspects item.magic. A document item tagged with any magic — e.g. KnownMagic::SolidityAbiV2 or KnownMagic::OpMetaV1 — whose payload happens to parse as InterpreterCaller JSON converts successfully into an InterpreterCallerMeta. The declared intent signal is ignored at the exact boundary whose job is to interpret it.

RainMetaDocumentV1Item::unpack_into::<T> (meta/mod.rs) does gate on magic, but only on "is this any supported magic", not "is this the magic that matches T" — so the same confusion passes through unpack_into as well, and direct TryFrom has no gate at all.

Verified repro

let item = RainMetaDocumentV1Item {
    payload: serde_bytes::ByteBuf::from(VALID_INTERPRETER_CALLER_JSON),
    magic: KnownMagic::SolidityAbiV2, // wrong intent signal
    content_type: ContentType::Json,
    content_encoding: ContentEncoding::None,
    content_language: ContentLanguage::En,
    schema: None,
};
assert!(InterpreterCallerMeta::try_from(item).is_ok()); // succeeds despite the mismatched magic

Triage framing (neutral)

This pattern is shared by the other meta types' TryFrom<RainMetaDocumentV1Item> impls, so it may be a deliberate "caller has already routed on magic" design. If so it is undocumented; if not, the conversion should reject a mismatched magic. Flagged for a decision, not adjudicated. (Scope of this run's slice is the InterpreterCaller unit; the same question likely generalises.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    adversarialFound by adversarial review/mutation testingauditAudit finding; counted by the org health scan

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions