nlf / blankie

a hapi CSP plugin
52 stars 20 forks source link

blankie throws on OPTIONS requests #25

Closed klaemo closed 7 years ago

klaemo commented 7 years ago

Hey there,

the latest version of blankie seems to throw on OPTIONS requests:

0|app      | 171016/144200.819, [error] message: Uncaught error: Cannot read property 'nonces' of undefined, stack: TypeError: Uncaught error: Cannot read property 'nonces' of undefined
0|app      |     at internals.directiveNames.forEach (/usr/src/app/node_modules/blankie/lib/index.js:189:50)
0|app      |     at Array.forEach (<anonymous>)
0|app      |     at Object.internals.generatePolicy (/usr/src/app/node_modules/blankie/lib/index.js:169:30)
0|app      |     at internals.addHeaders (/usr/src/app/node_modules/blankie/lib/index.js:278:32)
0|app      |     at each (/usr/src/app/node_modules/hapi/lib/request.js:453:22)
0|app      |     at iterate (/usr/src/app/node_modules/items/lib/index.js:36:13)
0|app      |     at done (/usr/src/app/node_modules/items/lib/index.js:28:25)
0|app      |     at finalize (/usr/src/app/node_modules/hapi/lib/request.js:446:24)
0|app      |     at Function.wrapped [as _next] (/usr/src/app/node_modules/hapi/node_modules/hoek/lib/index.js:875:20)
0|app      |     at Function.internals.continue (/usr/src/app/node_modules/hapi/lib/reply.js:139:10)
0|app      |     at bound (domain.js:303:14)
0|app      |     at Function.runBound [as continue] (domain.js:314:12)
0|app      |     at /usr/src/app/dist/webapp/index.js:129:26
0|app      |     at each (/usr/src/app/node_modules/hapi/lib/request.js:453:22)
0|app      |     at iterate (/usr/src/app/node_modules/items/lib/index.js:36:13)
0|app      |     at Object.exports.serial (/usr/src/app/node_modules/items/lib/index.js:39:9)
0|app      | Debug: internal, implementation, error
0|app      |     TypeError: Uncaught error: Cannot read property 'nonces' of undefined
0|app      |     at internals.directiveNames.forEach (/usr/src/app/node_modules/blankie/lib/index.js:189:50)
0|app      |     at Array.forEach (<anonymous>)
0|app      |     at Object.internals.generatePolicy (/usr/src/app/node_modules/blankie/lib/index.js:169:30)
0|app      |     at internals.addHeaders (/usr/src/app/node_modules/blankie/lib/index.js:278:32)
0|app      |     at each (/usr/src/app/node_modules/hapi/lib/request.js:453:22)
0|app      |     at iterate (/usr/src/app/node_modules/items/lib/index.js:36:13)
0|app      |     at done (/usr/src/app/node_modules/items/lib/index.js:28:25)
0|app      |     at finalize (/usr/src/app/node_modules/hapi/lib/request.js:446:24)
0|app      |     at Function.wrapped [as _next] (/usr/src/app/node_modules/hapi/node_modules/hoek/lib/index.js:875:20)
0|app      |     at Function.internals.continue (/usr/src/app/node_modules/hapi/lib/reply.js:139:10)
0|app      |     at bound (domain.js:303:14)
0|app      |     at Function.runBound [as continue] (domain.js:314:12)
0|app      |     at /usr/src/app/dist/webapp/index.js:129:26
0|app      |     at each (/usr/src/app/node_modules/hapi/lib/request.js:453:22)
0|app      |     at iterate (/usr/src/app/node_modules/items/lib/index.js:36:13)
0|app      |     at Object.exports.serial (/usr/src/app/node_modules/items/lib/index.js:39:9)
"blankie": "3.0.0"
"hapi": "16.6.2"
"scooter": "4.0.0"

Thank you!

nlf commented 7 years ago

fixed in 3.0.1, thanks for the report!

klaemo commented 7 years ago

Thank you for the quick fix!