0
0
Jenkinsdevops~20 mins

Script approval and sandbox in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Script Approval Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Jenkins Script Approval Purpose

Why does Jenkins require script approval for certain scripts in the pipeline?

ATo prevent execution of potentially unsafe scripts that could harm the system or leak data
BTo speed up the execution of all pipeline scripts
CTo automatically fix syntax errors in pipeline scripts
DTo allow all users to run any script without restrictions
Attempts:
2 left
💡 Hint

Think about security risks when running scripts from different users.

💻 Command Output
intermediate
2:00remaining
Output of Jenkins Script Approval Status Command

What is the output of the following Jenkins CLI command when there are pending scripts for approval?

Jenkins
java -jar jenkins-cli.jar -s http://jenkins.example.com/ list-plugins --pending-script-approvals
AError: Unknown command 'list-plugins --pending-script-approvals'
B
Pending script approvals:
- method java.lang.Runtime exec java.lang.String
- method hudson.FilePath write java.lang.String
CNo pending script approvals found.
DList of installed plugins with no script approval info
Attempts:
2 left
💡 Hint

Check if the command syntax matches Jenkins CLI commands for script approval.

Configuration
advanced
2:30remaining
Configuring Jenkins to Automatically Approve Safe Scripts

Which configuration snippet in Jenkins Pipeline script allows a method call to be automatically approved without manual intervention?

AUse 'allowUnsafeScripts()' function in the pipeline script
BIn Jenkins Script Security plugin, add the method signature 'hudson.FilePath write java.lang.String' to the approved signatures list
CSet 'sandbox = false' in the pipeline script to disable script approval
DAdd 'approveAllScripts = true' in the Jenkinsfile
Attempts:
2 left
💡 Hint

Think about how Jenkins manages method signatures for script security.

Troubleshoot
advanced
2:00remaining
Troubleshooting Script Rejection in Jenkins Sandbox

A Jenkins pipeline script fails with a security exception when calling a custom method. What is the most likely cause?

AThe Jenkins server is offline
BThe pipeline script has syntax errors unrelated to security
CThe method is not approved in the Jenkins script approval list and sandbox blocks it
DThe Jenkinsfile is missing the 'pipeline' block
Attempts:
2 left
💡 Hint

Consider Jenkins sandbox restrictions on unapproved methods.

🔀 Workflow
expert
3:00remaining
Correct Workflow for Approving a New Script Method in Jenkins

What is the correct sequence of steps to approve a new method call used in a Jenkins pipeline script that is currently blocked by the sandbox?

A2,1,3,4
B2,3,1,4
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint

Think about how Jenkins detects and approves new script methods step-by-step.