Skip to content

Commit

Permalink
fixing NP validation bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
legrego committed Oct 22, 2019
1 parent 8b7389a commit d6ae8bb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/server/http/http_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ export class HttpServer {
for (const route of router.getRoutes()) {
this.log.debug(`registering route handler for [${route.path}]`);
const { authRequired = true, tags } = route.options;
// Hapi does not allow payload validation to be specified for 'head' or 'get' requests
const validate = ['head', 'get'].includes(route.method) ? undefined : { payload: true };
this.server.route({
handler: route.handler,
method: route.method,
Expand All @@ -140,9 +142,7 @@ export class HttpServer {
// We are telling Hapi that NP routes can accept any payload, so that it can bypass the default
// validation applied in ./http_tools#getServerOptions
// (All NP routes are already required to specify their own validation in order to access the payload)
validate: {
payload: true,
},
validate,
},
});
}
Expand Down

0 comments on commit d6ae8bb

Please sign in to comment.