Shimming hapi.decorate missing 4th argument.
twiggy opened this issue · 2 comments
twiggy commented
In probes/hapi.js line ~230 there is
shimmer.wrap(plugin, 'decorate', function (fn) {
return function (name, method, handler) {
if (name === 'server' && method === 'views') {
handler = wrapViews(handler);
}
return fn.call(this, name, method, handler);
};
});
It should be ( not sure if options is the best name or not )
shimmer.wrap(plugin, 'decorate', function (fn) {
return function (name, method, handler, options) {
if (name === 'server' && method === 'views') {
handler = wrapViews(handler);
}
return fn.call(this, name, method, handler, options);
};
});
We had a plugin ( Yar sessions ) that uses a 'request' scope decorate and passes in {apply:true}
server.decorate('request', 'yar', getState, {
apply: true
});
without apply : true the function basically only gets called once by hapi meaning that stops being a per request plugin and can share info. In this case it basically caused our sessions to be shared between requests which obviously broke some security stuff.
bmacnaughton commented
v5.4.2 addresses this. Thanks!
twiggy commented
can confirm 5.4.2 fixes.