Skip to content

WIP: Allow all characters in title attribute when rendering #10371

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

Closed
wants to merge 2 commits into from

Conversation

mrsdizzie
Copy link
Member

According to the common mark spec:

https://spec.commonmark.org/0.29/#link-title

You should be able to stick abut anything in there. Right now we're
limited by the default setting of bluemonday which restricts what can go
in a title tag and makes our rendering not compliant with the spec.

This should fix #10326

Marking WIP to discuss here. According to the commonmark spec just about anything should be allowed in a title attribute. Goldmark will escape things properly when generating links as in the example issue but of course you can just stick raw HTML in as well, try to abuse other links, etc...

Not able to cause problems in limited testing but others should try! FWIW Github seems to let you stick almost anything in there as well (also shown in the example).

According to the common mark spec:

 https://spec.commonmark.org/0.29/#link-title

You should be able to stick abut anything in there. Right now we're
limited by the default setting of bluemonday which restricts what can go
in a title tag and makes our rendering not compliant with the spec.

This should fix go-gitea#10326
@mrsdizzie
Copy link
Member Author

Could also perhaps only be for render-content class ? Would that cover all cases where we render something?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 19, 2020
@guillep2k guillep2k added the type/enhancement An improvement of existing functionality label Feb 20, 2020
Copy link
Member

@guillep2k guillep2k left a comment

Choose a reason for hiding this comment

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

I can't think of any downside.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 20, 2020
@guillep2k
Copy link
Member

Could also perhaps only be for render-content class ? Would that cover all cases where we render something?

e-mails? HTML parsers of certain Outloo***ehem mail user agents is buggy to say the least.

Copy link
Member

@jolheiser jolheiser left a comment

Choose a reason for hiding this comment

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

From my testing this seemed to work fine as well.

My only other concern is having to remember this if we ever use a jQuery/CSS selector based on a title.
Though I don't know of a reason we would.

Would like someone with more experience in security to look at this before approval.

goldmark seems to do a good job of escaping bad strings, though. I wasn't able to escape a markdown link or explicit anchor HTML via the title attribute.

@mrsdizzie
Copy link
Member Author

This is fixed by #10527

@mrsdizzie mrsdizzie closed this Feb 28, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Markdown
4 participants