Repository navigation
C2PA Monitor: Decode active manifest into c2pa.decoded - #1178
Conversation
…c2pa-jumbf-cbor-decoder
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #1178 +/- ##
=============================================
+ Coverage 85.49% 85.70% +0.21%
- Complexity 4809 4941 +132
=============================================
Files 188 191 +3
Lines 17736 18055 +319
=============================================
+ Hits 15163 15474 +311
- Misses 2573 2581 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@lnispel I'd be curious for your review here |
lnispel
left a comment
There was a problem hiding this comment.
Thanks @i-am-chitti, this follows the #953 direction closely, and the bounds on the JUMBF and CBOR parsing are careful. A few suggestions, all about how the decoded fields are described rather than how they’re parsed. WordPress here is a C2PA Manifest Consumer that doesn’t validate (spec §2.1.4 vs §2.1.5), so these are framed for that role.
-
Cite the display rule. The docs say anything displaying c2pa.decoded “should say so.” C2PA spec §15.3 (Displaying Manifest Information) is more specific: consumers should not display data from manifests that aren’t Valid, and if they do, the display must include (a) a warning that the data has not been validated and (b) a warning that it must not be attributed to the manifest’s signer. Since the plugin can’t determine validity yet (#954), all decoded data falls under this. Could the docs cite §15.3 and list both warnings, so the display follow-ups have a concrete rule to build against?
-
Remove the digital_source_type fallback. When there’s no c2pa.created action, the decoder uses the first digitalSourceType from any action. The spec ties the asset’s origin to c2pa.created specifically (§18.15.2). A source type on another action describes that action, not where the asset came from. Since the goal is data people can rely on, we’d rather report nothing than a value that may not describe the origin. Could digital_source_type come only from c2pa.created?
-
Say what null means. For edited images, the active manifest starts with c2pa.opened, which carries no source type, because the origin lives in the parent manifest (§18.15.2). Update manifests can’t contain c2pa.created at all (§11.2.3). XCA.jpg in this PR is an example. So digital_source_type: null will be common, and it doesn’t mean “not AI-generated.” Could the docs state that null means the origin is not recorded in the active manifest?
-
Note that created and gathered actions aren’t distinguished. actions combines actions from created_assertions and gathered_assertions. Per §10.2.2, only created assertions are attributed to the signer. That only matters once validation exists, and v1 claims have no split, so a docs note seems enough for now rather than a code change.
Happy to talk through any of these.
|
Thanks @lnispel, all four addressed:
Section numbers per spec 2.4. One schema question: |
|
@inispel back to you for review |
lnispel
left a comment
There was a problem hiding this comment.
Thanks @i-am-chitti, this covers all four. Reading digital_source_type only from c2pa.created, with the new test for the opened/edited case, is exactly the behavior I was hoping for. The §15.3 rule and the null explanation give the display follow-ups something concrete to build against, and the created/gathered note is clear. Approving.
… be shown; simplify code in a few places
What?
Closes #953
Populates
c2pa.decodedin_wpai_monitor_recordwith the active manifest's claim generator, digital source type and action history.Why?
c2pa.decodedwas alwaysnull; display, filtering and Linked Data follow-ups need the claim data.How?
In-tree, with no new dependencies, per @lnispel's guidance:
Jumbf_Readerwalks theLBox/TBoxsuperbox tree.Cbor_Decoderdecodes the CBOR subset C2PA uses. Depth and declared lengths are bounded, since the input is untrusted.Manifest_Decoderreads the last manifest in the store. Failures go toerrors(decode_jumbf/decode_claim/decode_assertion) and never throw; partial results are kept.Shape:
{ "manifest_label": "string|null", "claim_generator": { "name": "string", "version": "string|null" }, "digital_source_type": "string|null", "actions": [ { "action": "string", "when": "string|null", "softwareAgent": { "name": "string", "version": "string|null" }, "digitalSourceType": "string|null" } ] }claim_generatornormalizes v1claim_generatorand v2claim_generator_info.softwareAgentuses the same{ name, version }shape.digital_source_typeis taken from thec2pa.createdaction.Decode-only: values are unverified claims; verification is tracked in #954 / #1071.
Testing Instructions
tests/fixtures/c2pa/XCA.jpg.wp post meta get <ID> _wpai_monitor_record. Expectedc2pa.decoded:{ "manifest_label": "contentauth:urn:uuid:ee7fc739-e619-44d3-a110-c9ff5dd2588d", "claim_generator": { "name": "make_test_images/0.22.0 c2pa-rs/0.22.0", "version": null }, "digital_source_type": null, "actions": [ { "action": "c2pa.opened", "when": null, "softwareAgent": null, "digitalSourceType": null }, { "action": "c2pa.color_adjustments", "when": null, "softwareAgent": null, "digitalSourceType": null } ] }Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code (Claude Opus 5.5)
Used for: Implementation, tests and docs.
Changelog
Added - In Content Verification, record the claim generator, digital source type and action history from an image's active C2PA manifest. These are unverified claims read from the file.