Skip to content

feat: functional trusted VSI binding, ladder signing and ownership hardening - #4

Draft
mstattma wants to merge 63 commits into
feat/live-video-vsifrom
feat/trusted-vsi-functional
Draft

mstattma wants to merge 63 commits into
feat/live-video-vsifrom
feat/trusted-vsi-functional

Conversation

@mstattma

@mstattma mstattma commented Sep 30, 2026 •

Copy link
Copy Markdown

Functional trusted VSI Python binding plus ladder/fragmented signing and ownership hardening, paired with castlabs/c2pa-rs feat/trusted-vsi-functional.

Current Qualified Pair

Python 97c820efde96af75c900c02e05457aab1ba2e1e1, native a6d4cdcc05638ee8dd0afce7fa5c850d7031a80c.

  • TrustedVsiSession and helpers admit only exact revision 3, native SDK token c2pa-rs/0.92.0-dev, required symbols and mask 63, before operational ctypes binding. No version range, fallback or trial operation. Contract: docs/trusted-vsi-python-contract.md.
  • Callback-triggered close is immediately logical; new admissions are refused and physical native teardown waits for admitted signing calls. Callback pins survive native free, including borrowed Signer/Context lifetimes. This is not generic thread safety: native operations still require serialization.
  • blocked is exposed by ctypes/status, with offset 18 and total native status size 24. Failure/recovery tests exercise it.
  • Stock-native scripted dynamic-assertion cases use has_dynamic_assertions(); source and installed-wheel paired jobs actually execute their functional checks.
  • The fragmented wrapper preserves the existing six-argument glob-aware ABI, supporting one shared manifest across segmented renditions without per-rendition fallback.
  • Ladder cleanup guidance permits deletion only of positively owned newly created outputs; sources and pre-existing destinations are never cleanup targets.

Merge Provenance

True merges retain ladder candidate 502b8bb2, generic ownership 7ba8615, reviewed follow-up a303db8 and callback-lifetime review fixes, without temporary CI-only commits or rewritten history. Ladder DynamicAssertion exceptions preserve identity and claim-signer interrupts propagate. Consume-first registry rejection parsing and opaque stream ownership remain anchored to rejected handle IDs.

Unreleased source identity 0.37.13.dev0 and immutable dev5 release inputs/locks/tooling remain distinct. Exact revision/version gating is intentionally coordinated, not source or binary authentication.

Current Qualification

  • Exact pair Linux/Windows non-publishing qualification: 37688529697. Each platform passed 286 focused, 831 non-threaded, 54 threaded and 286 installed-wheel tests, plus the real native ladder harness.
  • Local source qualification: 831 tests and 135 subtests; threaded 54; installed 286 and 18 subtests; installed release smoke 5. Review, stock-native and artifact provenance is in docs/archive/trusted-vsi-review-verification.md.
  • Required downstream stack: 37807071502, passing required Linux/Windows scopes for both CBOR versions. Informational full Windows retains 21 failures per version.
  • Frozen signer 0bf8949f passed fresh exact-source public/operational qualification with the downloaded native artifact: 84 passed, zero skips/failures per version. Execution evidence and selected integration review.

Historical Qualification And Limits

The old 12d265db/native 6b506352 pair (36808706395) is historical, superseded above. Stock 0.91.0 Windows x64 ownership/unit/ladder/threaded proof remains separate (36775608167); stock Windows ARM64 ownership was outside that scope. Ordinary stock-native hosted release jobs did not run in the current paired lane.

Remaining generic opaque-native concurrency/sticky-slot work stays in the roadmap. No generic thread-safety, native composed event-ID carry, production provider or universal platform guarantee is claimed.

No publication; dev5 tooling still refuses this source. Immutable historical release artifacts are unchanged.

tmathern and others added 30 commits August 27, 2026 15:38
* chore: Update c2pa version to v0.90.16

* Bump version from 0.37.8 to 0.37.9

* Bump version from 0.37.8 to 0.37.9
…uth#320)

* build: drop wheel, setuptools and pytest from runtime dependencies

None of the three is imported anywhere under `src/`. `c2pa.py` and `lib.py`
import only the standard library; `build.py` — the `download-artifacts` console
script — imports `requests` and, lazily, `toml`. Those two stay.

They are also already classified correctly elsewhere in the repo:

* `[build-system] requires` already lists `setuptools>=68.0.0` and `wheel`, so
  the build has what it needs and the runtime entries are duplicates.
* `requirements-dev.txt` lists `wheel` and `setuptools` under
  "# Build dependencies" and `pytest` under "# Testing dependencies".
* `.github/workflows/build.yml` installs pytest explicitly (`pip install
  pytest`, lines 285 and 377), so CI does not rely on the runtime declaration
  either.

Removing them is therefore a no-op for this repo's own build and test paths,
and it keeps three packages out of every consumer's production environment.

* build: declare pytest in a PEP 735 dev dependency group

Dropping pytest from `[project.dependencies]` left it undeclared in
pyproject.toml entirely, with `requirements-dev.txt` as the only manifest
naming it. `[dependency-groups] dev` states it where it belongs: installed
for contributors (`uv sync`, `pip install --group dev`) and, unlike
`[project.optional-dependencies]`, absent from the published package
metadata — which is the separation this branch is about.

The bound matches requirements-dev.txt (`pytest>=8.1.0`) rather than the
`>=7.4.0` the runtime entry carried; nothing installs the old one.

The comment above the remaining dependencies goes with it. The rationale
for keeping `toml` and `requests` belongs in the pull request, not in a
manifest that has carried no comments so far.

* build: keep pytest declared in requirements-dev.txt only

Review feedback: the PEP 735 group restated a bound that
`requirements-dev.txt` already carries, so the two could drift — which is
what this branch set out to stop, not to reproduce one line further down.

Nothing in the repo would have read the group. The Makefile's `install-deps`
and every workflow that installs dependencies do so with `pip install -r
requirements-dev.txt` (`build.yml` lines 52, 90/93, 164/167, 490/492), and
the wheel test jobs install pytest by name. The group was a declaration with
no consumer.

The published metadata — the point of this branch — is unaffected either
way, and the diff is now purely subtractive.
* Update c2pa version from v0.90.16 to v0.90.19

* Bump version from 0.37.9 to 0.37.10

* Bump version from 0.37.9 to 0.37.10
* chore: Update C2PA version to 0.90.22

* Bump version from 0.37.10 to 0.37.11

* Bump version from 0.37.10 to 0.37.11
…t-tooling

Add reusable c2pa-rs RC-preflight workflow; fix latent test bugs
…#327)

test_sdk_version compares the loaded native library's version against
c2pa-native-version.txt, but an RC-preflight run (per
test-c2pa-rs-source-build.yml) actually builds from whatever ref is in
c2pa-rs-preflight-ref.txt instead, so the test always failed on that
one assertion during a preflight even when everything else passed.

parse_native_version() now prefers c2pa-rs-preflight-ref.txt when
present, falling back to c2pa-native-version.txt otherwise -- the same
precedence the workflow itself uses to decide what to build. Verified
both paths locally: green against the pinned 0.90.22 with no preflight
file, and green against a c2pa-rc-v0.91.0-rc.3 build with the file
present.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
contentauth#328)

contentauth#327's parse_native_version() fix preferred c2pa-rs-preflight-ref.txt
whenever it existed in the checked-out tree. That broke the *real*
build.yml jobs on contentauth#325: that PR adds the ref file to the branch, so an
ordinary tests-unix/tests-windows run (which downloads and installs
the actual pinned release, unrelated to the preflight workflow) picked
up the file too and wrongly expected the RC's version string, failing
with e.g. "'0.91.0-rc.3' not found in '0.90.22'".

The file's mere presence was never a reliable signal -- only
test-c2pa-rs-source-build.yml's own "Run tests" step actually builds
from that ref. Gate on a new C2PA_PREFLIGHT_RUN env var that only that
step sets instead.

Verified locally: with the pinned 0.90.22 installed and no env var
set, all 444 tests pass regardless of whether
c2pa-rs-preflight-ref.txt happens to exist in the tree.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* Fix test_sdk_version regression: gate on an env var, not file presence

contentauth#327's parse_native_version() fix preferred c2pa-rs-preflight-ref.txt
whenever it existed in the checked-out tree. That broke the *real*
build.yml jobs on contentauth#325: that PR adds the ref file to the branch, so an
ordinary tests-unix/tests-windows run (which downloads and installs
the actual pinned release, unrelated to the preflight workflow) picked
up the file too and wrongly expected the RC's version string, failing
with e.g. "'0.91.0-rc.3' not found in '0.90.22'".

The file's mere presence was never a reliable signal -- only
test-c2pa-rs-source-build.yml's own "Run tests" step actually builds
from that ref. Gate on a new C2PA_PREFLIGHT_RUN env var that only that
step sets instead.

Verified locally: with the pinned 0.90.22 installed and no env var
set, all 444 tests pass regardless of whether
c2pa-rs-preflight-ref.txt happens to exist in the tree.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Point the RC preflight at c2pa-rs 0.91.0-rc.3

This is the entire diff this PR now carries on top of contentauth#328: pin the
preflight workflow at c2pa-rc-v0.91.0-rc.3 so it builds from that git
tag (no crates.io publish, no prebuilt GitHub release binaries for an
RC) and runs the full unit test suite against it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Point the RC preflight at c2pa-rs 0.91.0-rc.3

This is the entire diff this PR now carries on top of contentauth#328: pin the
preflight workflow at c2pa-rc-v0.91.0-rc.3 so it builds from that git
tag (no crates.io publish, no prebuilt GitHub release binaries for an
RC) and runs the full unit test suite against it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Preflight against c2pa-rs 0.91.0-rc.4

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* chore: bump c2pa-rs to v0.91.0

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* chore: Bump version from 0.37.11 to 0.37.12

* Bump version from 0.37.11 to 0.37.12
Pin native castlabs/c2pa-rs a2739fd6 (VSI + contentauth main 6c92bc32 +
fMP4/TFRA fixes + validation time/trust purposes), Rust 1.96.0, and
release from feat/conformance-validation-v02.
…l tests

Install pytest explicitly in the installed-wheel test environments and
pin native castlabs/c2pa-rs 6ca7fb16.
Register the native ladder export as optional, validate path arrays, preserve typed errors and allocation ownership, and use the modern single-sign builder lifecycle. Add focused binding tests and isolated stock/candidate native qualification lanes without changing release pins.

Co-authored-by: bibinbaby444 <bibinbaby444@gmail.com>

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Use c2pa_free for new manifest allocations, include focused ladder tests in existing CI runs, reject optimized verification harness execution, and document the modern builder lifecycle.
Include a documented synthetic fixture and offline native smoke in the existing CI selection. Enforce candidate capability on request, verify the native signature and shared manifest, and cover typed ctypes conversion without changing stock native pins or builder semantics.

Co-authored-by: bibinbaby444 <bibinbaby444@gmail.com>
…idation

# Conflicts:
#	docs/class-diagram.md
#	pyproject.toml
#	src/c2pa/c2pa.py
#	tests/test_unit_tests.py
@mstattma

mstattma commented Oct 8, 2026

Copy link
Copy Markdown
Author

Resolution mapping for the existing review at Python 97c820efde96af75c900c02e05457aab1ba2e1e1, paired with native a6d4cdcc:

  • P1 reentrant-close callback lifetime: close becomes logical immediately, refuses new admissions, and defers physical native teardown until admitted calls drain. Callback pins remain alive through native destruction, including borrowed Signer/Context lifetimes. Native operations still require serialization; generic thread safety is not claimed.
  • P2 blocked state: ctypes, the status dataclass and status() expose blocked, at native offset 18 with total status size 24; real failure/recovery coverage is included.
  • P2 stock-native dynamic cases: scripted dynamic-assertion cases check has_dynamic_assertions(). Paired jobs now actually run focused, ladder, non-threaded, threaded and installed-wheel checks. Stock 0.91.0 and Windows ARM64 limits remain separate, not inferred from this pairing.
  • P3 unsafe ladder cleanup guidance: documentation forbids deletion of sources or pre-existing destinations; only positively owned new outputs are cleanup candidates.
  • P3 label-only compatibility gate: exact revision 3, SDK token, required symbols and capability mask 63 are checked before trusted operational ctypes binding. Incompatible native libraries fail closed.

The integrated fragmented wrapper also restores the existing six-argument glob-aware ABI and shared-manifest segmented signing, without per-rendition fallback or ownership changes.

Exact-head paired qualification 37688529697 passed on Linux/Windows: 286 focused, 831 non-threaded, 54 threaded and 286 installed-wheel tests per platform, plus the real-native ladder harness. Source/stock/installed evidence is in docs/archive/trusted-vsi-review-verification.md. Required downstream qualification and fresh frozen-source execution are recorded separately with their exact heads and limitations.

Ordinary stock-native hosted release jobs did not run in this paired lane. Immutable dev5 artifacts, release inputs and publication gates are unchanged; no release or universal platform guarantee is claimed.

mstattma and others added 8 commits October 15, 2026 17:39
…gment_at_offset)

Bind the Castlabs native c2pa_reader_with_fragment_at_offset(reader, format,
stream, fragment, uint64 offset) and the c2pa_reader_fragment_at_offset_supported
probe as optional symbols, so older native libraries still import.

- has_fragment_at_offset(): true only when both exports exist and the probe
  returns true. The probe is called lazily on first use, never at import.
- Reader.from_fragment_at_offset(format, init_stream, fragment_stream,
  fragment_offset, context=None) and Reader.with_fragment_at_offset(format,
  stream, fragment_stream, fragment_offset). They follow with_fragment
  ownership: the native call consumes the reader on success and failure.
  Gating raises C2paError.NotSupported before any argument or native work.
  The format must be a non-empty str (native fragment loading cannot
  auto-detect). The offset must be an int in 0..2**64-1 (bool rejected).
  The streams must be stream-like and distinct objects, and the context
  valid; all of this is checked before any native call. A wrong cut or
  offset gives an Invalid reader with assertion.bmffHash.mismatch.
- Tests: scripted gating, validation and marshalling, plus real-native
  checks. Those sign the per-fragment-sidx single-file fixture (copied from
  castlabs/c2pa-rs ec9ac2f6), cut it at merkle uuid boundaries, verify each
  segment Trusted with bmffHash.match, and check wrong offsets
  (0, +/-1, sibling) are a mismatch. The real-native tests skip when the
  API is absent and fail under C2PA_FRAGMENT_OFFSET_REQUIRED=1.
- Docs: README, usage and release notes.
feat: Reader offset-aware fragment verification; prepare 0.37.13.dev1
….8 line

Merge origin/feat/conformance-validation-v02 (f55a1fb) to pair with the
native castlabs/c2pa-rs conformance merge (PR contentauth#21).

Resolution:
- Release identity, pins and tooling stay on this line (0.37.13.* on
  feat/trusted-vsi-functional, trusted VSI API, fragment-offset binding and
  smoke); the conformance line's 0.37.12.dev1-dev4 release-prep pins are
  dropped.
- Take the conformance line's genuine changes: contentauth main 0.37.12
  merge content (already present here), 53ed862 native validation time and
  checked crJSON tests and fixture fixes, and the installed-wheel pytest
  install fix (Linux and Windows) with a tooling regression assertion.
- Reader.crjson() documents the checked native export; add tests that a
  NULL return raises (with and without a native error message).
- Move TestConformanceValidationSettings above the __main__ guard.
- Keep both lines' release notes history.
Pin native castlabs/c2pa-rs afd6fffe5a066e0b5b1a14f3f8c7ac189e7f0c95 (the
1.0.8 trusted VSI native line merged with the conformance line; workspace
0.92.0-dev, Cargo.lock SHA-256 f7022b3e..., Rust 1.96.0) and release
0.37.13.dev2 from feat/trusted-vsi-functional as castlabs-v0.37.13.dev2.

castlabs-v0.37.13.dev1 (run 38786913569) was not published: its
installed-wheel test jobs lacked pytest. The paired qualification uses the
same native commit; functional build identities dev1 and older are rejected.
The upstream prebuilt library used by build.yml has no verify.validation_time
or crJSON 2.4. Document that strict_trust_purposes is accepted and ignored.
chore(release): 0.37.13.dev2 with conformance-validation-v02 merged
@mstattma
mstattma deployed to castlabs-vsi-release October 15, 2026 22:09 — with GitHub Actions Active
@mstattma
mstattma deployed to castlabs-vsi-release October 17, 2026 06:43 — with GitHub Actions Active
…native 6021100c

Select the release identity 0.37.13+signer.1.0.9 (intended tag
castlabs-v0.37.13+signer.1.0.9) for signer 1.0.9. Only the version label
and its release metadata change: the Python runtime, native
castlabs/c2pa-rs 6021100cc5060b06061ca15b634281cfeb97c718, Cargo.lock
SHA-256 ff5cf2de..., Rust 1.96.0, revision 3 / mask 63 and all release
controls are unchanged from the published 0.37.13+signer.1.0.8.

- Package, c2pa.py header, lock, input/evidence schemas, release helper
  and body, escaped tag trigger, concurrency group, wheel/bundle names,
  expected versions and the release job tag gate select 1.0.9.
- Tests reject the published 1.0.8 identity as a tag ref, dist-info,
  functional build version or workflow reference.
- Docs record 1.0.8 as published and add 1.0.9 preparation notes.

No tag, release or publication.
@mstattma
mstattma deployed to castlabs-vsi-release October 27, 2026 01:01 — with GitHub Actions Active
mstattma and others added 6 commits November 2, 2026 22:44
chore(release): prepare signer 1.0.10 with receiver-time VSI validation
…contentauth#33) for signer 1.0.10

The 1.0.10 native now also carries castlabs/c2pa-rs#33, the upstream
soft-binding byte normalization, merged after contentauth#34 on feat/trusted-vsi-functional.
Cargo.lock is unchanged (SHA-256 10fcb5c1...), so contentauth#34's audit exception
assessment still applies.
…ent status and advisory IDs

- Release smoke signs a soft binding with value [0, 128, 255] and requires the
  stored CBOR byte string h'0080ff' (castlabs/c2pa-rs contentauth#33); an older native
  stores the integer array and fails.
- Status text: native merged, paired run 42782411039, tag push creates the
  draft release.
- Audit sentence names RUSTSEC-2026-0387 (review 2026-12-04) and
  RUSTSEC-2023-0071 and links the native audit exceptions.
@mstattma
mstattma deployed to castlabs-vsi-release November 10, 2026 14:59 — with GitHub Actions Active

This branch had an error being deployed

1 failed and 1 active deployments
github-pages — 45657596 Deployed Nov 10, 2026 by mstattma via deploy #8
castlabs-vsi-release — 45657596 Deployed Nov 10, 2026 by mstattma via release #35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants