Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw RANGE_ERROR for indexes outside the length of a bitstring. #104

Merged
merged 3 commits into from
Jan 13, 2024

Conversation

msporny
Copy link
Member

@msporny msporny commented Dec 27, 2023

This PR is an attempt to address issue #9 by updating the validation algorithm to throw a RANGE_ERROR for indexes that are outside the length of a bitstring.


Preview | Diff

|credentialIndex| times the |size| in the |bitstring|.
|credentialIndex| times the |size| in the |bitstring|. If the |credentialIndex|
is a value outside of the range of the |bitstring|, a
<a data-cite="VC-DATA-MODEL-2.0#RANGE_ERROR">RANGE_ERROR</a> MUST be
Copy link
Member

Choose a reason for hiding this comment

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

The current VCDM does not specify a RANGE_ERROR. It only defined PARSING_ERROR, CRYPTOGRAPHIC_SECURITY_ERROR, and MALFORMED_VALUE_ERROR, see https://www.w3.org/TR/vc-data-model-2.0/#problem-details

Copy link
Member Author

Choose a reason for hiding this comment

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

I've opened a PR to register this new type here: w3c/vc-data-model#1405.

@iherman iherman self-requested a review December 28, 2023 16:23
Copy link
Member

@iherman iherman left a comment

Choose a reason for hiding this comment

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

There is now a sister PR to complete this one: w3c/vc-data-model#1405

index.html Outdated
Comment on lines 745 to 746
|credentialIndex| times the |size| in the |bitstring|. If the |credentialIndex|
is a value outside of the range of the |bitstring|, a
Copy link
Member

Choose a reason for hiding this comment

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

This confuses me. |credentialIndex| times the |size| must be within the range of the |bitstring|, since that's what indicated the position of the |status| value. The |credentialIndex| value itself doesn't appear to have any relation to the range of the |bitstring|.

I think the above should change to either

Let |status| be the value in the |bitstring| at the position indicated
by the |credentialIndex| times the |size|. If the |credentialIndex|
times the |size| is a value outside of the range of the |bitstring|, a

or

Let |status| be the value in the |bitstring| at the position indicated
by the |credentialIndex|. If the |credentialIndex| is a value outside
of the range of the |bitstring|, a

This is not made as a GitHub suggestion, because a line "deleted" (really, changed) by the PR (line 745) is enveloped in the three I'm changing (lines 744-746).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 1d1a83a.

index.html Outdated Show resolved Hide resolved
@msporny
Copy link
Member Author

msporny commented Jan 13, 2024

Normative, multiple reviews, changes requested and made, no objections, merging.

@msporny msporny merged commit 479c42d into main Jan 13, 2024
2 checks passed
@msporny msporny deleted the msporny-bounds-checking branch January 13, 2024 16:00
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