Skip to content

Less-than (<) and greater-than (>) symbols do not work using basic search for issues

Summary

Less-than (<) and greater-than (>) symbols do not work using basic search for issues.

This is expected behaviour with Advanced Search but not expected with basic search (or is undocumented behaviour).

Steps to reproduce

  1. Create a project with an issue using < or > in the title. Example: Exclude <version> from hash
  2. Search issues using the term Exclude <version>

Example Project

What is the current bug behavior?

< and > fail to return results in issues with basic search.

What is the expected correct behavior?

Relevant logs and/or screenshots

Strangely, code search works fine:

# curl --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" "https://gitlab.com/api/v4/projects/51258804/search?scope=blobs&search=h1"
[{"basename":"test","data":"\u003chtml\u003e\n    \u003cbody\u003e\n        \u003ch1\u003eTEST\u003c/h1\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n","path":"test.html","filename":"test.html","id":null,"ref":"main","startline":1,"project_id":51258804}]
# curl --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" "https://gitlab.com/api/v4/projects/51258804/search?scope=blobs&search=<h1>"
[{"basename":"test","data":"\u003chtml\u003e\n    \u003cbody\u003e\n        \u003ch1\u003eTEST\u003c/h1\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n","path":"test.html","filename":"test.html","id":null,"ref":"main","startline":1,"project_id":51258804}]
# curl --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" "https://gitlab.com/api/v4/projects/51258804/search?scope=blobs&search=%3Ch1>"
[{"basename":"test","data":"\u003chtml\u003e\n    \u003cbody\u003e\n        \u003ch1\u003eTEST\u003c/h1\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n","path":"test.html","filename":"test.html","id":null,"ref":"main","startline":1,"project_id":51258804}]
# curl --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" "https://gitlab.com/api/v4/projects/51258804/search?scope=blobs&search=%3Ch1%3E"
[{"basename":"test","data":"\u003chtml\u003e\n    \u003cbody\u003e\n        \u003ch1\u003eTEST\u003c/h1\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n","path":"test.html","filename":"test.html","id":null,"ref":"main","startline":1,"project_id":51258804}]

Searching issues on a self-managed instance results in the following:

Screenshot_2023-10-17_at_16.47.29 Screenshot_2023-10-17_at_16.47.20
Screenshot_2023-10-17_at_16.47.06 Screenshot_2023-10-17_at_16.46.56

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Michael Trainor