Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ the first build, SDK or sealed file that reaches somebody else. `CHANGELOG.md` i
Decryption never establishes a proof verdict.
- `reviews/` — historical review notes (cryptographic, implementability).
Findings are graded BLOCKING / SHOULD / NOTE; the spec absorbed them and is
authoritative. Do not update a review to match the spec.
authoritative. Do not update a review to match the spec. A `design-*.md`
note there is a proposal the spec has not adopted (§11 points at it).
- `schema/` — JSON Schema plus a validator runnable from CI, including the
shape of a published conformance report.
- `vectors/` — one directory per case, each with the input, the proof and the
Expand All @@ -48,7 +49,7 @@ the first build, SDK or sealed file that reaches somebody else. `CHANGELOG.md` i
review decides which one is wrong — the generator refuses to write a vector
the verifier fails. The C2PA carrier reader (`jumbf.ts`, `cbor.ts`,
`carrier.ts`) reads structure only and has no dependency; the vectors with
real Content Credentials (123–147) are minted on demand by
real Content Credentials (123–147, 169–171) are minted on demand by
`make-c2pa-vectors.ts` through `@contentauth/c2pa-node`, a devDependency
nothing on the verification path imports, and committed because c2pa-rs
salts every assertion at random.
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,46 @@ else.

## Unreleased

### A forged manifest no longer accuses a file with a genuine sidecar — corpus 6.0.0 → **6.1.0**

**Breaking** for verifiers (a reading rule changed), not for the corpus: no
committed vector moved bytes or verdict, so the bump is minor (`vectors/README.md`,
*Bump policy*). Corpus 6.1.0 (171 vectors).

§3.1 step 4. Before: with no footer, the active manifest's proof always
outranked the sidecar. A Content Credentials manifest is not authenticated to
a vcap reader and, on a JPEG, sits outside the canonical bytes, so anyone
could add one carrying another capture's proof beside a trailer-stripped
genuine file and its genuine sidecar, and the verdict was **tampered**, red —
a false accusation from bytes nobody vouched for. Now, when a sidecar differs
from the depth-0 proof, a verifier computes both verdicts and ranks their
outcomes (*authentic* > *verified clip* > *frames not compared* > everything
else). The sidecar decides only when it ranks **strictly above**; its verdict
then carries *manifest copy differs* and `proof_source` `sidecar`. On a tie
the depth-0 proof stands with *sidecar differs*, as before. Outcomes, never
ceilings, are ranked: a sidecar stripped of a `revoked` attachment must not
beat the manifest's complete copy. Nothing is gained that deleting the
manifest would not give. The same applies to a store the caller hands over.

- **New**: 169 (JPEG: foreign proof in the manifest, genuine sidecar →
*authentic*, *manifest copy differs*), 170 (JPEG: vector 128's file, a
sidecar that also reads *tampered* → the depth-0 proof stands, *tampered*),
171 (vector 89's clip: a foreign video proof in the manifest reads *frames
not compared*, the sidecar *verified clip* 1–2 of 3 → the sidecar's, with
*manifest copy differs*). Minted by `make-c2pa-vectors.ts --only
169,170,171`; notes record c2patool 0.27.16. Vector 127 (the manifest's
proof is the better one) is unchanged.

**What a verifier that predates 6.1.0 does**: reads 169 *tampered* and 171
*frames not compared*, from the manifest's proof; 170 passes.

**Open, not changed**: a valid-CRC trailer appended to a trailer-stripped
genuine file is the same shape — it outranks the sidecar (step 1) — and is
left for review. **A clip's timing is not bound** (`stts`, `ctts`, `mdhd`
timescales, the media edit's duration, the audio sample entry): recorded in
§11 and `threat-model.md` §5.1; no verifier-only rule closes it, and
`reviews/design-clip-timing.md` proposes what the sealers would sign.

### Audit of 3 October 2026: text fixes

Text only, no corpus change, no verdict moves: every sentence below either
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec/ the specification document (normative), the watermark payload
measured), the C2PA interoperability and sidecar companion
(informative, with the writer rules it pins) and the public threat model
reviews/ review notes on the draft (crypto, implementability); the spec absorbs them and cites
their measurements, they stay as the record of why
their measurements, they stay as the record of why; design-*.md are proposals not yet adopted
schema/ JSON Schema of the proof + validator
vectors/ conformance vectors: sealed files, broken signatures, edge cases (see vectors/README.md),
the versioned corpus manifest and how to claim conformance against it (vectors/CONFORMANCE.md)
Expand Down
156 changes: 156 additions & 0 deletions reviews/design-clip-timing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Design note — binding a clip's timing

Status: **proposal**, 3 October 2026. Nothing here is normative; the format
does not change until this is accepted, specified in `vcap-proof-1.0.md` §5
and §6.1, and given its vectors. Written because an audit found that a clip
can be re-timed and still read *verified clip*, and asked whether a
verifier-only rule could close it. It cannot; this note says why and what the
sealers would have to sign.

## The gap

For an original, `media.hash` covers every byte, timing tables included. For a
clip nothing does. A segment's `content_hash` covers NAL units and audio frame
bytes; `media.presentation` covers the decoder configuration, the `tkhd`
matrix and display size, and the track layout. Not covered:

| Container data | What a re-mux can do with it while every GOP still hashes |
|---|---|
| `stts` sample durations | freeze a frame (one long duration), slow or speed a passage, drop the gaps that showed time passing |
| `ctts` composition offsets | reorder the presented frames inside a GOP |
| `mdhd` timescale | scale a whole track; scaled on both tracks, the whole clip plays slower or faster in sync |
| the single media edit's `segment_duration`, `media_time` | trim inside a located segment (shows a subset of it) or hold the last frame |
| the audio sample entry (`esds` / AudioSpecificConfig) | declare another sample rate: the same coded frames play pitched and re-timed |

What binds timing today, by accident: audio frames are assigned to segments by
DTS (§5), so moving an IDR's DTS relative to the audio moves frames between
segments and the hashes break. That covers only re-timing that crosses a
segment boundary on a file with audio; a uniform rescale of both tracks, any
change inside a GOP, and every silent file pass.

## Why a verifier-only rule cannot close it

What the sealers sign holds no timing. The segment message is 96 fixed bytes
with no time in it; the core's only time values are `media.duration_ms`
(the original's) and `time.device_clock`. Checked against the two sealers
that write video (the web SDK refuses video):

- **SPS VUI `timing_info`** is inside `presentation.config`, but neither
sealer's encoder sets it, and it would not describe a variable frame rate
if it did.
- **Picture order count** in the slice headers is signed (it is inside the
NAL units) and would let a verifier check `ctts` reordering against the
coded order. It closes reordering only, needs an H.264 and an H.265
slice-header parser in every verifier, and both sealers disable B-frames
(iOS always; Android from API 29), so on their files there is no reordering
to check.
- **Audio duration against video duration** needs the audio sample rate,
which is in the unsigned audio sample entry, and passes a uniform rescale.

Durations — the freeze and the slow-down — are in no signed byte at all. A
binding needs the sealer to sign new data.

## Proposal

Sign each segment's timing, without touching the segment message.

**`timing(n)`**, the timing record of segment `n`, read from the finished
container on the presentation timeline §5 already defines (leading empty
edits, one media edit at rate 1), every value an integer in the **media
timescale of its own track as the sealer wrote it**:

```
timing(n) = uint32 BE v || ( int64 BE dts_i − dts_0 || int64 BE cts_i ) × v
|| uint64 BE end_n − dts_0
|| uint32 BE a || ( int64 BE adts_j − adts_0 || uint32 BE adur_j ) × a

v, i video samples of segment n in decode order; dts_0 is the IDR's DTS
cts_i the sample's composition offset (ctts; 0 when there is none)
end_n DTS of IDR n+1, or, for the last segment, the last sample's DTS
plus its duration — so the last frame's duration is bound
a, j audio frames §5 assigns to segment n, in decode order
adur_j the frame's duration (stts)
```

**Where it goes.** Two places, neither of them the 96-byte message:

- each `segments[]` entry gains `timing`: base64url `SHA-256(timing(n))`;
- the core gains `media.timing`: `{ "video_timescale", "audio_timescale",
"root" }`, `root` being base64url `SHA-256(timing hash 0 ‖ … ‖ timing hash
segment_count − 1)`, the timescales the `mdhd` values the sealer wrote.
Required wherever `segments` is, like `media.presentation`.

A clip's proof carries every `segments[]` entry, so a verifier recomputes
`root` from the entries and compares it with the signed one — a mismatch is a
binding the proof makes that does not hold, **tampered** — then, for each
located segment, reads `timing(n)` back from the received file and compares
its hash with the entry's.

**Timescale changes.** A verifier converts the received ticks into the signed
timescale: `t_signed = t_received × ts_signed / ts_received`, which must be an
integer for every value, else the timing differs. A re-mux that keeps the
timescale, or multiplies it, verifies exactly; one that moves to a timescale
that cannot represent the original instants has moved them, by at most a
tick, and reads *timing differs* — amber, never red. Hashing makes a
tolerance impossible, and a tolerance would be the thing to argue about.

**Audio configuration.** `presentation.config`'s `X` gains the audio sample
entry's `esds` box (whole, as stored), so the sample rate is bound with the
rest of what a player is told.

**Verdict.** A located segment whose timing reads back different is
presented under a timing nobody signed: **frames not compared**, no segment
credited, label *timing differs* — the reasoning of *presentation differs*
(§5): re-timing is not an accusation, and it is not a verified clip either.
On an original, `timing` that does not describe it is the writer's false
claim: *timing differs*, amber at best. A single media edit that trims inside
a located segment is a timing that differs.

## Impact on the sealers

Both video sealers already read the finished MP4 back after `stop()` —
`stts`, `ctts` and `elst` included — to reconcile segment hashes and compute
`media.presentation`, and both sign the core after that read-back.

- **Android** (`MediaMuxer`): compute `timing(n)` in the read-back, write the
entry's `timing` and the core's `media.timing`, add `esds` to `config`. The
segment messages do not change, so **no segment is re-signed** and the
live signing budget is untouched. `MediaMuxer` chooses the timescales and
edit list, which is why the record is read back and never predicted; on
API 28, where B-frames cannot be disabled, `ctts` is covered by the same
record.
- **iOS** (`AVAssetWriter`, video timescale fixed at 90 000, no frame
reordering): the same three changes in its read-back. Its AAC priming trim
produces an audio edit, which the presentation timeline already models.
- **Web**: seals photos only; nothing.

The rejected alternative put a timing hash inside the segment message (128
bytes, new separator). It needs the muxer's final values at signing time,
which neither sealer has live — muxer rounding, AAC priming and edit offsets
land only in the finished file — so every recording would re-sign its whole
chain at stop: 15–21 ms per segment in the Android TEE. Signing live with
pre-mux microseconds and a tolerance was rejected for the reason above.

## Vectors needed

1. An original with `media.timing` → *authentic* (from vector 166's container,
re-signed).
2. Its proof without `media.timing` → *no proof found*.
3. A `segments[].timing` that does not hash to `root` → *tampered*.
4. Vector 89's clip, timing kept → *verified clip* 1–2 of 3.
5. The clip with one `stts` duration lengthened (a freeze) → *frames not
compared*, *timing differs*.
6. The clip with two `ctts` offsets swapped → the same.
7. The clip with both tracks' `mdhd` timescales doubled and every duration
kept → the same.
8. The clip with every timing value and both timescales multiplied by the
same integer → *verified clip* (an exact re-mux).
9. The clip with the audio `esds` sample rate changed → *presentation
differs*.
10. The clip with its media edit's `segment_duration` cut inside segment 2 →
*timing differs*.
11. An original whose `media.timing` does not describe it → *authentic*,
amber, *timing differs*.

Corpus impact: a major bump (vector 166's family re-signed, every video proof
gains a required field), recorded as breaking in `CHANGELOG.md`.
10 changes: 7 additions & 3 deletions spec/c2pa-interop-1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ entity exists, so no manifest signed by
us exists either. Everything in §3 is therefore about a manifest **somebody
else** writes on a sealed file — an editor, a platform, a camera pipeline that
runs both — and about the day we write one. The corpus does carry real C2PA
manifests (vectors 123–147): they are signed by a public test credential,
manifests (vectors 123–147, 169–171): they are signed by a public test credential,
*vcap-spec test CA* (`vectors/_trust/c2pa-test/`), which no trust list carries
and which signs nothing but vectors.

Expand Down Expand Up @@ -353,7 +353,11 @@ vcap verifier never looks for a `.c2pa` file, never fetches one, and reads it
only when the file embeds no store (`vcap-proof-1.0.md` §3.2). C2PA's rule
that an embedded store outranks a remote one (15.5.2.1) has the same shape as §3.1's
precedence — the copy inside the bytes wins — and the same reason: it
travelled with what it binds.
travelled with what it binds. Where the shapes part: a manifest is
authenticated to a C2PA validator and not to a vcap reader, so a copy in the
bytes that does worse over them than a differing sidecar does not win
(`vcap-proof-1.0.md` §3.1, step 4; vectors 169–171) — anyone can write a
manifest, and the sidecar is what deleting it would leave.

### 3.4 When we sign C2PA

Expand Down Expand Up @@ -440,7 +444,7 @@ canonical bytes.
|---|---|---|---|---|---|---|---|
| Copy, transfer, rename | kept | kept | kept | kept | as sealed (level per §7) | same; the sidecar is renamed with the file or is not found | 01, 17 |
| Trailer stripped, bytes otherwise intact (a tool that truncates at EOI or drops trailing boxes) | lost | kept | kept, no proof in it | kept | *no proof found* | **full verdict restored**, identical to the embedded one | 05, 17 |
| The same, with Content Credentials that carry the proof | lost | kept | kept | kept | **full verdict restored** from the active manifest (`vcap-proof-1.0.md` §3.2, depth 0) | the same: the manifest's copy outranks the sidecar, which *differs* if it is not the same proof | 124, 127 |
| The same, with Content Credentials that carry the proof | lost | kept | kept | kept | **full verdict restored** from the active manifest (`vcap-proof-1.0.md` §3.2, depth 0) | the same: the manifest's copy outranks the sidecar, which *differs* if it is not the same proof — unless the sidecar's outcome is better over these bytes, when the sidecar decides and the manifest's copy *differs* | 124, 127, 169–171 |
| C2PA manifest added, replaced or removed on a JPEG | kept | kept | changed | kept | unchanged | unchanged | 02, 68 |
| C2PA manifest inserted into a sealed BMFF file | kept | kept | added | kept | *tampered* (§4.1: inside the canonical bytes) | *tampered* | 73 |
| C2PA update manifest appended to a sealed BMFF file | unreachable | kept | changed | kept | *no proof found* | *tampered* (whole file hashed) | 69, 70 |
Expand Down
Loading
Loading