0
0
Jenkinsdevops~10 mins

CSRF protection in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable CSRF protection in Jenkins configuration.

Jenkins
jenkins.security.csrf[1] = true
Drag options to blanks, or click blank then click option'
A.enable
B.crumbIssuer
C.csrf
D.protection
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect property names like '.enable' or '.csrf'.
2fill in blank
medium

Complete the code to configure the CSRF crumb issuer class in Jenkins.

Jenkins
jenkins.security.csrf.crumbIssuerClass = '[1]'
Drag options to blanks, or click blank then click option'
ADefaultCrumbIssuer
BNoCrumbIssuer
CStrictCrumbIssuer
DSimpleCrumbIssuer
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing classes that do not exist or disable CSRF protection.
3fill in blank
hard

Fix the error in the Jenkins pipeline script to correctly handle CSRF protection token.

Jenkins
def crumb = jenkins.model.Jenkins.instance.crumbIssuer.[1]()
httpRequest authentication: 'token', url: 'http://example.com/api', headers: [[name: 'Jenkins-Crumb', value: crumb]]
Drag options to blanks, or click blank then click option'
AgetCrumb
BretrieveCrumb
CgenerateCrumb
DfetchCrumb
Attempts:
3 left
💡 Hint
Common Mistakes
Using method names that do not exist in Jenkins API.
4fill in blank
hard

Fill both blanks to configure Jenkins to disable CSRF protection and set crumb exclusion.

Jenkins
jenkins.security.csrf[1] = false
jenkins.security.csrf.crumbExclusion[2] = []
Drag options to blanks, or click blank then click option'
A.csrf
B.exclude
C.exclusions
D.crumb
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect property names that cause errors.
5fill in blank
hard

Fill all three blanks to create a Jenkins pipeline step that sends a POST request with CSRF token header.

Jenkins
def crumb = jenkins.model.Jenkins.instance.crumbIssuer.[1]()
httpRequest httpMode: '[2]', url: 'http://example.com/api', headers: [[name: '[3]', value: crumb]]
Drag options to blanks, or click blank then click option'
AgetCrumb
BPOST
CJenkins-Crumb
DfetchCrumb
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong method names or header names causing request failure.