Skip to content

C2PA Monitor: Decode active manifest into c2pa.decoded - #1178

Merged
dkotter merged 12 commits into
WordPress:developfrom
i-am-chitti:feature/953-c2pa-jumbf-cbor-decoder
Nov 18, 2026
Merged

dkotter merged 12 commits into
WordPress:developfrom
i-am-chitti:feature/953-c2pa-jumbf-cbor-decoder

Conversation

@i-am-chitti

@i-am-chitti i-am-chitti commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #953

Populates c2pa.decoded in _wpai_monitor_record with the active manifest's claim generator, digital source type and action history.

Why?

c2pa.decoded was always null; display, filtering and Linked Data follow-ups need the claim data.

How?

In-tree, with no new dependencies, per @lnispel's guidance:

  • Jumbf_Reader walks the LBox/TBox superbox tree.
  • Cbor_Decoder decodes the CBOR subset C2PA uses. Depth and declared lengths are bounded, since the input is untrusted.
  • Manifest_Decoder reads the last manifest in the store. Failures go to errors (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_generator normalizes v1 claim_generator and v2 claim_generator_info. softwareAgent uses the same { name, version } shape.
  • digital_source_type is taken from the c2pa.created action.

Decode-only: values are unverified claims; verification is tracked in #954 / #1071.

Testing Instructions

  1. Enable Content Verification and upload tests/fixtures/c2pa/XCA.jpg.
  2. Run wp post meta get <ID> _wpai_monitor_record. Expected c2pa.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.

Open WordPress Playground Preview

@i-am-chitti
i-am-chitti requested a review from a team October 14, 2026 09:28
@i-am-chitti
i-am-chitti requested a review from jeffpaul as a code owner October 14, 2026 09:28
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

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.

Co-authored-by: i-am-chitti <iamchitti@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: lnispel <originvault@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.43260% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.70%. Comparing base (8ff054e) to head (01c4c6b).

Files with missing lines Patch % Lines
includes/Experiments/C2pa_Monitor/Cbor_Decoder.php 98.26% 2 Missing ⚠️
includes/Experiments/C2pa_Monitor/Jumbf_Reader.php 97.22% 2 Missing ⚠️
...udes/Experiments/C2pa_Monitor/Manifest_Decoder.php 99.23% 1 Missing ⚠️
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     
Flag Coverage Δ
unit 85.70% <98.43%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffpaul

Copy link
Copy Markdown
Member

@lnispel I'd be curious for your review here

@jeffpaul jeffpaul added this to the 1.5.0 milestone Oct 21, 2026

@lnispel lnispel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

  1. 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?

  2. 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?

  3. 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?

  4. 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.

@jeffpaul jeffpaul mentioned this pull request Oct 28, 2026
31 of 46 tasks
@dkotter dkotter modified the milestones: 1.5.0, 1.6.0 Oct 28, 2026
@i-am-chitti

Copy link
Copy Markdown
Contributor Author

Thanks @lnispel, all four addressed:

  1. Docs cite §15.3 and list both required warnings.
  2. digital_source_type now comes only from c2pa.created; fallback removed.
  3. Docs state null means the origin isn't recorded in the active manifest, not "not AI-generated".
  4. Docs note that created and gathered actions aren't distinguished.

Section numbers per spec 2.4.

One schema question: softwareAgent is normalized to { name, version } (like claim_generator), since it's a string in v1 and a map in v2. Does that work for you?

@jeffpaul
jeffpaul requested a review from lnispel November 10, 2026 22:36
@jeffpaul

Copy link
Copy Markdown
Member

@inispel back to you for review

@lnispel lnispel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dkotter
dkotter merged commit 2d5b81e into WordPress:develop Nov 18, 2026
36 of 37 checks passed
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.

C2PA Monitor: JUMBF box reader and CBOR decoder for c2pa.decoded

4 participants