Skip to content

Bug: innerHTML assignment from user input in editable_controller.js #34

Closed

Description

@philipithomas

Description

In app/javascript/controllers/editable_controller.js:12:

this.contentTarget.innerHTML = this.inputTarget.value;

This sets innerHTML directly from the post title value. If a post title contains HTML, it will be rendered rather than displayed as text.

Recommendation

Use textContent instead of innerHTML:

this.contentTarget.textContent = this.inputTarget.value;

Severity

Medium

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions