-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Harbor not properly sharing CSRF tokens/sessions across scaled deployment in k8s #21060
Comments
Hi @ianseyer , Could your check following settings?
|
So, interestingly, I am seeing:
Should I be ensuring that the csrf key follows some particular form, or is exclusively alphanumeric? EDIT: I now see - the length must be 32: https://github.com/goharbor/harbor/blob/main/src/server/middleware/csrf/csrf.go#L70 |
True, you need to make sure the key be 32 characters otherwise harbor would randomly generate a key for use and only work for core replicas=1, otherwise it would failed. So if you specified yourself xsrfkey in harbor-helm values.yaml, please make sure it is legit. |
Fixes goharbor#21060 Do not generate a random key if the provided key has an invalid length. Signed-off-by: wang yan <[email protected]>
Fixes goharbor#21060 Do not generate a random key if the provided key has an invalid length. Signed-off-by: wang yan <[email protected]>
Fixes goharbor#21060 Do not generate a random key if the provided key has an invalid length. Signed-off-by: wang yan <[email protected]>
* update csrf key generation Fixes #21060 Do not generate a random key if the provided key has an invalid length. Signed-off-by: wang yan <[email protected]> * fix ut check Signed-off-by: wang yan <[email protected]> --------- Signed-off-by: wang yan <[email protected]>
* update csrf key generation Fixes goharbor#21060 Do not generate a random key if the provided key has an invalid length. Signed-off-by: wang yan <[email protected]> * fix ut check Signed-off-by: wang yan <[email protected]> --------- Signed-off-by: wang yan <[email protected]>
When using the UI, I will sporadically see "CSRF token invalid" errors when performing actions when harbor-core is scaled to >1.
This was confirmed by scaling harbor-core down to 1, and then deletions worked consistently without issue.
On Harbor 2.11.0
The text was updated successfully, but these errors were encountered: