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

Relax default HTML allowlist #383

Merged
merged 5 commits into from
Sep 8, 2024
Merged

Relax default HTML allowlist #383

merged 5 commits into from
Sep 8, 2024

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Sep 8, 2024

Resolves #301, #368.

Marp Core now becomes to allow a lot of HTML elements and attributes by default, that are considered as safe. The allowlist covers some mentioned elements and attributes in the feedback thread https://github.com/orgs/marp-team/discussions/501.

href, src, and similar attributes include URL schema checking. By default, non-http and https schemes are always sanitized. If the attribute may allow an image, data:image/* is also allowed.

Elements and attributes that have too much power, such as <script>, <link> element, on***, and style attribute, are still not allowed by default. The developer can enable them through html: true constructor option as before.

Tip

To get back into the previous allowlist compliant with Marp Core v3, set html constructor option as html: { br: [] }. That only allows <br> tag.

@yhatt yhatt merged commit 857035c into main Sep 8, 2024
7 checks passed
@yhatt yhatt deleted the relax-html-allow-list branch September 8, 2024 13:21
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

Successfully merging this pull request may close these issues.

Relax HTML allowlist
1 participant