Complete the code to enable CSRF protection in Jenkins configuration.
jenkins.security.csrf[1] = trueSetting jenkins.security.csrf.crumbIssuer enables CSRF protection in Jenkins by configuring the crumb issuer.
Complete the code to configure the CSRF crumb issuer class in Jenkins.
jenkins.security.csrf.crumbIssuerClass = '[1]'
The DefaultCrumbIssuer class is the standard crumb issuer for CSRF protection in Jenkins.
Fix the error in the Jenkins pipeline script to correctly handle CSRF protection token.
def crumb = jenkins.model.Jenkins.instance.crumbIssuer.[1]() httpRequest authentication: 'token', url: 'http://example.com/api', headers: [[name: 'Jenkins-Crumb', value: crumb]]
The method getCrumb() is used to get the CSRF crumb token from Jenkins.
Fill both blanks to configure Jenkins to disable CSRF protection and set crumb exclusion.
jenkins.security.csrf[1] = false jenkins.security.csrf.crumbExclusion[2] = []
Setting jenkins.security.csrf.csrf to false disables CSRF protection.
Setting crumbExclusion.exclusions to an empty list clears crumb exclusions.
Fill all three blanks to create a Jenkins pipeline step that sends a POST request with CSRF token header.
def crumb = jenkins.model.Jenkins.instance.crumbIssuer.[1]() httpRequest httpMode: '[2]', url: 'http://example.com/api', headers: [[name: '[3]', value: crumb]]
The getCrumb() method fetches the CSRF token.
The HTTP method is POST for sending data.
The header name for CSRF token is Jenkins-Crumb.