Paths including reserved keywords error
Closed this issue · 2 comments
n1889 commented
Example paths that fail:
- http://localhost:5678/constructor
- http://localhost:5678/__proto__
- http://localhost:5678/hasOwnProperty
- http://localhost:5678/toString
Error output:
TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at Object.exports.join (path.js:358:36)
at testPath (/Users/n/lingon-example/node_modules/lingon/lib/server.js:35:14)
at rewriteRequestPath (/Users/n/lingon-example/node_modules/lingon/lib/server.js:48:40)
at requestHandler (/Users/n/lingon-example/node_modules/lingon/lib/server.js:105:19)
at Layer.handle [as handle_request] (/Users/n/lingon-example/node_modules/lingon/node_modules/express/lib/router/layer.js:82:5)
at trim_prefix (/Users/n/lingon-example/node_modules/lingon/node_modules/express/lib/router/index.js:269:13)
at /Users/n/lingon-example/node_modules/lingon/node_modules/express/lib/router/index.js:236:9
at Function.proto.process_params (/Users/n/lingon-example/node_modules/lingon/node_modules/express/lib/router/index.js:311:12)
jpettersson commented
@n1889 Looking into this now, thanks for reporting.
jpettersson commented
Turns out we use the path as an object key in a cache, which of course goes haywire when using a reserved keyword. I fixed this in Lingon and then encountered the same problem in a file tree traversal library we use (hike). After reading through code in hike I found that it would make sense to replace it with a smaller implementation. I'll be addressing this over the coming few days.