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
11 changes: 8 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ the first build, SDK or sealed file that reaches somebody else. `CHANGELOG.md` i
- `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. A `design-*.md`
note there is a proposal the spec has not adopted (§11 points at it).
note there is a proposal; its status line says whether the spec adopted it
(`design-clip-timing.md` is, since corpus 7.0.0) and §11 points at the ones
still open.
- `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 @@ -47,7 +49,10 @@ the first build, SDK or sealed file that reaches somebody else. `CHANGELOG.md` i
written from the spec to prove the vectors consistent; it is not the
implementation others copy. When it disagrees with an expected verdict, the
review decides which one is wrong — the generator refuses to write a vector
the verifier fails. The C2PA carrier reader (`jumbf.ts`, `cbor.ts`,
the verifier fails. One file is meant to be ported: `timing.ts`, the §5
*Timing* record, its hash and root, the timescale conversion and the
media-edit rule, which the sealers and verifiers implement from it and from
vector 175's `debug` records. 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, 169–171) are minted on demand by
`make-c2pa-vectors.ts` through `@contentauth/c2pa-node`, a devDependency
Expand Down Expand Up @@ -81,7 +86,7 @@ Node 22 (`.nvmrc`), from `tools/`. CI (`.github/workflows/ci.yml`) runs, in orde
```
npm ci
npm run typecheck
npm test # vitest: vectors, vault, watermark layouts, conformance docs vs corpus
npm test # vitest: vectors, vault, watermark layouts, timing record, conformance docs vs corpus
npm run validate # every vector's proof.json / expected.json against the schema
npm run manifest:check # vectors/MANIFEST.json matches vectors/
npm run conformance:check # conformance report: corpus version, manifest hash, vector count
Expand Down
88 changes: 88 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,94 @@ else.

## Unreleased

### A clip's timing is bound — corpus 6.2.0 → **7.0.0**

**Breaking.** §5 *Timing* (new), §5 *Presentation*, §6.1, §7, §8: a video
proof's core gains a **required** field, `media.timing`
`{ video_timescale, audio_timescale, root }`, and every `segments[]` entry a
**required** member, `timing`. Absent or malformed → the proof is not well
formed: **no proof found**, as for `media.presentation` (vectors 176, 187).
The design is `reviews/design-clip-timing.md`, accepted 4 October 2026.

Before: a segment's `content_hash` covers NAL units and audio frame bytes and
`media.presentation` how a player is told to show them; nothing covered
**when**. For an original `media.hash` covers every timing table; for a clip
a re-mux that kept every sample could freeze a frame (`stts`), reorder frames
inside a GOP (`ctts`), rescale both tracks in sync (`mdhd`), trim inside a
located segment (the media edit) or declare another audio sample rate
(`esds`), and still read *verified clip*. No verifier-only rule could close
it: no signed byte carried a duration.

- **The record.** `timing(n) = uint32 v ‖ (int64 dts_i − dts_0 ‖ int64
cts_i) × v ‖ uint64 end_n − dts_0 ‖ uint32 a ‖ (int64 adts_j − adts_0 ‖
uint32 adur_j) × a`, big-endian: the segment's video samples in decode
order, their composition offsets (0 without `ctts`), the last sample's DTS
plus its own duration, and the audio frames §5 already assigns to the
segment by DTS, every value in its own track's `mdhd` timescale as the file
states it. `segments[n].timing = SHA-256(timing(n))`; `media.timing.root =
SHA-256(timing hash 0 ‖ … ‖ timing hash segment_count − 1)`;
`audio_timescale` is absent on a file without an audio track. The 96-byte
segment message does not change, so no segment is re-signed: the sealer
reads the record back from the finished file, as it already does for
`media.presentation`, and signs the core after.
- **The verifier.** With every entry present it recomputes the root from the
entries: a mismatch is **tampered** (vector 177). On a file that is not the
original, each located segment's record is read back and converted into
the signed timescales, `t_signed = t_received × ts_signed / ts_received`,
which must be an integer for every value; a record that does not hash to
its entry, a proof that lacks an entry (so the root cannot authenticate
any), or a single media edit that trims inside a located segment (one movie
tick of slack at the end) → **frames not compared**, new label **timing
differs**, no segment credited — amber, never red. On an original, a root
the file's own records do not reproduce is the writer's false claim:
*authentic* with *timing differs*, capped amber (vector 185). The audio
sample entry's `esds` joins `X` in `media.presentation.config`, so a
changed sample rate is *presentation differs* (vector 183).
- **Reference.** `tools/src/timing.ts` (record, hash, root, timescale
conversion, edit rule) and `tools/src/container.ts` (the values per GOP,
`ctts`, the media edit, the `esds`); `tools/src/remux.ts` can now rescale a
track, retime samples and write a `ctts`.

Corpus 7.0.0 (187 vectors). No backward compatibility: the device captures 36,
37, 48 and 85 keep their bytes and their *no proof found*.

- **Moved bytes, re-signed, verdicts unchanged**: 33, 38, 39, 86–94, 156,
158–163, 165–168 and 173 (`npm run generate`), each core and segment chain
re-signed with the test key with `media.timing` and the entries' `timing`
read back from the container (33 and 165 carry synthetic timing hashes, as
they carry synthetic content hashes); 143–147 and 171 minted again by
`make-c2pa-vectors.ts --only 143,144,145,146,147,171` (new salts; notes
record c2patool 0.27.16). **No existing verdict moved**: every re-muxed
clip in the corpus keeps its timescales and durations. 158's note is
corrected in place (its `colr`).
- **New**: 175 (vector 166 with every `timing(n)` in `debug` → *authentic*),
176 (core without `media.timing` → *no proof found*), 177 (an entry's
`timing` not in the root → *tampered*), 178 (166 cut at the end → *verified
clip* 0–1), 179 (a frame frozen → *frames not compared*, *timing
differs*), 180 (two frames reordered by `ctts` → the same), 181 (both
timescales doubled, durations kept → the same), 182 (timescales and every
duration ×2 → *verified clip* 1–2), 183 (`esds` 48 → 44.1 kHz → *frames not
compared*, *presentation differs*), 184 (media edit ends inside segment 2
→ *timing differs*), 185 (an original signed in microseconds → *authentic*,
*timing differs*), 186 (89's clip with entry 0 dropped from the proof →
*timing differs*), 187 (an entry without `timing` → *no proof found*).

**What a verifier that predates 7.0.0 does** (measured with the 6.2.0
reference verifier): it has not learned the new fields are required, so 176
and 187 read *authentic*, and it does not recompute the root, so 177 does
too. On every file with an audio track it builds `config` without the `esds`
the core now covers, so the originals of vector 166's family (166, 175–177,
185, 187) read *authentic* with *presentation differs*, and every clip of it
(89, 171, 173, 178–184, 186) *frames not compared*, *presentation differs* —
89, 173, 178 and 182 included, which are *verified clip*; 145 reads *no
proof found* (depth 1). The silent files (158–163, 167, 168, 94) read as
before. It fails the `core_hash` of every moved vector.

`threat-model.md` §5.1 *Clip re-timed* is closed; still open, and recorded in
§11: a media edit that runs past the end of the track, the audio sample
entry's own fields beside the `esds`, and an `esds` inside a QuickTime `wave`
box, which no vector exercises.

### An appended trailer no longer accuses a file with a genuine sidecar — corpus 6.1.0 → **6.2.0**

**Breaking** for verifiers (a reading rule changed), not for the corpus: no
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ 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; design-*.md are proposals not yet adopted
their measurements, they stay as the record of why; design-*.md are proposals, each with its status
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)
tools/ reference tooling (Node 22, TypeScript): JCS, trailer, canonical bytes, core signature,
segment chain, the C2PA carrier reader, the vector generators and the reference
segment chain, the segment timing record (timing.ts, written to be ported), the C2PA carrier reader, the vector generators and the reference
verifier CI runs over vectors/,
plus corpus-drift.sh, which a consumer that pins this repository as a submodule
runs from its own suite to learn whether its pin has fallen behind main
Expand Down
22 changes: 16 additions & 6 deletions reviews/design-clip-timing.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# 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.
Status: **accepted** 4 October 2026, **implemented** in corpus 7.0.0:
`vcap-proof-1.0.md` §5 *Timing* and §6.1 `media.timing` are normative, and
vectors 175–187 pin them. Proposed 3 October 2026. The text below is the
proposal as accepted and is not normative; where the spec settles a detail,
the spec is authoritative. What the spec settled beyond this note: `end_n` is
always the last sample's DTS plus its duration (equal to the next IDR's DTS
in a sample table, and never the `mdhd` duration); `audio_timescale` is
absent — never `null` or 0 — on a file without an audio track; the root is
recomputed only when every entry is present, and a clip whose proof lacks one
reads *timing differs* (vector 186); an entry without `timing` is not well
formed (vector 187); the media edit rule gives one movie tick of slack at the
end and applies to clips only; vector 4 below became an end cut (178),
because vector 89 itself now carries the timing-kept case. 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

Expand Down
16 changes: 9 additions & 7 deletions schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ What it pins, beyond types: base64url lengths (16-byte ids, 32-byte hashes,
core, enum values of `platform`, `secure_hw`, `layout`, `level`, `source`,
`verdict`, `location_corroboration.result`, `additionalProperties: false`
inside every known object (`location_corroboration` included), and
`media.segment_count` and `media.presentation` required whenever `segments`
is present — which a video proof (`media.mime` `video/…`) always is.
`media.segment_count`, `media.presentation` and `media.timing` required
whenever `segments` is present — which a video proof (`media.mime`
`video/…`) always is — with `timing` required in every `segments[]` entry.

`expected.schema.json` is the shape of a vector's `expected.json`.

Expand All @@ -28,17 +29,18 @@ npm run validate -- path/to/proof.json [more.json …] # exit 1 on the first

Without arguments, `npm run validate` walks `vectors/`: every `expected.json`
must be well formed, and every `proof.json` must be schema-valid exactly when
its vector says so (`schema_valid`). Eleven vectors are schema-invalid on
its vector says so (`schema_valid`). Thirteen vectors are schema-invalid on
purpose — DER signature (13), major 2 (16), missing `capture_id` (21), a float
in the core (22), a video proof without `segments` (34), an unknown
`secure_hw` (40), missing `media.w`/`media.h` (46), an `integrity.verdict`
outside the enumeration (67), a `location_corroboration.result` outside it
(80), an unknown `location.level` (83), a video proof without
`media.presentation` (165) — and the generator refuses to write a vector
whose review verdict and schema verdict disagree. Seven more are
`media.presentation` (165), one without `media.timing` (176), a segment entry
without `timing` (187) — and the generator refuses to write a vector
whose review verdict and schema verdict disagree. Four more are
schema-invalid because the format moved under them: the device captures 36,
37, 48 and 85 and the C2PA vectors 145–147 that carry 36's proof predate
`media.presentation` and cannot be re-signed (`vectors/README.md`, *Errata*).
37, 48 and 85 predate `media.presentation` and `media.timing` and cannot be
re-signed (`vectors/README.md`, *Errata*).

Programmatic use: `validateProof(json)` in `tools/src/schema.ts` returns
`{ valid, errors }` with JSON pointers and messages, never values.
42 changes: 38 additions & 4 deletions schema/vcap-proof-1.0.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"properties": {
"config": {
"$ref": "#/$defs/bytes32",
"description": "SHA-256 of the presentation message: the decoder configuration's parameter sets, then clap, pasp and colr"
"description": "SHA-256 of the presentation message: the decoder configuration's parameter sets, then clap, pasp and colr, then the audio sample entry's esds"
},
"matrix": {
"type": "array",
Expand All @@ -91,6 +91,33 @@
"description": "the video tkhd width and height, 16.16 fixed point as stored"
}
}
},
"timing": {
"type": "object",
"additionalProperties": false,
"required": [
"video_timescale",
"root"
],
"description": "§5 Timing, required wherever segments are (so of every video proof): the root of the segments' timing hashes, so a clip cannot be re-timed, reordered or rescaled",
"properties": {
"video_timescale": {
"type": "integer",
"minimum": 1,
"maximum": 4294967295,
"description": "the video track's mdhd timescale as the sealer wrote it"
},
"audio_timescale": {
"type": "integer",
"minimum": 1,
"maximum": 4294967295,
"description": "the audio track's mdhd timescale as the sealer wrote it; absent, never null or 0, when the sealed file has no audio track"
},
"root": {
"$ref": "#/$defs/bytes32",
"description": "SHA-256 over segments[0..segment_count-1].timing, 32 bytes each, in index order"
}
}
}
}
},
Expand Down Expand Up @@ -268,7 +295,8 @@
"gop",
"hash",
"prev",
"sig"
"sig",
"timing"
],
"properties": {
"gop": {
Expand All @@ -293,6 +321,10 @@
},
"sig": {
"$ref": "#/$defs/p1363"
},
"timing": {
"$ref": "#/$defs/bytes32",
"description": "SHA-256 of timing(n), the segment's timing record (§5 Timing); bound by media.timing.root"
}
}
}
Expand Down Expand Up @@ -655,7 +687,8 @@
"type": "object",
"required": [
"segment_count",
"presentation"
"presentation",
"timing"
]
}
}
Expand Down Expand Up @@ -692,7 +725,8 @@
"type": "object",
"required": [
"segment_count",
"presentation"
"presentation",
"timing"
]
}
}
Expand Down
Loading
Loading