refactor: shared asset size validation - #169
Merged
Merged
Conversation
…o feat/shared-guards
…o feat/shared-guards
🦋 Changeset detectedLatest commit: 7dbf7f0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ale-adobe
commented
Aug 3, 2026
| expect(reader).toBeNull(); | ||
| }); | ||
|
|
||
| test('should throw UnsupportedFormatError for an unsupported format', async ({ |
Collaborator
Author
There was a problem hiding this comment.
Adding some missing unit test coverage for error handling.
ale-adobe
marked this pull request as ready for review
August 3, 2026 23:46
ale-adobe
marked this pull request as draft
August 4, 2026 00:15
tmathern
reviewed
Aug 5, 2026
tmathern
left a comment
Collaborator
There was a problem hiding this comment.
- If fragmented media are supported, make sure also all fragments are checked as they go in (not just the first one).
- This is a minor change (new error code exported in the API), not a patch.
…o feat/shared-guards
…or negative values
…o feat/shared-guards
ale-adobe
commented
Aug 10, 2026
| throw new AssetTooLargeError(init.size); | ||
| } | ||
| validateAssetSize(init.size, MAX_SIZE_IN_BYTES); | ||
| validateAssetSize(fragment.size, MAX_SIZE_IN_BYTES); |
Collaborator
Author
There was a problem hiding this comment.
We were never checking the fragment size before, but we are now!
ale-adobe
marked this pull request as ready for review
August 10, 2026 22:01
tmathern
approved these changes
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR pulls out asset size validation from
c2pa-webinto a shared utility library inc2pa-utilities, and then adds that validation check toc2pa-node'sReaderfactories.c2pa-webmaintains its existing 1 GB size limit, whilec2pa-nodegains a new 10 GB size limit. These are hard-coded at the moment in the source code and cannot be configured by clients. In the future, I intend to make these configurable once we have a more formalized concept of aContextand we can better support global settings per SDK instance in a way that is easily shared between both packages.