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

execCommand spec won't work #500

Closed
lukewarlow opened this issue Apr 8, 2024 · 7 comments
Closed

execCommand spec won't work #500

lukewarlow opened this issue Apr 8, 2024 · 7 comments
Labels
Milestone

Comments

@lukewarlow
Copy link
Member

Currently execCommand is specced to just pass the union type value through to createContextualFragment algorithm, but TT enforcement doesn't happen in the algorithm it happens in the IDL. So this won't enforce TT and also won't convert the Trusted type object to a string.

@lukewarlow lukewarlow added the spec label Apr 8, 2024
@lukewarlow lukewarlow added this to the v1 milestone Apr 8, 2024
@lukewarlow
Copy link
Member Author

Solution is to do the enforcement before passing the value through to that algorithm.

But pending discussions regarding the [StringContext] IDL attribute, this issue might resolve itself, as createContextualFragment will take a union itself and then do the TT enforcement in the algorithm.

@annevk
Copy link
Member

annevk commented Apr 9, 2024

How does this work in Chromium today? Does execCommand() call createContextualFragment() at a time where it might not expect userland to be able to execute code? Does not sound like a great setup.

@lukewarlow
Copy link
Member Author

Chrome like WebKit doesn't actually implement this as specced from what I can see. It does the TT check inside execCommand and then goes through an editor_command file, which doesn't appear to call createContextualFragment anywhere.

@annevk
Copy link
Member

annevk commented Apr 9, 2024

It might be better to specify the TT check inside execCommand() then.

https://w3c.github.io/editing/docs/execCommand/ is a bit dramatic about its status. It definitely needs to continue to be maintained.

cc @zcorpan

@zcorpan
Copy link
Member

zcorpan commented Apr 9, 2024

Yes, I've taken on editing of the execCommand spec but haven't gotten to working on it yet.

@lukewarlow
Copy link
Member Author

Okay I've updated w3c/editing#460 to do the enforcement in the editing spec. It will result in the spec doing a double check because createContextualFragment will do one too but the editing spec probably shouldn't call that method anyway, and if it does then we can change the (soon to be upstreamed to HTML) algorithm to take a should do TT check boolean.

@annevk
Copy link
Member

annevk commented Apr 22, 2024

It shouldn't call that method directly, ever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants