The vulnerability is a stored Cross-Site Scripting (XSS) issue in the @diplodoc/search-extension package. The root cause lies in the highlighte function within src/worker/format.ts. This function is responsible for wrapping search result text in HTML <span> tags for highlighting. The vulnerability existed because the input text, which could be a user-controlled markdown file title, was not sanitized before being embedded in the HTML output. An attacker could create a markdown file with a malicious title containing a script. When a user's search query matches this file, the format function is called, which in turn calls highlighte. The highlighte function would then generate HTML containing the malicious script, which would be executed in the user's browser. The patch addresses this by introducing a new escapeHTML function and modifying highlighte to use it, ensuring that any special HTML characters in the input are properly escaped before being rendered.