Skip to content

XSS/missing sanitization on the build error screen's source viewΒ #3288

Open

Description

@nyanpasu64

Bug Report

Environment

Zola version: 0.23.6

Expected Behavior

When a build error occurs and source code is shown on-screen, it's properly escaped and visible as plaintext.

Current Behavior

HTML tags are injected into output as-is, resulting in formatting errors up through JS execution.

Image

I don't think there's a security boundary being crossed here (considering you can inject arbitrary HTML into successful Zola output), but it makes the "Zola Build Error" screen harder to read when you have stray hypertext (eg. <br>, images, the like) rendering in a source code viewer.

Step to reproduce

  • Run zola serve
  • Edit a page with an invalid Tera invocation containing HTML tags, eg.
{{ <img src=error onerror=alert(1)> }}
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions