create-in-v0.76.0-webhook-source.td 950 B

123456789101112131415161718192021222324252627
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. $ skip-if
  10. SELECT mz_version_num() < 7600;
  11. > CREATE CLUSTER webhook_cluster REPLICAS (r1 (SIZE '1'));
  12. > CREATE SOURCE my_webhook_source IN CLUSTER webhook_cluster FROM WEBHOOK
  13. BODY FORMAT TEXT
  14. INCLUDE HEADERS
  15. CHECK (
  16. WITH(HEADERS, BODY, SECRET secret1)
  17. decode(headers->'x-signature', 'base64') = hmac(body, secret1, 'sha256')
  18. )
  19. $ webhook-append name=my_webhook_source x-signature=VNCe6bTKrlFO46GfiUYR/xFpeZ2H/KbLfR9oJKYAwkc=
  20. using an mz secret
  21. $ webhook-append name=my_webhook_source x-signature=invalid_signature status=400
  22. this should not get appended