Copilot commented on code in PR #12709:
URL: https://github.com/apache/cloudstack/pull/12709#discussion_r3203235467
##########
utils/src/main/java/org/apache/cloudstack/utils/jsinterpreter/JsInterpreter.java:
##########
@@ -62,7 +62,7 @@ public class JsInterpreter implements Closeable {
protected Logger logger = LogManager.getLogger(JsInterpreter.class);
protected static final List<String> RESTRICTED_TOKENS = Arrays.asList(
"engine", "context", "factory",
- "Java", "java", "Packages"," javax", "load", "loadWithNewGlobal",
"print", "factory", "getClass",
+ "Java", "java", "Packages", "javax", "load", "loadWithNewGlobal",
"print", "factory", "getClass",
"runCommand", "Runtime", "exec", "ProcessBuilder", "Thread",
"thread", "Threads", "Class", "class");
Review Comment:
Consider adding a regression unit test for the restricted-token masking to
cover the "javax" entry (e.g., assert that scripts cannot resolve/use `javax`
because it is explicitly bound to null via ENGINE_SCOPE bindings). This would
prevent reintroducing whitespace/typo issues in `RESTRICTED_TOKENS` and
strengthen coverage for this security-hardening behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]