-
Notifications
You must be signed in to change notification settings - Fork 17
feat: include json-ld #653
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
Conversation
fixes #648
This PR will trigger a minor release when merged. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #653 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 45 45
Lines 3558 3585 +27
=========================================
+ Hits 3558 3585 +27 ☔ View full report in Codecov by Sentry. |
@@ -34,6 +35,13 @@ function createElement(name, ...attrs) { | |||
return h(name, properties); | |||
} | |||
|
|||
function sanitizeJsonLd(jsonLd) { | |||
if (jsonLd.toLowerCase().indexOf('</script>') >= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSON.parse()
would throw anyway if string contained tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, it could also be quoted:
<html>
<head>
<script type="application/ld+json">
{ "$foo": "</script><script type='application/javascript'>alert('hello')</script>" }
</script>
</head>
<body>
test
</body>
</html>
It looks like the current implementation only supports a single |
the current implementation uses the last one defined. this could be extended in the future by allowing all |
let's keep it simple for now, we can add support for multiple named ones later. i really don't think that's necessary, especially as all the current mechanisms ( |
🎉 This PR is included in version 6.13.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@rofe Using an array of JSON-LDs is valid |
fixes #648