docs: align digest and signature types with the runtime - #8
Merged
Conversation
JSON Schemas and OpenAPI previously typed many digest fields as unconstrained strings or minLength 32, which does not match the SHA-256 unpadded base64url encoding the rail actually produces and verifies. Signature values were similarly inconsistent. Tighten those types to the canonical 43-character digest and 86-character Ed25519 encodings, document the verifyBundle return shape, and reject regressions in the repository check.
Comment on lines
+27
to
+28
| const SHA256_DIGEST_PATTERN = "^[A-Za-z0-9_-]{43}$"; | ||
| const ED25519_SIGNATURE_PATTERN = "^[A-Za-z0-9_-]{86}$"; |
There was a problem hiding this comment.
🟡 Schemas accept noncanonical encodings
The new ED25519_SIGNATURE_PATTERN accepts signatures with nonzero trailing padding bits. Schema-compliant signatures can therefore fail runtime verification; digest patterns have the same defect.
Suggested change
| const SHA256_DIGEST_PATTERN = "^[A-Za-z0-9_-]{43}$"; | |
| const ED25519_SIGNATURE_PATTERN = "^[A-Za-z0-9_-]{86}$"; | |
| const SHA256_DIGEST_PATTERN = "^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$"; | |
| const ED25519_SIGNATURE_PATTERN = "^[A-Za-z0-9_-]{85}[AQgw]$"; |
Was this helpful? React with 👍 or 👎 to provide feedback.
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.
What
Align protocol types with the encodings the reference runtime actually uses:
JSON Schemas previously mixed that pattern with
minLength: 32and unconstrained strings. OpenAPI omitted the same constraints on action views and documented only a subset ofPOST /v0/bundles/verifyfields.Why
Consumers of the schemas, OpenAPI surface, and library APIs could accept encodings the rail rejects. The artifact model already specified unpadded base64url; the typed documents did not.
How tested
node ./scripts/check.jsnode --test(107 tests)