Search query gets rendered as HTML #1515

Closed
opened 2025-11-02 04:03:35 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @jonasfranz on GitHub (Feb 10, 2018).

  • Gitea version (or commit ref): 1.4.0+rc1
  • Operating system: Ubuntu Server 16.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No, because repo indexer is disabled
    • Not relevant

Description

When I enter a HTML tag into the repository search, the query gets rendered as HTML. But it is sort of escaped because only h1, b, i etc. are rendered but without parameters like onload.

Screenshots

Search-Query: <i>

screenshot-2018-2-10 frontend 1

Search-Query: <h1>

screenshot-2018-2-10 frontend

Search-Query: <b>Hello</b><h1>World</h1>

screenshot-2018-2-10 frontend 2

Originally created by @jonasfranz on GitHub (Feb 10, 2018). - Gitea version (or commit ref): 1.4.0+rc1 - Operating system: Ubuntu Server 16.04 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No, because repo indexer is disabled - [ ] Not relevant ## Description When I enter a HTML tag into the repository search, the query gets rendered as HTML. But it is sort of escaped because only h1, b, i etc. are rendered but without parameters like onload. ## Screenshots Search-Query: `<i>` ![screenshot-2018-2-10 frontend 1](https://user-images.githubusercontent.com/5757182/36063557-cd78eaa8-0e7e-11e8-880a-4c023ee8e277.png) Search-Query: `<h1>` ![screenshot-2018-2-10 frontend](https://user-images.githubusercontent.com/5757182/36063558-d06a7ff6-0e7e-11e8-9865-72a3650176af.png) Search-Query: `<b>Hello</b><h1>World</h1>` ![screenshot-2018-2-10 frontend 2](https://user-images.githubusercontent.com/5757182/36063586-1b794572-0e7f-11e8-924d-63e162bf7d59.png)
GiteaMirror added the topic/security label 2025-11-02 04:03:35 -06:00
Author
Owner

@jonasfranz commented on GitHub (Feb 10, 2018):

This might be also security relevant because attackers could send links containing a message for example to send credentials to the attacker.

@jonasfranz commented on GitHub (Feb 10, 2018): This might be also security relevant because attackers could send links containing a message for example to send credentials to the attacker.
Author
Owner

@ethantkoenig commented on GitHub (Feb 12, 2018):

FYI, while this is certainly a bug (good catch @JonasFranzDEV), I don't believe XSS is a concern because the search query was previously piped through Str2Html (which sanitizes unsafe HTML)

@ethantkoenig commented on GitHub (Feb 12, 2018): FYI, while this is certainly a bug (good catch @JonasFranzDEV), I don't believe XSS is a concern because the search query was previously piped through `Str2Html` (which sanitizes unsafe HTML)
Author
Owner

@jonasfranz commented on GitHub (Feb 12, 2018):

@ethantkoenig You're right. It is not a real XSS but it could be used to show the user a big text for example saying to send there password to an email.

@jonasfranz commented on GitHub (Feb 12, 2018): @ethantkoenig You're right. It is not a real XSS but it could be used to show the user a big text for example saying to send there password to an email.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1515