# Jenkins: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.String toUpperCase

**Code:** `Scripts not permitted to use method` · **Category:** CI/CD · **Seen on:** Jenkins

A sandboxed Pipeline script called a method that has not been approved in Script Security.

## Meaning

Pipeline scripts run in a Groovy sandbox for safety. Unapproved methods are blocked until an administrator approves the signature at Manage Jenkins → In-process Script Approval. Safer fix: move the logic into a shared library (trusted) or use built-in steps.

## Common causes

- Using Java/Groovy APIs not whitelisted in the sandbox
- Calling methods on arbitrary objects (e.g. `new File()`)
- New signature after a plugin update
- Script uses `@NonCPS` or reflection
- Shared library marked untrusted

## Quick fix

1. Approve the signature in Manage Jenkins → In-process Script Approval (review it first)
2. Move logic into a trusted shared library
3. Replace with pipeline steps (`readJSON`, `sh`)

## Detailed fix by platform

### Jenkins

1. Use `readJSON`/`writeFile` steps instead of Java IO
2. Review requests carefully — approval grants that call to all sandboxed scripts

## How to diagnose

1. **Method** — Which signature is rejected?
2. **Alternative** — Is a Pipeline step available?
3. **Trust** — Safe to approve?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cicd/jenkins-script-not-permitted)
