1.9.2 • Published 4 years ago
graphql-playground-middleware-hapi-patched v1.9.2
graphql-playground-middleware-hapi
Koa middleware to expose an endpoint for the GraphQL Playground IDE SECURITY NOTE: All versions of
graphql-playground-middleware-hapiuntil1.6.13or later have a security vulnerability when unsanitized user input is used while invokinghapiPlayground(). Read more below
Installation
Using yarn:
yarn add graphql-playground-middleware-hapiOr npm:
npm install graphql-playground-middleware-hapi --saveUsage
See full example in examples/basic.
minimal example:
const hapiPlayground = require('graphql-playground-middleware-hapi').default
const playground = {
plugin: hapiPlayground,
options: {
path: '/playground',
endpoint: '/graphql',
},
}
const app = new Hapi.server({
port: 3000,
})
app.register(playground)
;(async () => await app.start())()Security Notes
All versions before 1.6.13 were vulnerable to user-defined input to hapiPlayground(). Read more in the security notes
Security Upgrade Steps
To fix the issue, you can upgrade to 1.6.13 or later. If you aren't able to upgrade, see the security notes for a workaround.
yarn:
yarn add graphql-playground-middleware-hapi@^1.6.13
npm:
npm install --save graphql-playground-middleware-hapi@^1.6.13