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

permission should not be a void element #18

Open
zcorpan opened this issue May 15, 2024 · 5 comments
Open

permission should not be a void element #18

zcorpan opened this issue May 15, 2024 · 5 comments

Comments

@zcorpan
Copy link

zcorpan commented May 15, 2024

Since the PEPC content is controlled by the user agent, and it should have no child elements, the parsing model will not include content or the end tag (similarly to the input element parsing model).

Adding a new void element for HTML parsing can result in new mXSS issues. Consider e.g. https://research.securitum.com/mutation-xss-via-mathml-mutation-dompurify-2-0-17-bypass/ but instead of the form tags you use a <permission> tag before <mglyph>. The onerror script would now execute in browsers where permission is a void element (assuming a sanitizer that allows math).

There might be other similar cases; generally, changes to the HTML parser carry some XSS risk.

I would suggest no changes to the HTML parser here. Require the end tag.

@zcorpan zcorpan changed the title permission should not use be a void element permission should not be a void element May 15, 2024
@marcoscaceres
Copy link
Contributor

Agree. Further, I think it makes sense to have children like button etc.

@remypar5
Copy link

It could support 2 different forms:

  1. A void element, which lets the browser handle everything. This leads to a single, recognizable user flow for any website, enhancing the user's experience regarding handing out permissions. This would mean that UX designers have fewer options customizing it.

  2. A container element which only allows a button[type="permission"] so UX designers can tailor its appearance to their app's UX.

Personally I like the void element better as it enforces a recognizable flow for the user.

@DanielHerr
Copy link

How about adopting the fallback content approach used by <canvas>, <video>, <audio>, <progress>, <meter>?

Something like this:

<permission type="notification">
 <button onclick="Notification.requestPermission()">Notify Me<button>
</permission>

@marcoscaceres
Copy link
Contributor

Yeah, you would absolutely need fallback for legacy user agents and any browser that doesn’t support the element.

@andypaicu
Copy link
Collaborator

That fallback approach seems very appealing to me. And practically this would mean that the permission element is not a void element but rather has hard-coded user-agent-defined contents.

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

No branches or pull requests

5 participants