Skip to content

manifest content-address: guard serde_json feature unification + non-UTF-8 filename lossy embed #295

Description

Found during an adversarial re-review of the schema-v2 stack (#287/#288). The core byte-determinism claim holds (no HashMap serialized, BTreeMap-backed extensions, aux sorted at create, golden test is a real cross-platform invariant). Two edge cases sit at the boundary of the "one bundle → one content address" guarantee.

1. serde_json feature unification. Nested serde_json::Value maps in extensions / attestations are BTreeMap-backed and key-sorted in this workspace (Cargo.lock has no indexmap). But if any crate in a downstream consumer's graph enables serde_json/preserve_order (or arbitrary_precision), feature unification flips Value map ordering to insertion order, changing the canonical bytes for manifests that carry extensions/attestations. The write_manifest_file doc already notes serializer settings matter; options are to (a) document this as an explicit build constraint, or (b) canonicalize Value trees (recursive key-sort) before writing so the address is independent of the feature.

2. Non-UTF-8 filenames embed lossily. path_to_manifest_string uses to_string_lossy, so a Unix filename with invalid UTF-8 canonicalizes fine, embeds with U+FFFD, passes the canonical-form check, then fails resolution at verify — violating the local "what create writes, verify must accept" contract. Fail-loud, deterministic, rare. A one-line OsStr-is-UTF-8 check at create (rejecting like the existing backslash case) would close it.

Severity: low / latent. Only affects manifests carrying extensions/attestations under an unusual downstream feature config (#1), or non-UTF-8 filenames (#2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions