Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Don't allow nested module hash
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Nov 15, 2010
1 parent 3411a8c commit 3994064
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/utils/read-json.js
Expand Up @@ -96,6 +96,21 @@ function processObject (opts, cb) { return function (er, json) {
// json.modules.index = json.main
// delete json.main
// }
if (json.modules) {
if (typeof json.modules !== "object") {
var e = new Error("Invalid modules object")
if (cb) return cb(e)
throw e
}
Object.keys(json.modules).forEach(function (mod) {
if (typeof json.modules[mod] !== "string") {
var e = new Error("Invalid module "+mod+", not a string: "
+JSON.stringify(json.modules[mod]))
if (cb) return cb(e)
throw e
}
})
}

if (opts.wscript) {
var scripts = json.scripts = json.scripts || {}
Expand Down

0 comments on commit 3994064

Please sign in to comment.