FF156 SubtleCrypto.deriveBits() length TypeError - #45545
Open
hamishwillee wants to merge 1 commit into
Open
Conversation
hamishwillee
requested review from
sideshowbarker
and removed request for
a team
September 7, 2026 06:51
Contributor
|
Preview URLs (1 page) |
hamishwillee
commented
Sep 7, 2026
Comment on lines
+57
to
+58
| - `TypeError` | ||
| - : Raised if the _length_ parameter of the `deriveBits()` call is negative, non-finite (`NaN` or `Infinity`), or greater than 4294967295 (`2^32 - 1`). |
Collaborator
Author
There was a problem hiding this comment.
This is the main change. I've put it first because it would be evaluated before everything else.
hamishwillee
commented
Sep 7, 2026
Comment on lines
+60
to
+64
| - : Raised for reasons specific to the requested derivation algorithm. | ||
| - For HKDF and PBKDF2, raised if the [`length`](#length) parameter is `null` or is not a multiple of 8. | ||
| - For PBKDF2, also raised if the `iterations` parameter is zero. | ||
| - For ECDH and X25519, raised if the requested `length` is greater than the number of bits the algorithm can derive (256 bits for X25519; the field size of the curve for ECDH). | ||
| For X25519 only, if the derived secret is all zero. |
Collaborator
Author
There was a problem hiding this comment.
This is reworked around what the spec actually says. I am fairly confident of it, based on Claude interrogation.
8 tasks
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.
FF156 added a
[EnforcRange]on the IDL for thelengthparameter in SubtleCrypto.deriveBits().This enforces the range on the
lengthpassed to the parameter to the type of the underlying IDL - thowing a TypeError.As a result, some errors that would previously have been OperationErrors are now TypeErrors.
This updates the docs for the method.:
Related docs work can be tracked in #45507