-
Notifications
You must be signed in to change notification settings - Fork 74
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
feat(ses,pass-style): use non-trapping integrity trait for safety #2675
base: markm-no-trapping-shim
Are you sure you want to change the base?
Conversation
c0354eb
to
6bbdc1a
Compare
aed8d00
to
cb1e1f6
Compare
6bbdc1a
to
dcf739c
Compare
cb1e1f6
to
5c38d8c
Compare
dcf739c
to
128ef21
Compare
98e6396
to
f7d527c
Compare
7f44397
to
dde0022
Compare
49d9dfb
to
5bc9589
Compare
@michaelfig Adding you as an additional reviewer. Please look at least at the changes to eventual-send and captp. Thanks! |
c0d1ae2
to
7c0edb8
Compare
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.
Your changes to eventual-send and captp LGTM.
Is it too late to change all occurrences of "no-trapping" to "non-trapping"? That would be more consistent with other terms in the integrity levels, like "non-frozen".
f7d527c
to
29223ef
Compare
85d55f0
to
0c6aa83
Compare
78c5b8b
to
6d3c6f2
Compare
afe438b
to
7ab2643
Compare
6d3c6f2
to
bb949c1
Compare
7ab2643
to
9b20c1b
Compare
bb949c1
to
103c1bb
Compare
9b20c1b
to
c9b61ee
Compare
103c1bb
to
5b48cc6
Compare
642154e
to
2b82131
Compare
3ceaac9
to
721c7e1
Compare
bcc292a
to
2277afa
Compare
721c7e1
to
00efef2
Compare
2277afa
to
b5a9f15
Compare
00efef2
to
1b36221
Compare
b5a9f15
to
4646e3d
Compare
0098db1
to
a11fc2e
Compare
The shim is now opt-in, i.e., disabled by default. It has no effect unless explicitly opting in to the new behavior via env-options |
No longer any need to wait on that. This PR is again Ready for Review. PTAL |
a11fc2e
to
e40dcb3
Compare
2c3def1
to
95526ee
Compare
e40dcb3
to
8173b85
Compare
Staged on #2673
Closes: #XXXX
Refs: #XXXX
Description
Use of the non-trapping integrity level, as provided by the ponyfill and shim at #2673 , for additional safety of both the ses-shim and @endo/pass-style.
Object
,Reflect
}.
{isNoTrapping
,suppressTrapping
})harden
tosuppressTrapping
at each step, rather than merelyfreeze
passStyleOf
so that it checksisNoTrapping
where it currently checksisFrozen
.Security Considerations
The point. By having
passStyleOf
ensure that copyData (copyList
,copyRecord
,tagged
) is non-trapping, we enable programming patterns that check this pass-style early on suspect parameters. Once those checks pass, we now know we can operate on such copy-data within the function body without the possibility that these operations cause interleaving with foreign code, and thus without vulnerability to reentrancy hazards or attacks.Scaling Considerations
In addition to those documented at #2673:
harden
of XS to dosuppressTrapping
at each step, we need to remove the shortcut to use the nativeharden
if there is one. This will be expensive. Likely too expensive to use in production.Documentation Considerations
Other than those documented at #2673, none
Testing Considerations
Because our checks for acyclic package dependencies does not distinguish between
dependencies
anddevDependencies
, if we want to continue to useses-ava
to test@endo/non-trapping-shim
, but also haveses
depend on@endo/non-trapping-shim
for enhancingharden
, we will need to move the@endo/non-trapping-shim
tests somewhere else. Or find another way to avoid the package-dependency-cycle diagnostic.ava
.We should also write tests that fail with the prior freeze-only
harden
behavior, especially tests that demonstrate reentrancy attacks, and see that those test newly pass with this PR.Because this PR's CI is for testing in the shim's default opt-out state, we need to do something else to run all these CI tests when the shim is opted into. We use DO NOT MERGE flip non trapping shim default #2699 as a temporary placeholder to do so. It flips the shim to opt-out, so that it defaults to
'enabled'
. If CI passes in that PR, we take that as confirmation that this PR is compat with both states. However, this duality is not itself something we can automatically retest for future PRs.Compatibility Considerations
In addition to those documented at #2673:
Proxies on frozen almost-empty targets often still do useful work in their trap handlers. This is because
get
andhas
, for example, if about non-own property names, are still general traps. In addition,apply
can ignore the call behavior of its target and just do its own thing. For these cases, we need to be careful not to harden the target or proxy. We need to find and convert these cases to explicitlyfreeze
.Going the other way, some tests would
freeze
some inputs topassStyleOf
, depending on thesefreeze
calls to make the known-input-structure hardened, or hardened enough. But now thatpassStyleOf
requires non-trapping, this should usually be changed toharden
.Upgrade Considerations
Other than those documented at #2673, none