Skip to content

Commit 259e6b6

Browse files
authored
Fix prototype pollution in use() middleware via for-in on args array (#321)
1 parent ac7e2fa commit 259e6b6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -467,12 +467,12 @@ class API {
467467
let middleware = [];
468468

469469
// Add func args as middleware
470-
for (let arg in args) {
471-
if (typeof args[arg] === 'function') {
472-
if (args[arg].length === 3) {
473-
middleware.push(args[arg]);
474-
} else if (args[arg].length === 4) {
475-
this._errors.push(args[arg]);
470+
for (let arg of args) {
471+
if (typeof arg === 'function') {
472+
if (arg.length === 3) {
473+
middleware.push(arg);
474+
} else if (arg.length === 4) {
475+
this._errors.push(arg);
476476
} else {
477477
throw new ConfigurationError(
478478
'Middleware must have 3 or 4 parameters'

0 commit comments

Comments
 (0)