test: cover webcrypto prototype pollution systematically#63520
Open
panva wants to merge 1 commit into
Open
Conversation
Drive the regression test from the WebCrypto algorithm registry so all supported algorithms and operations must add explicit coverage regardless of whether they are native-job backed or js-based. Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Collaborator
|
Review requested:
|
Renegade334
approved these changes
May 23, 2026
Comment on lines
37
to
52
| const constructorDescriptor = | ||
| Object.getOwnPropertyDescriptor(Promise.prototype, 'constructor'); | ||
| const speciesDescriptor = | ||
| Object.getOwnPropertyDescriptor(Promise, Symbol.species); | ||
| let promise; | ||
| Object.defineProperty(Promise.prototype, 'constructor', { | ||
| __proto__: null, | ||
| configurable: true, | ||
| get: common.mustNotCall( | ||
| `${name} Promise.prototype.constructor getter`), | ||
| }); | ||
| Object.defineProperty(Promise, Symbol.species, { | ||
| __proto__: null, | ||
| configurable: true, | ||
| get: common.mustNotCall(`${name} Promise[Symbol.species] getter`), | ||
| }); |
Member
There was a problem hiding this comment.
Nit: this operation is used a lot, might be an idea to cache the descriptors (originals and dummies) for re-use.
Comment on lines
74
to
79
| const descriptor = Object.getOwnPropertyDescriptor(prototype, 'then'); | ||
| Object.defineProperty(prototype, 'then', { | ||
| __proto__: null, | ||
| configurable: true, | ||
| get: common.mustNotCall(`${name} ${prototypeName}.prototype.then`), | ||
| }); |
This comment was marked as outdated.
This comment was marked as outdated.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63520 +/- ##
==========================================
- Coverage 90.13% 90.12% -0.01%
==========================================
Files 718 718
Lines 228399 228400 +1
Branches 42931 42941 +10
==========================================
- Hits 205860 205841 -19
- Misses 14283 14314 +31
+ Partials 8256 8245 -11
🚀 New features to boost your workflow:
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
jasnell
approved these changes
May 23, 2026
Collaborator
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.
Followup to #63363 - drive the regression test from the WebCrypto algorithm registry so all supported algorithms and operations are covered regardless of whether they are native-job backed or js-based.
I extracted this from a WIP that adds js-based Hybrid KEM algorithms to Web Cryptography (based on a discussion with the Chromium team, pending spec merge).