You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ses): lockdown options should be kebob-case (#2739)
Closes: #XXXX
Refs: #961#2690#2723
## Description
#961 deviated from our general convention that lockdown option values be
kebob-case, instead adding `evalTaming:` option values `safeEval`,
`unsafeEval`, `noEval`. (I approved #961 at the time, apparently without
noticing this discrepancy.) This PR fixes those to be `safe-eval`,
`unsafe-eval`, and `no-eval`. But to avoid breaking any old usage, this
PR ensure the only names continue to work for now, but always commented
in the code as "deprecated".
This PR does only that. Other changes to the relevant lockdown option or
relevant lockdown options machinery are left to #2723 or #2690
respectively. I request that this PR go first, with those others
adjusting to this one.
### Security Considerations
none
### Scaling Considerations
non
### Documentation Considerations
This PR simply changes the documentation to use the new names without
ever mentioning the deprecated old names. That seems like an appropriate
simplification for the docs.
### Testing Considerations
With a bit of duplication and renaming, we now test the new names and
the old deprecated names.
### Compatibility Considerations
To avoid breaking any old usage, this PR ensure the only names continue
to work for now, but always commented in the code as "deprecated". It
would be very nice to eventually be able to retire the deprecated names,
but I find it hard to imagine how we'd test that it is safe to do so.
### Upgrade Considerations
Nothing BREAKING, since the old deprecated names continue to work.
- [x] Update `NEWS.md` for user-facing changes.
@@ -574,15 +574,15 @@ The default lockdown behavior isolates all of these evaluators.
574
574
575
575
Replacing the realm's initial evaluators is not necessary to ensure the
576
576
isolation of guest code because guest code must not run in the start compartment.
577
-
Although the code run in the start compartment is normally referred to as "trusted", we mean only that we assume it was not written maliciously. It may still be buggy, and it may be buggy in a way that is exploitable by malicious guest code. To limit the harm that such vulnerabilities can cause, the default (`"safeEval"`) setting replaces the evaluators of the start compartment with their safe alternatives.
577
+
Although the code run in the start compartment is normally referred to as "trusted", we mean only that we assume it was not written maliciously. It may still be buggy, and it may be buggy in a way that is exploitable by malicious guest code. To limit the harm that such vulnerabilities can cause, the default (`"safe-eval"`) setting replaces the evaluators of the start compartment with their safe alternatives.
578
578
579
579
However, in the shim, only the exact `eval` function from the start compartment can be used to
580
-
perform direct-eval, which runs in the lexical scope in which the direct-eval syntax appears (direct-eval is a special form rather than a function call).
580
+
perform direct-eval, which runs in the lexical scope in which the direct-eval syntax appears (the direct-eval syntax is a special form rather than a function call).
581
581
The SES shim itself uses direct-eval internally to construct an isolated
582
582
evaluator, so replacing the initial `eval` prevents any subsequent program
583
583
from using the same mechanism to isolate a guest program.
584
584
585
-
The `"unsafeEval"` option for `evalTaming` leaves the original `eval` in place
585
+
The `"unsafe-eval"` option for `evalTaming` leaves the original `eval` in place
586
586
for other isolation mechanisms like isolation code generators that work in
587
587
tandem with SES.
588
588
This option may be useful for web pages with an environment that allows `unsafe-eval`,
@@ -593,28 +593,28 @@ In these cases, SES cannot be responsible for maintaining the isolation of
593
593
guest code. If you're going to use `eval`, [Trusted
594
594
Types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types) may help maintain security.
595
595
596
-
The `"noEval"` option emulates a Content Security Policy that disallows
596
+
The `"no-eval"` option emulates a Content Security Policy that disallows
597
597
`unsafe-eval` by replacing all evaluators with functions that throw an
598
598
exception.
599
599
600
600
```js
601
-
lockdown(); // evalTaming defaults to 'safeEval'
601
+
lockdown(); // evalTaming defaults to 'safe-eval'
602
602
// or
603
-
lockdown({ evalTaming:'noEval' }); // disallowing calling eval like there is a CSP limitation.
603
+
lockdown({ evalTaming:'no-eval' }); // disallowing calling eval like there is a CSP limitation.
604
604
// vs
605
605
606
606
// Please use this option with caution.
607
607
// You may want to use Trusted Types or Content Security Policy with this option.
608
-
lockdown({ evalTaming:'unsafeEval' });
608
+
lockdown({ evalTaming:'unsafe-eval' });
609
609
```
610
610
611
611
If `lockdown` does not receive an `evalTaming` option, it will respect
# SES is disallowing eval in the current compartment (`SES_NO_EVAL`)
2
2
3
-
The SES Hardened JavaScript shim is configured to reject any source evaluation in the current compartment. This is configured in the `lockdown` option. To mitigate this error, change the [lockdown option `"evalTaming"`](../docs/lockdown.md) from `"noEval"` to either `"safeEval"` (default) or `"unsafeEval"`.
3
+
The SES Hardened JavaScript shim is configured to reject any source evaluation in the current compartment. This is configured in the `lockdown` option. To mitigate this error, change the [lockdown option `"evalTaming"`](../docs/lockdown.md) from `"no-eval"` to either `"safe-eval"` (default) or `"unsafe-eval"`.
0 commit comments