Webhook post fails due to empty secretKey (#5203)

This commit is contained in:
Sriharsha Chintalapani 2022-05-27 18:23:52 -07:00 committed by GitHub
parent f8751f3bb0
commit 994a83bb95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,7 +210,7 @@ public class WebhookRepository extends EntityRepository<Webhook> {
try {
String json = JsonUtils.pojoToJson(list);
Response response;
if (webhook.getSecretKey() != null) {
if (webhook.getSecretKey() != null && !webhook.getSecretKey().isEmpty()) {
String hmac = "sha256=" + CommonUtil.calculateHMAC(webhook.getSecretKey(), json);
response = getTarget().header(RestUtil.SIGNATURE_HEADER, hmac).post(javax.ws.rs.client.Entity.json(json));
} else {