Skip to content
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

Tame Promise.resolve #1130

Open
mhofman opened this issue Mar 22, 2022 · 0 comments
Open

Tame Promise.resolve #1130

mhofman opened this issue Mar 22, 2022 · 0 comments
Assignees
Labels
endo enhancement New feature or request kriskowal-review-2024-01 Issues that kriskowal wants to bring to the attention of the team for review as of January, 2024 ses

Comments

@mhofman
Copy link
Contributor

mhofman commented Mar 22, 2022

@erights's intention for Promise.resolve was that it'd be safe against evil promises and callbacks. To quote #1126:

My original intention on tc39 was that an expression like

Promise.resolve(p).then(whatever);

protect the code it appears in from reentrancy attacks no matter what p is. IOW, even if p and whatever are provided by an adversary, that adversary should not be able to get of their choosing to run within the caller's turn. However, this was attackable by installing a then function` as an own property on a genuine promise.

That PR explored a way to do this through a patched Promise.prototype.constructor, but we realized that was not tenable. However it seems like simply taming Promise.resolve might be sufficient. There is an analysis in the comments of that issue, but it hasn't been double-checked.

@mhofman mhofman added enhancement New feature or request endo ses labels Mar 22, 2022
@kriskowal kriskowal added the kriskowal-review-2024-01 Issues that kriskowal wants to bring to the attention of the team for review as of January, 2024 label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
endo enhancement New feature or request kriskowal-review-2024-01 Issues that kriskowal wants to bring to the attention of the team for review as of January, 2024 ses
Projects
None yet
Development

No branches or pull requests

3 participants