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

escaping issue in rocket.rs search #969

Closed
raminfp opened this issue Apr 11, 2019 · 2 comments
Closed

escaping issue in rocket.rs search #969

raminfp opened this issue Apr 11, 2019 · 2 comments
Assignees
Labels

Comments

@raminfp
Copy link

@raminfp raminfp commented Apr 11, 2019

Hi,

Bug

1 - view-source:https://rocket.rs/v0.4/guide/

2 - <input id="search-input" placeholder="Search guide...">

3 -

on_search_results("../js/search-index.json", "search-input", function(docs) {
   hitsDiv.innerHTML = "";
   toggleResultsIfNecessary();
   var query = searchBar.value;
    
   if (docs.length == 0) {
   noResults = `<b>We didn't find any results for <em>${query}</em>.</b>`;
   searchStatus.innerHTML = noResults; ## vulnerability code
  return;
   }

Fix

searchStatus.innerText = noResults;

@jebrosen

This comment has been minimized.

Copy link
Collaborator

@jebrosen jebrosen commented Apr 11, 2019

Note that switching to innerText isn't a complete fix because of the HTML tags in noResults.

Assigning @SergioBenitez because I don't have write access.

@jebrosen jebrosen added bug docs labels Apr 11, 2019
@SergioBenitez

This comment has been minimized.

Copy link
Owner

@SergioBenitez SergioBenitez commented May 7, 2019

This has been fixed!

Note: This isn't a XSS bug because it is not possible to inject the search text remotely.

@SergioBenitez SergioBenitez changed the title XSS in rocket.rs search escaping issue in rocket.rs search May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.