Skip to content

Web Console decodes HTML entities in results, corrupting displayed and copied values #587

Description

@felmonon

Describe the bug

The web console runs every result cell through unescapeHtml() before rendering, and the copy paths reuse the same text. But the server does not HTML-encode values in /exec JSON responses, so any stored value that legitimately contains an entity sequence (&, <, >, ", ',  ) is silently altered, both in the grid display and in the copied value.

This affects the legacy grid (src/js/console/grid.js), the new ResultGrid (src/components/ResultGrid/inlineGridUtils.ts), and the markdown copy (src/components/ResultGrid/resultPageMarkdown.ts).

Steps to reproduce

On https://demo.questdb.io (QuestDB 9.4.3, console 2.0.0):

SELECT '&' AS literal_entity, 'a=1&b=2' AS url_query, '<tag>' AS escaped_html;

The grid shows &, a=1&b=2 and <tag> instead of the stored values. Copying a cell copies the altered value too.

Image

The server returns the values unmodified, so the decode has nothing to undo:

$ curl 'https://demo.questdb.io/exec?query=SELECT%20%27%26amp%3B%27%20lit'
{"query":"SELECT '&amp;' lit", ..., "dataset":[["&amp;"]],"count":1}

(Same raw output with version=1 and version=2 request params.)

Where it came from

Realistic hits: URL query strings stored after HTML-escaping upstream, HTML fragments in varchar columns, scraped or event payloads.

If some older server versions do escape entities in query responses (which would explain #525), the unescape would need to be gated on that rather than applied unconditionally.

Happy to submit a PR removing the unconditional unescape (grid.js, inlineGridUtils, resultPageMarkdown, plus their tests) if you can confirm the intended behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions