-
Notifications
You must be signed in to change notification settings - Fork 232
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
json Handlebars helper allows unsafe HTML #84
Conversation
Hi @bradvogel, thanks for merging #85! Was wondering if you saw this one—I converted it from an issue so you may have missed it. |
9b13b00
to
1122103
Compare
1122103
to
8a390a7
Compare
8a390a7
to
5f5ab84
Compare
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.
PR looks great! Just a few tiny styling comments.
return content ? content.join('\n') : null; | ||
const blocks = this._blocks; | ||
const content = blocks && blocks[name]; | ||
return content ? content.join("\n") : null; |
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.
nit: Let's keep these as (single quotes).
@@ -1,15 +1,25 @@ | |||
const _ = require('lodash'); | |||
const Handlerbars = require('handlebars'); | |||
const _ = require("lodash"); |
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.
nit: Here and below, let's use single quotes.
@ttacon comments addressed! |
published as 2.4.2 |
I noticed this vulnerability when I added a job to Bull that had job data that included some HTML. Since the
json
Handlebars helper assumes that its input is safe, any HTML that is rendered onto the job details page will be considered valid, including<script>
tags.You can repro this by creating a job in Bull (and maybe in Bee?) with data along the lines of
and then opening up the
queueJobsByState
page that includes the job with unsafe HTML. You'll see an alert.bug is in this helper function:
arena/src/server/views/helpers/handlebars.js
Line 5 in be866d3
I've attached a fix in which all string values are escaped when the object is stringified.