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

Check certificate before passing to wasm #374

Merged

Conversation

glitch003
Copy link
Collaborator

When the VCEK certificate retrieval fails, the wasm breaks. This is breaking out of a surrounding try / catch on AWS lambda.

This PR checks the VCEK certificate before passing it to wasm. The hope is that, if the cert retrieval fails, we just return a JS error, and the error doesn't come from the WASM.

I picked 256 as the minimum certificate size because it seems reasonable. They are typically 1300 bytes so if it's less than 256 it's probably just an error message or something.

I have no idea if this works because I can't reproduce the bug - the certificates always retrieve properly for me. But this is an attempt at a fix.

Ansonhkg and others added 13 commits February 14, 2024 14:46
#360)

* use testThis in testThese to unify criteria and fix the pipeline that was missing some tests due to testThese finishing the process with code 0

* fmt

* remove problematic process.exit
* Add `K256` as alias of `ECDSA_CAIT_SITH` sig type (#356)

* add comment pointing to repo

---------

Co-authored-by: Massimo Cairo <[email protected]>
* implement new interface to unify session authentication in client

* fix eth pkp wallet creation unit test

* update test to use global config

* add test group to CI

* change encryption test to also validate getting session sigs from cache

* remove process termination order included on testThese that was avoiding other tests to run

* Add `K256` as alias of `ECDSA_CAIT_SITH` sig type (#356)

* fix rpc constant used in testing

* add empty resourceAbilityRequests to test

* fix and clean test using new session cache interface to sign using PKPEthersWallet

* fix encryption test

* remove old test

* staging

* chore: update readme

* v?

* use throwError function

* remove unnnecessary sessionKeys as they are obtained from cache afterwards

* move authContext validation to function that validates the PKP auth context

* backwards compatibility to avoid a breaking change

* fmt

* fmt

* fix siwe import

---------

Co-authored-by: Massimo Cairo <[email protected]>
Co-authored-by: Ansonhkg <[email protected]>
* remove 3rd party libs

* fix: revert back to fix react

* it works

* cherry picks 735438f 3b0422f

* readme

* resolve conflicts

---------

Signed-off-by: Anson <[email protected]>
Base automatically changed from staging/3.2.0 to master February 21, 2024 01:58
@Ansonhkg Ansonhkg mentioned this pull request Feb 21, 2024
5 tasks
@Ansonhkg Ansonhkg changed the base branch from master to staging/3.2.1 February 21, 2024 02:13
@CLAassistant
Copy link

CLAassistant commented Feb 22, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
3 out of 4 committers have signed the CLA.

✅ FedericoAmura
✅ Ansonhkg
✅ glitch003
❌ cairomassimo
You have signed the CLA already but the status is still pending? Let us recheck it.

@Ansonhkg Ansonhkg merged commit 2ebb737 into staging/3.2.1 Feb 22, 2024
0 of 4 checks passed
@Ansonhkg Ansonhkg deleted the fix/check-cert-outside-wasm-before-passing-it-in branch February 22, 2024 04:58
Ansonhkg added a commit that referenced this pull request Feb 22, 2024
* init patch

* Feature/lit 2545 js sdk fix cosmjscrypto (#381)

* fix: should add dependencies to related packages

* fix: include cosmos dependencies

* fix: correct version

* fix: correct version

* Check certificate before passing to wasm (#374)

* init release

* feat: fix contracts-sdk (#359)

* use testThis in testThese to unify criteria and fix the pipeline that… (#360)

* use testThis in testThese to unify criteria and fix the pipeline that was missing some tests due to testThese finishing the process with code 0

* fmt

* remove problematic process.exit

* Add `K256` as alias of `ECDSA_CAIT_SITH` sig type

* add CI run on PRs targeting staging branches (#361)

* add comment pointing to repo (#362)

* Add `K256` as alias of `ECDSA_CAIT_SITH` sig type (#356)

* add comment pointing to repo

---------

Co-authored-by: Massimo Cairo <[email protected]>

* prettied

* feature/lit-2511-js-sdk-review-remove-lit-siwe (#373)

* implement new interface to unify session authentication in client (#358)

* implement new interface to unify session authentication in client

* fix eth pkp wallet creation unit test

* update test to use global config

* add test group to CI

* change encryption test to also validate getting session sigs from cache

* remove process termination order included on testThese that was avoiding other tests to run

* Add `K256` as alias of `ECDSA_CAIT_SITH` sig type (#356)

* fix rpc constant used in testing

* add empty resourceAbilityRequests to test

* fix and clean test using new session cache interface to sign using PKPEthersWallet

* fix encryption test

* remove old test

* staging

* chore: update readme

* v?

* use throwError function

* remove unnnecessary sessionKeys as they are obtained from cache afterwards

* move authContext validation to function that validates the PKP auth context

* backwards compatibility to avoid a breaking change

* fmt

* fmt

* fix siwe import

---------

Co-authored-by: Massimo Cairo <[email protected]>
Co-authored-by: Ansonhkg <[email protected]>

* remove vanilla js builds (#372)

* Feature/lit 2494 js sdk get rid of lit third party libs (#371)

* remove 3rd party libs

* fix: revert back to fix react

* it works

* cherry picks 735438f 3b0422f

* readme

* resolve conflicts

---------

Signed-off-by: Anson <[email protected]>

* fix: build issues

* Check certificate before passing to wasm

---------

Signed-off-by: Anson <[email protected]>
Co-authored-by: Ansonhkg <[email protected]>
Co-authored-by: Federico Amura <[email protected]>
Co-authored-by: Massimo Cairo <[email protected]>

* fix: add blockhash to react demo app (#379)

---------

Signed-off-by: Anson <[email protected]>
Co-authored-by: Chris Cassano <[email protected]>
Co-authored-by: Federico Amura <[email protected]>
Co-authored-by: Massimo Cairo <[email protected]>
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