Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] add black key for switch task #15680

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public class SwitchTaskUtils {
"eval",
"function",
"import",
".",
"()",
"[",
"]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get the final exec command in user input? such as we can convert below code

var a = Java.type("ja" + "va.lang.Runtime");
var b = a.getRuntime();
b.exec(${cmd})

to

var a = Java.type("ja" + "va.lang.Runtime");
var b = a.getRuntime();
Java.type("ja" + "va.lang.Runtime").getRuntime().exec(${cmd})

If we can do it, I think that would be easier to check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to convert because the code are executed in js engine.

"\\\\");

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,15 @@ public void testIllegalCondition() {
SwitchTaskUtils.generateContentWithTaskParams(contentWithUnicode, globalParams, varParams);
});

String contentWithSpecify1 = "cmd.abc";
Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> {
SwitchTaskUtils.generateContentWithTaskParams(contentWithSpecify1, globalParams, varParams);
});

String contentWithSpecify2 = "cmd()";
Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> {
SwitchTaskUtils.generateContentWithTaskParams(contentWithSpecify2, globalParams, varParams);
});

}
}
Loading