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

OSM username isn't escaped properly #8813

Closed
gravitystorm opened this issue Nov 17, 2021 · 2 comments · Fixed by #8817
Closed

OSM username isn't escaped properly #8813

gravitystorm opened this issue Nov 17, 2021 · 2 comments · Fixed by #8817
Assignees
Labels
bug-release-blocker An important bug - let's get this fixed in the next release!
Milestone

Comments

@gravitystorm
Copy link

URL

No response

How to reproduce the issue?

  1. Set your OSM username to something containing an HTML tag, like Test <hr> McTesty
  2. Make some changes in iD and press upload
  3. Notice that the username has been put directly into the html, instead of being escaped.

I realise this won't come up in many circumstances, but the unusual name on my development machine is a side-effect of some XSS testing for website that I was doing a few months ago. Although unlikely to be exploitable (since the username within iD is only shown to the user, not to anyone else, and due to limitations on the characters permitted in the OSM username) it's probably worth addressing anyway, and might indicate other places where "user supplied" information from the API isn't being escaped.

Screenshot(s) or anything else?

bitmap

Note how the username in the rails port (circled green, top right) is properly escaped, but within iD it is not escaped (circled red, bottom left)

Which iD Editor versions do you see the issue on?

Released version at openstreetmap.org/edit

Which browsers are you seeing this problem on?

Firefox

@1ec5 1ec5 added the bug A bug - let's fix this! label Nov 17, 2021
@1ec5
Copy link
Collaborator

1ec5 commented Nov 18, 2021

This regression was introduced in 32f8274 for #7998. That PR effectively removed much of the string sanitization from the codebase, including for this part of the UI. Some of the sanitization may have been unnecessary, but it’s hard to say with such a large change. Unfortunately, there are also some places where the fix will be less straightforward, like in detectConflicts.formatUser.

@tyrasd tyrasd added bug-release-blocker An important bug - let's get this fixed in the next release! and removed bug A bug - let's fix this! labels Nov 18, 2021
@tyrasd tyrasd assigned tyrasd and 1ec5 and unassigned 1ec5 Nov 18, 2021
@tyrasd tyrasd added this to the 2.21.0 milestone Nov 18, 2021
jleedev added a commit to jleedev/iD that referenced this issue May 6, 2022
Only affects currently logged in user who has put HTML in their display name.

openstreetmap#8813
tyrasd pushed a commit that referenced this issue May 25, 2022
Only affects currently logged in user who has put HTML in their display name.

#8813
@jleedev
Copy link
Contributor

jleedev commented Sep 19, 2023

This regressed in 43fe6e9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-release-blocker An important bug - let's get this fixed in the next release!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants