Skip to content

Commit

Permalink
fix(static): prevent possible XSS by sanitizing output
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed May 3, 2019
1 parent 4247842 commit 97d6387
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"progress": "2.0.1",
"request": "2.87.0",
"request-promise-native": "1.0.7",
"sanitizer": "^0.1.3",
"semver": "^6.0.0",
"shelljs": "0.8.2",
"snyk": "1.159.0",
Expand Down
3 changes: 2 additions & 1 deletion src/openwhisk/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const postcssurl = require('postcss-url');
const parser = require('postcss-value-parser');
const babel = require('@babel/core');
const ohash = require('object-hash');
const sanitizer = require('sanitizer');

const { space } = postcss.list;
const uri = require('uri-js');
Expand Down Expand Up @@ -46,7 +47,7 @@ function error(message, code = 500) {
'X-Static': 'Raw/Static',
'Cache-Control': 'max-age=300',
},
body: `${message}`,
body: sanitizer.escape(message),
};
}

Expand Down

0 comments on commit 97d6387

Please sign in to comment.