argo-cd icon indicating copy to clipboard operation
argo-cd copied to clipboard

Random Webhook token verification failure (Gitlab)

Open c-buisson opened this issue 1 year ago • 7 comments

Describe the bug

I am experiencing this bug where ArgoCD server will randomly fail to verify the Gitlab webhook token. The webhook is working but sometimes ArgoCD will not be able to verify the token. After a few minutes, ArgoCD will be able to verify the token again (nothing was updated/changed on either Gitlab or ArgoCD).

To Reproduce

I followed this page to setup the Webhook and configure ArgoCD.

Expected behavior

ArgoCD should always be able to validate the webhook token.

Screenshots

Screenshot 2023-08-30 at 15 42 33

Version

argocd: v2.8.0+804d4b8
  BuildDate: 2023-08-07T19:41:16Z
  GitCommit: 804d4b8ca6bc4c2cf02c5c971aa923ec5b8623f0
  GitTreeState: clean
  GoVersion: go1.20.6
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.8.0+804d4b8
  BuildDate: 2023-08-07T14:25:33Z
  GitCommit: 804d4b8ca6bc4c2cf02c5c971aa923ec5b8623f0
  GitTreeState: clean
  GoVersion: go1.20.6
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v5.1.0 2023-06-19T16:58:18Z
  Helm Version: v3.12.1+gf32a527
  Kubectl Version: v0.24.2
  Jsonnet Version: v0.20.0

Logs

time="2023-08-30T13:38:34Z" level=info msg="GitLab webhook token verification failed" security=3
time="2023-08-30T13:38:34Z" level=info msg="Webhook processing failed: X-Gitlab-Token validation failed"

c-buisson avatar Aug 30 '23 13:08 c-buisson

Same issue here with argocd v2.8.3

Kamaradeivanov avatar Sep 22 '23 09:09 Kamaradeivanov

Same issue here with argocd v2.6.7

Edit: We have added the Gitlab Webhook token through a secret that is referenced in the values.yaml. However, ArgoCD also saves a Gitlab Webhook Secret in the argocd-secret. Once I deleted that, the webhook went through without problems.

aydinseven7 avatar Oct 27 '23 10:10 aydinseven7

I also encountered this problem, argocd: version 2.9.0, sometimes normal and sometimes status code 400。

daquan avatar Nov 13 '23 04:11 daquan

Same problem

SergeyLadutko avatar Nov 14 '23 11:11 SergeyLadutko

Same problem, I restarted deployment/argocd-server. After restarting, the webhook works normally.

alex0403lin avatar Nov 30 '23 06:11 alex0403lin

This is occurring always for me in v2.9.3 as well. I've tried restarting the argocd-server deployment as well, but seems to no avail.

Does anybody have any pointers as to how to debug/fix this?

Any help is much appreciated. Thanks

sarath-ig avatar Jan 02 '24 17:01 sarath-ig

same problem: v2.9.3

jibill avatar Jan 04 '24 12:01 jibill

Hey @sarath-ig @jibill

We ran into the same problem when we upgraded from 2.8.0 to 2.9.3 and it turned out we had set a token in the GitLab webhook configuration but not in the argocd-secret. It seems like in former versions (at least 2.8.0 and below) ArgoCD ignored the X-Gitlab-Token if you had set no secret in ArgoCD and therefore it worked.

After the update it seems like ArgoCD is not so lenient anymore and if you have set no secret in ArgoCD but did provide a secret via X-Gitlab-Token it fails (although I'm not able to find the respective code change in ArgoCD code or code of the utilized library https://github.com/go-playground/webhooks).

So to resolve the problem make sure that if you have set a secret token in the GitLab Webhook confiuration you also have set the same in the argocd-secret secret.

mrkwtz avatar Jan 10 '24 16:01 mrkwtz

I can confirm i have this issue too. It didn´t occur with 2.8.x. But with the release 2.9.3 sometimes the webhook doesn´t work.

MichaelTrip avatar Jan 18 '24 07:01 MichaelTrip

Hi guys,

I have just upgraded to Argo CD 2.9.6, and at the beginning I was still getting the X-Gitlab-Token validation failed error. After restarting the argo-server instances (@alex0403lin), the error seams to be gone! Before the reboot, I was getting the error more than 50% of the time and after the reboot, all the webhooks (40+) have been successfully sent to Argo. So I'll keep track of the success rate and keep this thread updated if any issues occurs with the Gitlab webhook!

EM-Savard avatar Feb 09 '24 04:02 EM-Savard

Only 2 of 36 webhooks succeed in version 2.10.6.

sudoexec avatar May 21 '24 13:05 sudoexec