Environment
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
-
CloudBees CI (CloudBees Core) on traditional platforms - Client controller
-
CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
Explanation
Jenkins comes with a CSRF protection feature that is enabled by default. The DefaultCrumbIssuer validates crumbs using the authenticated user’s identity and their web session.
|
Prior to Jenkins 2.543, the The |
Crumb validation errors can still occur if:
-
The web session has expired or been invalidated
-
The crumb was issued in a different session than the one making the request
-
CSRF protection is misconfigured
Resolution
Ensure that:
-
Your HTTP client preserves cookies (session continuity) across requests
-
If using API calls with username/password authentication, you obtain the crumb and use it within the same session (see CSRF explained)
Workaround
Use API token for authentication since CSRF crumb is no longer required when authenticating using API token. It is no longer necessary to provide a CSRF crumb when sending an HTTP request with Basic authentication that provides the authenticating user’s API token in place of a password. As described on Jenkins documentation.