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

[wasm][tests] Use a polyfill library to provide Web Crypto API #42731

Closed
wants to merge 2 commits into from
Closed

[wasm][tests] Use a polyfill library to provide Web Crypto API #42731

wants to merge 2 commits into from

Conversation

kjpou1
Copy link
Contributor

@kjpou1 kjpou1 commented Sep 25, 2020

Use Microsoft's provided Web Cryptography polyfill API in the test CI.

close #42730

part of #40074

@ghost
Copy link

ghost commented Sep 25, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@steveisok
Copy link
Member

Ah, cool. We'll have something more legit when running against v8.

steveisok
steveisok previously approved these changes Sep 25, 2020
@marek-safar
Copy link
Contributor

Why do we need this? This looks like the scenario we don't need to support and the one we need to support cannot be tested this way

@kjpou1 kjpou1 requested a review from jkotas September 25, 2020 14:19
@kjpou1
Copy link
Contributor Author

kjpou1 commented Sep 25, 2020

It provides the same interface as the browser web cryptography api that can be run in the CI test harness without the need for browser frontend to provide them.

Edit: Also to follow up on the back of Steve's comment it does provide a pretty much real-ish implementation of the getRandomValues instead of workaround.

buffer[0] = (Math.random()*256)|0;

@steveisok
Copy link
Member

steveisok commented Sep 25, 2020

Why do we need this? This looks like the scenario we don't need to support and the one we need to support cannot be tested this way

@marek-safar While not absolutely necessary, I think it's more 'complete' to have the polyfill.

Copy link
Contributor

@marek-safar marek-safar left a comment

Choose a reason for hiding this comment

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

@steveisok the idea was to cut any custom implementation for crypto by calling into browser's APIs. Replacing one external implementation with another proxy implementation does not help us as we'll responsible for all the deployment and security problems.

@runfoapp runfoapp bot mentioned this pull request Sep 25, 2020
@kjpou1
Copy link
Contributor Author

kjpou1 commented Sep 25, 2020

This will not be deployed with our implementations. It is only to facilitate the testing of the API via the CI. The test code will be written to the browser spec and the polyfill will only facilitate the test api without the need for browser test harness at all. Actually what the polyfill implementation that is linked was written for.

@GrabYourPitchforks
Copy link
Member

This adds ~400KB to the source repos. Since we'll probably need to keep these new dependencies up-to-date, I imagine this cost will grow over time.

Is there any other way to pull this in? For example, via a runtime-assets package?

@GrabYourPitchforks
Copy link
Member

Also, if we're going to take a dependency on the MSR polyfill, what commit hash are we basing these files from? I can send an update for Component Governance once you're finished.

@steveisok
Copy link
Member

I don’t think it’s worth taking this dependency. I would recommend we close the PR.

@ghost
Copy link

ghost commented Sep 27, 2020

Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @jeffhandley
See info in area-owners.md if you want to be subscribed.

@kjpou1
Copy link
Contributor Author

kjpou1 commented Sep 28, 2020

Closing the PR as it brings in an unwanted dependency as per the comments above. Thanks everyone for providing feedback.

@kjpou1 kjpou1 closed this Sep 28, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
@kjpou1 kjpou1 deleted the wasm-crypto-polyfill branch February 3, 2021 10:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[wasm][tests] Use a polyfill for WebCrypto API support
7 participants