Skip to content

fix: error with validation results on invalid manifest after verify after sign#2147

Open
ok-nick wants to merge 24 commits into
mainfrom
ok-nick/verify-after-sign
Open

fix: error with validation results on invalid manifest after verify after sign#2147
ok-nick wants to merge 24 commits into
mainfrom
ok-nick/verify-after-sign

Conversation

@ok-nick
Copy link
Copy Markdown
Contributor

@ok-nick ok-nick commented May 13, 2026

Fixes verify after sign so that it builds up the validation results and returns them in an err if deemed an invalid manifest. It also adds the verify after sign check to the other signing paths, including the embeddable APIs.

The PR introduces a new ValidationFailureSummary so that on error, it will display a concise summary of what failures, on what ingredients occurred. This can also be obtained via ValidationResults::failure_summary for the general case. ValidationResults also now impls Display with a more user-friendly interface.

Also adds a new setting verify_after_sign_hash which rehashes the asset and validates against the hard binding assertion stored. By default this setting is false due to the performance implications. I'm keeping verify_after_sign default to false for now, let's get the fix out first.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 13, 2026

Merging this PR will improve performance by 25.45%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 29 untouched benchmarks
⏩ 64 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory update-manifests/read 5.6 MB 4.5 MB +25.45%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ok-nick/verify-after-sign (21488ba) with main (a48f1cc)

Open in CodSpeed

Footnotes

  1. 64 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Comment thread c2pa_c_ffi/src/c_api.rs Outdated
Comment thread sdk/src/asset_handlers/c2pa_io.rs
Comment thread sdk/src/error.rs Outdated
@ok-nick ok-nick force-pushed the ok-nick/verify-after-sign branch from 96774db to ebcd9ba Compare May 20, 2026 17:26
@ok-nick
Copy link
Copy Markdown
Contributor Author

ok-nick commented May 20, 2026

I kept verify_after_sign disabled for now (as it was already). Let's get the fix out before we change the default.

…id, then default verify after sign to true for tests
Copy link
Copy Markdown
Member

@gpeacock gpeacock left a comment

Choose a reason for hiding this comment

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

This isn't a fix, this is an entirely new way of reporting errors.
I can see how we may want to validate the manifest when we have no asset, but that should report an invalid hash if the manifest is associated with an asset ( and it should always be, except for archives.

Comment thread sdk/src/store.rs
asset_data: Option<&mut ClaimAssetData<'_>>,
context: &Context,
))]
pub(crate) fn validate_manifest(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How is this used? Should callers never call verify_store directly? Could this have just been done in verify_store?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix verify_after_sign setting Signing an update manifest with format application/c2pa will attempt to validate hash bindings

4 participants