use of org.jenkinsci.plugins.scriptsecurity.sandbox.Whitelist in project workflow-cps-plugin by jenkinsci.
the class CpsWhitelist method get.
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification = "TODO 1.653+ switch to Jenkins.getInstanceOrNull")
static synchronized Whitelist get() {
Jenkins j = Jenkins.getInstance();
if (j == null) {
return new ProxyWhitelist();
}
Whitelist wrapped = wrappedByJenkins.get(j);
if (wrapped == null) {
wrapped = new ProxyWhitelist(new CpsWhitelist(), Whitelist.all());
wrappedByJenkins.put(j, wrapped);
}
return wrapped;
}
use of org.jenkinsci.plugins.scriptsecurity.sandbox.Whitelist in project engine by craftercms.
the class SiteContextFactory method configureScriptSandbox.
protected void configureScriptSandbox(SiteContext siteContext, ResourceLoader resourceLoader) {
try {
// Enable both hardcoded & configurable blacklists
if (enableScriptSandbox && enableSandboxBlacklist) {
Resource sandboxBlacklist = resourceLoader.getResource(this.sandboxBlacklist);
try (InputStream is = sandboxBlacklist.getInputStream()) {
Blacklist blacklist = new Blacklist(new InputStreamReader(is));
siteContext.scriptSandbox = new SandboxInterceptor(blacklist, singletonList(Dom4jExtension.class));
}
// Enable only the hardcoded blacklist
} else if (enableScriptSandbox) {
Whitelist whitelist = new PermitAllWhitelist();
siteContext.scriptSandbox = new SandboxInterceptor(whitelist, singletonList(Dom4jExtension.class));
}
} catch (IOException e) {
throw new SiteContextCreationException("Unable to load sandbox blacklist for site '" + siteContext.getSiteName() + "'", e);
}
}
Aggregations