~bigbes/core-go

ref: 468752564125e79b5efdfff091d8886dc23e373a core-go/webhooks d---------
46875256 — Drew DeVault 4 years ago
webhooks/legacy: fetch subscriptions upfront

This fixes a race condition when delivering webhooks for resource
deletion events, in which the subscriptions would be removed from the
delete cascade before the task to fetch them executes. This requires the
downstream code to call Queue before committing the delete transaction,
and updates the API to include a context argument for the connection
pool.
f44afb10 — Simon Ser 4 years ago
go fmt
48250772 — Simon Ser 4 years ago
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).
cdb177bb — Drew DeVault 4 years ago
(*WebhookQueue).deliverPayload: address error nit

This return does not need to be here.
99671f85 — Drew DeVault 4 years ago
webhooks: add comment clarifying field usage
07f694d2 — Drew DeVault 4 years ago
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.
5f76a1f4 — Drew DeVault 4 years ago
Enforce complexity limit on webhook payload
1371ba4b — Drew DeVault 4 years ago
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.
86e1e934 — Drew DeVault 5 years ago
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.
6c80f878 — Drew DeVault 5 years ago
webhooks: correct error case log format
3eaac6aa — Drew DeVault 5 years ago
webhooks: test error from delivery attempt
3a272385 — Drew DeVault 5 years ago
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.
f500157c — Drew DeVault 5 years ago
webhooks: refactor exec code into separate func
8bd6005b — Drew DeVault 5 years ago
webhooks: initial prototype for GQL-native webhooks
33562018 — Drew DeVault 5 years ago
database.WithTx: rollback if func returns error

Previously, this only rolled back if the called function panicked. This
updates it to also roll back if the called function returns an error.
910a8619 — Drew DeVault 5 years ago
webhooks/legacy_test: verify headers are recorded
b98647b6 — Drew DeVault 5 years ago
Deduplicate webhook headers on subsequent attempts

This also updates the database with the final payload headers, including
the signature and nonce, which are generated afresh for each attempt.
70c7fe3b — Drew DeVault 5 years ago
webhooks/legacy: increase specificity of logging
d6bd006e — Drew DeVault 5 years ago
workers/legacy: correct Println with fmt directive
b7e39188 — Drew DeVault 5 years ago
Make worker logs less loud
Next