Merge branch 'dev' into fix-#netty-secruity
This commit is contained in:
commit
a20bf00377
|
|
@ -33,12 +33,12 @@ import lombok.extern.slf4j.Slf4j;
|
|||
public class GitProjectManager {
|
||||
|
||||
public static final String GIT_PATH_LOCAL = "GIT_PROJECT";
|
||||
private static final Pattern GIT_CHECK_PATTERN = Pattern.compile("^(git@|https?://)");
|
||||
private static final Pattern GIT_CHECK_PATTERN = Pattern.compile("^(git@|https?://)(?![&|])[^&|]+$");
|
||||
private String path;
|
||||
private String baseDir = ".";
|
||||
|
||||
public static boolean isGitPath(String path) {
|
||||
return GIT_CHECK_PATTERN.matcher(path).find();
|
||||
return GIT_CHECK_PATTERN.matcher(path).matches();
|
||||
}
|
||||
|
||||
public void prepareProject() throws Exception {
|
||||
|
|
|
|||
|
|
@ -72,6 +72,12 @@ public class PytorchTaskTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGitProjectUrlInjection() {
|
||||
Assertions.assertFalse(GitProjectManager.isGitPath("git@& cat /etc/passwd >/poc.txt #"));
|
||||
Assertions.assertFalse(GitProjectManager.isGitPath("git@| cat /etc/passwd >/poc.txt #"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGitProject() {
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ public class RemoteExecutor implements AutoCloseable {
|
|||
int exitCode = -1;
|
||||
log.info("Remote shell task run status: {}", logLine);
|
||||
if (logLine.contains(STATUS_TAG_MESSAGE)) {
|
||||
String status = logLine.replace(STATUS_TAG_MESSAGE, "").trim();
|
||||
String status = StringUtils.substringAfter(logLine, STATUS_TAG_MESSAGE);
|
||||
if (status.equals("0")) {
|
||||
log.info("Remote shell task success");
|
||||
exitCode = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue