fix: block introspection queries in production mode

This commit is contained in:
Vikram Rangnekar
2020-04-20 02:06:58 -04:00
parent 966aa9ce8c
commit 0a02bde219
2 changed files with 23 additions and 12 deletions

View File

@ -74,9 +74,14 @@ func apiV1(w http.ResponseWriter, r *http.Request) {
return
}
doLog := true
res, err := sg.GraphQL(ct, req.Query, req.Vars)
if logLevel >= LogLevelDebug {
if !conf.Production && res.QueryName() == "IntrospectionQuery" {
doLog = false
}
if doLog && logLevel >= LogLevelDebug {
log.Printf("DBG query %s: %s", res.QueryName(), res.SQL())
}
@ -87,7 +92,7 @@ func apiV1(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(res)
if logLevel >= LogLevelInfo {
if doLog && logLevel >= LogLevelInfo {
zlog.Info("success",
zap.String("op", res.Operation()),
zap.String("name", res.QueryName()),