Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XSS when rendering uiSchema validation error message #4254

Closed
4 tasks done
davidli16 opened this issue Jul 22, 2024 · 1 comment · Fixed by #4256
Closed
4 tasks done

XSS when rendering uiSchema validation error message #4254

davidli16 opened this issue Jul 22, 2024 · 1 comment · Fixed by #4256

Comments

@davidli16
Copy link
Contributor

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

HTML tags inside JSON schema property names are output as HTML when rendered in error messages.

Expected Behavior

HTML tags are disallowed or escaped when rendering JSON property names in error messages.

Steps To Reproduce

  1. Define a JSON schema
{
    "type": "object",
    "properties": {
        "xss<iframe srcdoc={'<script>alert(document.domain)</script>'}>": {
            "type": "string",
            "title": "Comment<a>link</a>"
        }
    },
}
  1. Define a UI schema
{
  "xss": {
    "ui:widget": "textarea"
  },
  "ui:order": [
    "test"
  ]
}
  1. The root schema is included in the error message and rendered as HTML.

Environment

No response

Anything else?

Solution: Pass in disableParsingRawHTML to the <Markdown> component to prevent HTML from being rendered in the error message.

{translateString(TranslatableString.InvalidObjectField, [name || 'root', (err as Error).message])}

Playground

@davidli16 davidli16 added bug needs triage Initial label given, to be assigned correct labels and assigned labels Jul 22, 2024
@davidli16 davidli16 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
@davidli16 davidli16 reopened this Jul 23, 2024
@heath-freenome heath-freenome added help wanted and removed needs triage Initial label given, to be assigned correct labels and assigned labels Jul 26, 2024
@heath-freenome
Copy link
Member

@davidli16 Thanks for the issue and the fix. One small update to the PR and we will merge and close this issue.

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

Successfully merging a pull request may close this issue.

2 participants