Skip to content

V-L2-C3: positive tamper-detection tests for actor / before_snapshot / transformation #29

Description

@hyperpolymath

Context

Once V-L2-C1 lands, tampering with actor, before_snapshot, or
transformation must break verify(). Today only operation,
entity_id, timestamp, and previous_hash are protected.

What to do

In src/abi/mod.rs::tests add three parallel positive cases:

#[test]
fn test_provenance_tamper_actor() {
    let mut e = ProvenanceEntry::genesis("post-1", "alice");
    e.actor = "mallory".to_string();
    assert!(!e.verify(), "actor must participate in the hash");
}

#[test]
fn test_provenance_tamper_before_snapshot() {
    let mut e = ProvenanceEntry::genesis("post-1", "alice");
    e.before_snapshot = Some("{\"redacted\":true}".to_string());
    assert!(!e.verify(), "before_snapshot must participate in the hash");
}

#[test]
fn test_provenance_tamper_transformation() {
    let mut e = ProvenanceEntry::genesis("post-1", "alice");
    e.transformation = Some("evil-rewrite".to_string());
    assert!(!e.verify(), "transformation must participate in the hash");
}

Plus a round-trip test: build genesis → chain → chain → chain;
assert each entry verifies; mutate each entry in turn and assert
the mutation breaks verify().

Acceptance

  • Three new unit tests as above, all green after V-L2-C1
  • One end-to-end round-trip test exercising a 4-entry chain
  • Mutation matrix test (each field × each entry) fails after
    every single mutation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew capability or improvement to existing behaviour

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions