-
Notifications
You must be signed in to change notification settings - Fork 77
{[inert function]} from toString() for Math.random etc. #910
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
Comments
Therefore, retroactive removal of standard function properties should replace them with a throw-only functions that throw a reasonable diagnostic explanation. Likewise, perhaps, retroactive removal of data properties should turn them into throw-only accessors. This seems more unpleasant, but is also exceedingly rare. |
This guidance is consist with what XS has long done when minimizing a VM for embedded targets. For example, when the XS linker determines that a project does not use |
Good, that's what I expected. SES is not yet doing this, so this bug remains open for us |
Since we are on the topic... in secure mode, the XS implementation of SES replaces Math.random() with a function that throws a TypeError with the message "secure mode". Date.now() and appropriate paths of the Date constructor throw the same error. |
See #1664 |
See especially thread starting at #1664 (review) . Conclusion is that the SES shim should only poison Some odd cases worth discussing:
|
Closes: #XXXX Refs: #910 (comment) #1718 #2354 #910 ## Description While investigating #2354 , I just tried it locally by visiting file:///.../endojs/endo/packages/ses/demos/console/index.html and file:///.../endojs/endo/packages/ses/demos/challenge/index.html in my browser. The first is the SES demo console, which worked just fine. The second is the SES Escape Room, which still relied on the disabled `Date.now()` not throwing. Indeed, before #1718 a disabled (secure mode) `Date.now()` returned `NaN`. But #1718 changed it to throw. What's strange is that in #1718 I revise endojs/endo/packages/ses/demos/challenge/index.html to adjust the text to say that `Date.now()` is "disabled" rather than "NaN". But I didn't fix the escape room code. Although I found this while investigating #2354 , this is a completely distinct bug that is unrelated to #2354 . This PR itself does nothing to fix #2354 . ### Security Considerations none ### Scaling Considerations none ### Documentation Considerations All our docs that link to an explain the Escape Room challenge need to be revisited, especially once #2354 is fixed. For example, https://agoric.com/blog/technology/a-taxonomy-of-security-issues , which I just verified links to the broken page reported at #2354 ### Testing Considerations It is frustrating that the Escape Room is broken at least since #1718 , and also broken by #2354 for an undetermined period of time, without anyone noticing until now. It would be good to bring that site under some kind of automated testing. ### Compatibility Considerations none ### Upgrade Considerations none
In a discussion of API evolution, @erights noted that for new features, testing for new properties by name works well, but for retroactive changes such as making
Math.random()
inert, it's unrealistic to expect code to test for absence of a property.IOU more explanation, but I have a meeting...
cc @phoddie
The text was updated successfully, but these errors were encountered: