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

Whitelist the allowed CSS classes #120

Closed
wants to merge 2 commits into from

Conversation

dstufft
Copy link
Member

@dstufft dstufft commented Sep 18, 2018

This should prevent people from being able to apply classes to their rendered text that we did not otherwise want to allow them to do. For instance they won't be able to apply the same CSS class to their image that our logo uses, which would theoretically let them replace our logo.

@dstufft dstufft requested review from theacodes and di September 18, 2018 13:08
@@ -54,21 +56,75 @@
"width", "height",
]

ALLOWED_CLASSES = {
"img": ["align-left", "align-center", "align-right"],
"span": [c for c in pygments.token.STANDARD_TYPES.values() if c],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  • I'm not sure if there is any use of a class inside of a span that isn't there to enable pygments, or if the list of pygments classes is all we need to worry about here.
  • @theacodes has set the <code> element to allow classes in the PR that added syntax highlighting, but I can't determine what classes are valid for the <code> element. Trying different combinations of things doesn't seem to actually generate code that emits a class on the <code> element. If we can't figure out how to make a README emit a <code> element with css classes, we should probably emit class from <code>.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you trying just with RST? I think I added it for Markdown, not sure though.

Base automatically changed from master to main January 21, 2021 18:41
@dstufft dstufft closed this Jun 30, 2023
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.

2 participants