-
Notifications
You must be signed in to change notification settings - Fork 579
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
Harden custom endowments #1172
Harden custom endowments #1172
Conversation
b777257
to
642e3dc
Compare
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #1172 +/- ##
==========================================
+ Coverage 94.09% 94.12% +0.02%
==========================================
Files 140 140
Lines 5773 5800 +27
Branches 859 863 +4
==========================================
+ Hits 5432 5459 +27
Misses 341 341
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
f129d26
to
aebaf77
Compare
packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts
Outdated
Show resolved
Hide resolved
packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts
Outdated
Show resolved
Hide resolved
packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts
Outdated
Show resolved
Hide resolved
packages/snaps-execution-environments/src/common/test-utils/testUtils.ts
Outdated
Show resolved
Hide resolved
packages/snaps-execution-environments/src/common/test-utils/testUtils.ts
Outdated
Show resolved
Hide resolved
packages/snaps-execution-environments/src/common/test-utils/testUtils.ts
Outdated
Show resolved
Hide resolved
packages/snaps-execution-environments/src/common/test-utils/endowments.ts
Outdated
Show resolved
Hide resolved
packages/snaps-execution-environments/src/common/BaseSnapExecutor.test.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, I'll give it another pass.
bdfae53
to
669dea7
Compare
packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts
Outdated
Show resolved
Hide resolved
8566414
to
25afade
Compare
packages/snaps-execution-environments/src/common/BaseSnapExecutor.test.ts
Outdated
Show resolved
Hide resolved
packages/snaps-execution-environments/src/common/endowments/index.ts
Outdated
Show resolved
Hide resolved
Refactor proxy to avoid errors after hardening
55cc116
to
6b54ee3
Compare
packages/snaps-execution-environments/src/common/BaseSnapExecutor.ava.test.ts
Show resolved
Hide resolved
packages/snaps-execution-environments/src/common/BaseSnapExecutor.ava.test.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks done
Fixes: #1017
This PR will add implementation for hardening of the custom endowments:
ethereum
andsnap
.Final result should ensure that these endowments cannot be changed within their prototype chain.
Hardening is done by using
harden
function provided bySES
.There are minor adaptations to the Proxy implementations of these endowments in order to prevent these objects leaking their prototype chain up to the StreamProvider and further. This is required because the
harden
function will reach the parts of the StreamProvider and further, then freeze it. Deep freeze of the Stream functionalities would prevent it from working properly. This way, the hardening is done and the prototype chain is safe.