Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion integrity.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ function getSums (data) {
function getFile (url) {
// the "easy way"; returns file buffer
const filename = url.substring(url.lastIndexOf('/')+1)
cp.execSync(`curl -Lso /tmp/${filename} ${url}`)
// use execFileSync (no shell) with an argument array so the url/filename
// cannot be interpreted as shell metacharacters, preventing command injection
cp.execFileSync('curl', ['-Lso', `/tmp/${filename}`, url])
const contents = fs.readFileSync(`/tmp/${filename}`)
fs.unlinkSync(`/tmp/${filename}`) // delete tmp file
return contents
Expand Down