-
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): call lockdown before bundling SES shim #2337
Conversation
packages/ses/scripts/bundle.js
Outdated
lockdown(); | ||
|
||
import '../index.js'; |
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.
IIUC, this does not actually change the order in which things happen, at least in the absence of cyclic imports. All imported modules are evaluated/initialized before the code in this module starts evaluation/initialization. So either way, ../index.js
initialization will happen before this call to lockdown
.
Attn @kriskowal
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.
This is true. To interleave behavior relative to other imports, we have to use a module like lockdown.js
that just calls lockdown()
. So,
import '../index.js'; // or maybe import 'ses' reflexively works now
import './lockdown.js'; // just lockdown()
This insures that ./index.js
initializes before you call lockdown()
.
It’s unclear why the tests pass with this defect. It might be that we need to test yarn build
under yarn test
.
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.
makes sense ^ reverted feat(ses): call lockdown earlier, looks good now
import './lockdown.js'; // just lockdown()
think we meant import '../lockdown.js';
right
if we prefer this vs import '../index.js';
seems either is fine, since they're both importing the same index file
ah so we should import both, done here 82a4bb4
then hopefully add/update a test to ensure ../lockdown.js
is imported before calling lockdown()
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.
It’s unclear why the tests pass with this defect. It might be that we need to test
yarn build
underyarn test
.
yeah the tests still pass calling lockdown() too early before the imports 🤔
endo/packages/ses/package.json
Line 75 in 7a29550
"test": "tsd && ava", |
even when doing a clean build before "test": "yarn prepare && tsd && ava",
if that's what we meant
/* global process */ | ||
|
||
import '../index.js'; |
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.
import '../index.js'; | |
// eslint-disable-next-line import/no-extraneous-dependencies | |
import 'ses'; |
also seems ok here (as mentioned earlier)
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.
I'm approving to clear my previous "request changes". FWIW LGTM, but on this I defer to @kriskowal . Please wait for an approval from him.
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.
Posted the required change. Thank you for engaging!
resolve: endojs#2337 (comment) Co-authored-by: Kris Kowal <kriskowal@kriskowal.com>
resolve: endojs#2337 (comment) Co-authored-by: Kris Kowal <kriskowal@kriskowal.com>
23cd2cb
to
fb2c591
Compare
This reverts commit b5c0471.
Ensure `./index.js` initialised before calling `lockdown()`
resolve: endojs#2337 (comment) Co-authored-by: Kris Kowal <kriskowal@kriskowal.com>
fb2c591
to
4f528a5
Compare
Description
Call lockdown before bundling the SES shim
Discussion: https://youtu.be/qGGeACz4cyM
Security Considerations
lockdown()
yarn build
now also logs to console (e.g.Removing unpermitted intrinsics
) if non-standard JS called beforelockdown()
Scaling Considerations
Documentation Considerations
Testing Considerations
Compatibility Considerations
Upgrade Considerations