Skip to content

JSON-LD stringification is non-standard #30

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

Closed
Eyas opened this issue Mar 23, 2022 · 3 comments
Closed

JSON-LD stringification is non-standard #30

Eyas opened this issue Mar 23, 2022 · 3 comments
Labels
good first issue Good for newcomers

Comments

@Eyas
Copy link

Eyas commented Mar 23, 2022

Describe the bug

Same as google/react-schemaorg#9

JSON-LD stringification doesn't properly escape </script>, etc.

To Reproduce

  1. Set JSON-LD to
{ name: "</script><script>alert('xss')</script>" }

(which is valid)

Expected behavior
Characters are escaped according to spec.

Additional context

The spec: https://www.w3.org/TR/json-ld11/#restrictions-for-contents-of-json-ld-script-elements

See the parent issue in w3c/json-ld-syntax#100 where this was created.

Example fix: google/react-schemaorg@22e7dec

@artiebits
Copy link
Owner

Hi @Eyas thank you very much for reporting the issue! I will fix it asap

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@artiebits
Copy link
Owner

i will close this issue for now because it doesn't even compile if I add script tag inside of that string

[!] (plugin svelte) ParseError: Unterminated string constant
dev/components/App.svelte
53:     "@type": "NewsArticle",
54:     headline: "ldJson Article Headline",
55:     name: "<script>alert('xss')</script>",
              ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants