Skip to content
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
10 changes: 10 additions & 0 deletions plugins/tasks/resource/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
<artifactId>concord-runtime-sdk-v2</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.walmartlabs.concord</groupId>
<artifactId>concord-common</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
Copy link
Collaborator

@ibodrov ibodrov Aug 13, 2025

Choose a reason for hiding this comment

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

Why does it need commons-compress now? IIRC, it is only needed if you use zip* methods from concord-common.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not really sure? When I referenced the IOUtils class without it there were "ClassNotFound" errors for the Zip* classes which get imported in IOUtils. We (Ben and I) tried getting around that by using the concord-common dependency, but that didn't seem to confer transient dependencies? If you have ideas on how to fix this they would be welcome.

Copy link
Collaborator

Choose a reason for hiding this comment

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

commons-compress is not needed by the resource task, but it is a transitive dependency of concord-common. Since concord-common is provided scope, its transitive deps aren't loaded for the unit tests. It could probably just be test scope instead of provided here.

<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import static com.walmartlabs.concord.common.IOUtils.assertInPath;

public class ResourceTaskCommon {

private static final String RESOURCE_PREFIX = "resource_";
Expand Down Expand Up @@ -233,25 +234,15 @@ public static String prettyPrintYaml(Object value, int indent) throws IOExceptio
}

private Path normalizePath(String path) {
Path p = Paths.get(path);
if (p.isAbsolute()) {
return p;
}
return workDir.resolve(path);
return assertWorkDirPath(path);
}

private Path assertWorkDirPath(String path) {
if (path == null) {
throw new IllegalArgumentException("Path cannot be null");
}
Path dst = Paths.get(path);
if (!dst.isAbsolute()) {
dst = workDir.resolve(path).normalize().toAbsolutePath();
}
if (!dst.startsWith(workDir)) {
throw new IllegalArgumentException("Invalid path: " + path);
try {
return assertInPath(workDir,path);
} catch (IOException ex) {
throw new IllegalArgumentException("Not authorized to access file outside of working directory: " + path);
}
return dst;
}

private static ObjectWriter createYamlWriter() {
Expand Down