Fix json struct tag
Found via `go vet`:
auth/middleware.go:259:2: struct field tag `json:"oauth_client_id",omit-empty` not compatible with reflect.StructTag.Get: key:"value" pairs not separated by spaces
Remove %e formatting verbs
%e is not valid for formatting error values:
> %e scientific notation, e.g. -1.234456e+78
Instead, use %w when using fmt.Errorf (for error wrapping) and
%v when using log.Printf (%w is not valid in that context).
auth: improve error response format
This maps more closely onto what normal GQL errors look like.
auth: force webhooks to read-only
auth: harden grants structure
This replaces the Access map with a data type whose default value does
not grant any permissions, so that it's more difficult to create an
insecure auth context by mistake.
(*WebhookQueue).deliverPayload: address error nit
This return does not need to be here.
webhooks: add comment clarifying field usage
webhooks: expand auth configuration
The purpose of this change is to enable internal webhooks to be
configured in GQL webhook tables. A webhook subscription now includes
the auth method field which is appropriate, which is limited to either
OAUTH2 or INTERNAL. In the former case, the previous set of fields will
be valid, and in the latter case, the NodeID field will be valid. This
will allow us to register webhook subscriptions for internal use.
server: add @private directive glue code
auth: fix /query/api-meta.json route
This route does not need authentication.
Enforce complexity limit on webhook payload
Configure server to manage mail queue
This also sets up the recovery function for webhooks, so we get emailed
when we panic during a webhook query.
valid: accept format strings
valid: new module for input validation
webhooks: panic on nested webhook auth case
This is not strictly speaking necessary since we have a panic which
immediately follows the switch, but it is cleaner.
webhooks: correct error case log format
webhooks: test error from delivery attempt
webhooks: add query validation function
The new function tests a query against a GraphQL schema and returns any
validation errors if they are found. This is useful for determining if a
GraphQL query will pass validation when creating a new webhook.