Skip to content

πŸ›‘οΈ Sentinel: [MEDIUM] Fix Rich Text HTML injection in QTextEdit widgets - #222

Closed
dieterolson wants to merge 2 commits into
mainfrom
sentinel/fix-qtextedit-html-injection-12939595658233424047
Closed

πŸ›‘οΈ Sentinel: [MEDIUM] Fix Rich Text HTML injection in QTextEdit widgets#222
dieterolson wants to merge 2 commits into
mainfrom
sentinel/fix-qtextedit-html-injection-12939595658233424047

Conversation

@dieterolson

Copy link
Copy Markdown
Contributor

🚨 Severity: MEDIUM
πŸ’‘ Vulnerability: QTextEdit widgets in PyQt6 accept and render rich text (HTML) by default. If untrusted data (like external logs, or user-pasted system prompts containing HTML) is processed, it can lead to HTML injection or UI redressing.
🎯 Impact: Malicious actors could theoretically inject misleading UI elements or hide text (e.g., <module name> being parsed as an invalid HTML tag and hidden from the log) via pasted content or unsanitized output.
πŸ”§ Fix: Explicitly set .setAcceptRichText(False) on all instances of QTextEdit (chat history, setup logs, hub download logs, and system prompt settings) to force plain-text handling.
βœ… Verification: Verified that tests pass via uv run pytest.

Added a learning entry to .jules/sentinel.md documenting this QTextEdit behavior in PyQt.


PR created automatically by Jules for task 12939595658233424047 started by @dieterolson

`QTextEdit` parses HTML by default, which can lead to UI redressing
or HTML injection if untrusted text (like system prompts or logs) is pasted
or appended. This commit explicitly sets `setAcceptRichText(False)` on
all relevant `QTextEdit` instances in `chat_panel.py`, `hub_dialog.py`,
`settings_panel.py`, and `setup_dialog.py`.

Co-authored-by: dieterolson <198168927+dieterolson@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

⚠️ SPEC.md Update Required

Source files were modified in this PR but SPEC.md was not updated.

Per the Specification-Driven Development Policy:

  • Any PR that adds, removes, or changes functionality must update SPEC.md
  • Update the relevant sections (features, architecture, tests, dependencies, etc.)
  • Bump the Spec Version if making substantive changes

To resolve:

  1. Update SPEC.md to reflect your changes, OR
  2. Add the spec-exempt label if this PR genuinely doesn't affect the spec (e.g., pure refactor with no behavior change)

This check is enforced by the spec-check CI workflow.

`QTextEdit` parses HTML by default, which can lead to UI redressing
or HTML injection if untrusted text (like system prompts or logs) is pasted
or appended. This commit explicitly sets `setAcceptRichText(False)` on
all relevant `QTextEdit` instances in `chat_panel.py`, `hub_dialog.py`,
`settings_panel.py`, and `setup_dialog.py`.

It also updates `SPEC.md` to pass the spec-check CI workflow.

Co-authored-by: dieterolson <198168927+dieterolson@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29c6093593

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .jules/sentinel.md

**Vulnerability:** `QTextEdit` accepts rich text (HTML) by default, meaning that any text resembling HTML pasted or programmatically inserted into it can be rendered as rich text. This opens up possibilities for HTML injection or UI redressing via pasted content or unchecked external data.
**Learning:** In PyQt6, `QTextEdit` widgets expose a rich text functionality by default. To enforce plain text input or display (especially when handling user input like a chat box or system prompt), it is critical to explicitly disable the rich text feature.
**Prevention:** Always apply `.setAcceptRichText(False)` to `QTextEdit` instances to prevent HTML injection unless rich text functionality is actively required and the input is sanitized.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use plain-text APIs for programmatic insertions

When a future caller follows this new prevention rule for untrusted output, it can still pass HTML through append() or setHtml(): acceptRichText governs rich-text input from the user, such as paste and drag/drop, rather than programmatic rich-text APIs. The current display helpers happen to use insertPlainText(), but this entry explicitly claims programmatic insertion is covered and can therefore reintroduce the vulnerability it is meant to prevent; require insertPlainText() or setPlainText() for programmatic content and describe setAcceptRichText(False) only as input hardening.

AGENTS.md reference: AGENTS.md:L25-L26

Useful? React with πŸ‘Β / πŸ‘Ž.

@dieterolson

Copy link
Copy Markdown
Contributor Author

Closing in favor of consolidated batch PR #227.

auto-merge was automatically disabled August 11, 2026 05:58

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant