/** * Compiles the script. * * @return the compiled script * @throws CompilationFailedException * if the script contains compile errors */ public Script compile() throws CompilationFailedException { Binding binding = new Binding(); GroovyShell shell = new GroovyShell(GroovySandbox.createSecureClassLoader(GroovyExpressionMatcher.class.getClassLoader()), binding, GroovySandbox.createSecureCompilerConfiguration()); return shell.parse(script); }
loader = GroovySandbox.createSecureClassLoader(loader); CompilerConfiguration cc; if(secureTriggerScript.isSandbox()) { cc = GroovySandbox.createSecureCompilerConfiguration(); } else { cc = new CompilerConfiguration(); return GroovySandbox.run(shell.parse(secureTriggerScript.getScript()), new ProxyWhitelist( Whitelist.all(), new PrintStreamInstanceWhitelist(logger)));
debug(logger, "Executing %s script", scriptName); CompilerConfiguration cc = GroovySandbox.createSecureCompilerConfiguration(); cc.setScriptBaseClass(EmailExtScript.class.getCanonicalName()); cc.addCompilationCustomizers(new ImportCustomizer().addStarImports( GroovySandbox.run(shell.parse(script), new ProxyWhitelist( Whitelist.all(), new MimeMessageInstanceWhitelist(msg),
private ClassLoader makeClassLoader() { ClassLoader cl = Jenkins.get().getPluginManager().uberClassLoader; return GroovySandbox.createSecureClassLoader(cl); }
public FormValidation doCheckScript(@QueryParameter String command) { if (command == null || command.trim().isEmpty()) return FormValidation.error("Script seems to be empty string!"); try { new GroovyShell(GroovySandbox.createSecureCompilerConfiguration()).parse(command); return FormValidation.ok("So far so good"); } catch (CompilationFailedException e) { return FormValidation.error(e.getMessage()); } } }
/** * @param context * Variables the script will see. */ private boolean evaluate(Binding context) { script.setBinding(context); try { return TRUE.equals(GroovySandbox.run(script, Whitelist.all())); } catch (RejectedAccessException x) { throw ScriptApproval.get().accessRejected(x, ApprovalContext.create()); } }
result = GroovySandbox.runInSandbox(new Callable<String>() { @Override public String call() throws Exception {
private CompilerConfiguration makeConfig() { CompilerConfiguration cc = sandbox ? GroovySandbox.createBaseCompilerConfiguration() : new CompilerConfiguration(); cc.addCompilationCustomizers(makeImportCustomizer()); cc.addCompilationCustomizers(makeCpsTransformer()); cc.setScriptBaseClass(CpsScript.class.getName()); for (GroovyShellDecorator d : decorators) { d.configureCompiler(execution,cc); } return cc; }
return GroovySandbox.createSecureClassLoader(loader); } else { return loader;
Object res = GroovySandbox.run(script, new ProxyWhitelist( Whitelist.all(), new PrintStreamInstanceWhitelist(logger),
throw new IllegalStateException("JENKINS-50407: no loaded trustedShell in " + e); return GroovySandbox.runInSandbox(() -> { Outcome outcome = SandboxContinuable.super.run0(cn, categories); RejectedAccessException x = findRejectedAccessException(outcome.getAbnormal());
/** * Compiles the script. * * @return the compiled script * @throws CompilationFailedException if the script contains compile errors */ public Script compile() throws CompilationFailedException { Binding binding = new Binding(); binding.setVariable("falsePositive", falsePositive); GroovyShell shell = new GroovyShell(GroovySandbox.createSecureClassLoader(WarningsDescriptor.class.getClassLoader()), binding, GroovySandbox.createSecureCompilerConfiguration()); return shell.parse(script); }
/** * @since 1.541 */ public static FilterScript parse(String expression, FilterScript defaultScript) { if (Util.fixEmptyAndTrim(expression)==null) return defaultScript; GroovyShell shell = new GroovyShell(GroovySandbox.createSecureClassLoader(FilterScript.class.getClassLoader()), new Binding(), GroovySandbox.createSecureCompilerConfiguration()); return new FilterScript(shell.parse(expression)); }
CompilerConfiguration cc; if (secure) { cl = GroovySandbox.createSecureClassLoader(Jenkins.getActiveInstance().getPluginManager().uberClassLoader); cc = GroovySandbox.createSecureCompilerConfiguration(); } else { cl = Jenkins.getActiveInstance().getPluginManager().uberClassLoader;