Warn moderators when HTML RichText contains JavaScript or active HTML

Open
#2,083 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@bamnet-bot is already working on this.

Since Nov 24, 2026.

  • #2095 by @bamnet-bot — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
html, javascript, rails, ruby

Research direction

Start with sanitize(...) in app/views/rich_texts/_rich_text.html.erb and _grid.html.erb, then read RichText#as_json and ConcertoRichText.vue to confirm what the player intentionally leaves active. Run the existing RichText model/view tests before adding detection for executable or stripped HTML and the warning banner with collapsible raw source. Done means previews and moderation cards warn consistently and tests cover detection and display. A linked pull request (#2095) is already open, so coordinate before starting.

Written by the indexing model from the issue text.

Description

agent-driven security

Context

Related to #1759 and #2039.

Allowing HTML RichText content to render unsanitized on the frontend player (ConcertoRichText.vue) is Working As Intended so trusted signage deployments can use rich/dynamic HTML and JavaScript. However, admin and moderation previews (app/views/rich_texts/_rich_text.html.erb and _grid.html.erb) sanitize HTML via Rails sanitize(...) to protect authenticated administrators.

Because admin previews strip <script>, inline on* event handlers, javascript: URIs, <iframe>, <object>, <embed>, <svg>, <style>, etc., moderators cannot see active HTML/JS when reviewing submissions before approving them for display on screens.

Proposed Fix

  • Keep frontend player HTML rendering intact (do not strip JS from ConcertoRichText.vue or RichText#as_json).
  • Detect potentially executable or sanitized-away HTML in HTML RichText content (e.g., <script>, on* attributes, javascript: URIs, <iframe>, <object>, <embed>, <svg>, <style>, or differences between raw and sanitized HTML).
  • Display a clear warning banner on RichText previews and moderation cards whenever active/stripped HTML is detected, along with a safe collapsible raw HTML source viewer (<details>) so moderators can inspect what will run on screens.
  • Add model/helper/view/controller tests covering detection and warning display.
Dominant language
Ruby
Stars
485
Forks
178
Avg merge
1d 14h
Merged PRs (30d)
29

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from concerto/concerto

All issues in concerto/concerto

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.