Skip to content

Commit a4a453f

Browse files
simonholzapfelAFaust
authored andcommitted
Refactor of configurable execution in SecureContext
1 parent db9b3c5 commit a4a453f

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

repository/src/main/java/org/orderofthebee/addons/support/tools/repo/jsconsole/ExecuteWebscript.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void setDumpService(final DumpService dumpService)
119119

120120
private String postRollScriptClasspath;
121121

122-
private boolean secureContext;
122+
private boolean allowUnrestrictedScripts;
123123

124124
/**
125125
*
@@ -161,7 +161,7 @@ public void execute(final WebScriptRequest request, final WebScriptResponse resp
161161
// Note: Need to use import here so the user-supplied script may also import scripts
162162
final String script = "<import resource=\"classpath:" + this.preRollScriptClasspath + "\">\n" + jsreq.script;
163163

164-
final ScriptContent scriptContent = new StringScriptContent(script + this.postRollScript, this.secureContext);
164+
final ScriptContent scriptContent = new StringScriptContent(script + this.postRollScript, this.allowUnrestrictedScripts);
165165

166166
final int providedScriptLength = this.countScriptLines(jsreq.script, false);
167167
final int resolvedScriptLength = this.countScriptLines(script, true);
@@ -613,9 +613,9 @@ public final void setPostRollScriptClasspath(final String postRollScriptClasspat
613613
this.postRollScriptClasspath = postRollScriptClasspath;
614614
}
615615

616-
public void setSecureContext(boolean secureContext)
616+
public final void setAllowUnrestrictedScripts(boolean allowUnrestrictedScripts)
617617
{
618-
this.secureContext = secureContext;
618+
this.allowUnrestrictedScripts = allowUnrestrictedScripts;
619619
}
620620

621621
private static class StringScriptContent implements ScriptContent
@@ -625,7 +625,7 @@ private static class StringScriptContent implements ScriptContent
625625

626626
private final boolean secure;
627627

628-
public StringScriptContent(final String content, boolean secure)
628+
public StringScriptContent(final String content, final boolean secure)
629629
{
630630
this.content = content;
631631
this.secure = secure;

repository/src/main/resources/alfresco/module/ootbee-support-tools-repo/alfresco-global.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ootbee-support-tools.propertyBackedBeanPersister.processLegacyJmxKeysOnRemovePro
1010
ootbee-support-tools.js-console.serverInfo.nodeCountsViaSOLR=true
1111

1212
# true if the scripts in the context are considered secure and may access java.* libs directly otherwise false
13-
ootbee-support-tools.js-console.scriptContext.secure=true
13+
ootbee-support-tools.js-console.allowUnrestrictedScripts=true
1414

1515
# it would be unexpected if there ever were so many property backed beans that this limit would not suffice
1616
cache.propertyBackedBeansPersisterSharedCache.tx.maxItems=1000

repository/src/main/resources/alfresco/module/ootbee-support-tools-repo/module-context.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
</property>
106106
<property name="preRollScriptClasspath" value="alfresco/module/ootbee-${project.artifactId}/scripts/jsconsole-pre-roll-script.js" />
107107
<property name="postRollScriptClasspath" value="alfresco/module/ootbee-${project.artifactId}/scripts/jsconsole-post-roll-script.js" />
108-
<property name="secureContext" value="${ootbee-support-tools.js-console.scriptContext.secure}"/>
108+
<property name="allowUnrestrictedScripts" value="${ootbee-support-tools.js-console.allowUnrestrictedScripts}"/>
109109
</bean>
110110

111111
<bean id="webscript.org.orderofthebee.support-tools.jsconsole.executionResult.get" class="org.orderofthebee.addons.support.tools.repo.jsconsole.ExecutionResultGet" parent="webscript">

0 commit comments

Comments
 (0)