Skip to content

Commit f83ad7b

Browse files
authoredMar 14, 2022
fix(xss): Fixed XSS security bug (#1929)
* Fixed XSS bug set Content-Type response header as text/plain rather than default text/html * Update index.ts
1 parent b372ec9 commit f83ad7b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎packages/express/src/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ nivo.get('/r/:id', (req, res) => {
3838

3939
const config = storage.get(req.params.id)
4040
if (!config) {
41-
return res.status(404).send(`no chart found for id "${id}"`)
41+
return res
42+
.set('Content-Type', 'text/plain')
43+
.status(404)
44+
.send(`no chart found for id "${id}"`)
4245
}
4346

4447
// @ts-ignore

0 commit comments

Comments
 (0)
Please sign in to comment.