Skip to content

Commit 4ffe66b

Browse files
committed
GHSA-j2pc-v64r-mv4f: Fix protoc digest not being verified if using protoc on the system path
1 parent 59097aa commit 4ffe66b

File tree

1 file changed

+8
-7
lines changed
  • protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/protoc

1 file changed

+8
-7
lines changed

protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/protoc/ProtocResolver.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,20 @@ public Optional<Path> resolve(
8888
);
8989
}
9090

91+
Optional<Path> path;
92+
9193
if (version.equalsIgnoreCase("PATH")) {
92-
return systemPathResolver.resolve(EXECUTABLE_NAME);
94+
path = systemPathResolver.resolve(EXECUTABLE_NAME);
95+
} else if (version.contains(":")) {
96+
path = resolveFromUri(version);
97+
} else {
98+
path = resolveFromMavenRepositories(version);
9399
}
94100

95-
// It is likely a URL, not a version string.
96-
var path = version.contains(":")
97-
? resolveFromUri(version)
98-
: resolveFromMavenRepositories(version);
99-
100101
if (path.isEmpty()) {
101102
return Optional.empty();
102-
103103
}
104+
104105
var resolvedPath = path.get();
105106

106107
if (digest != null) {

0 commit comments

Comments
 (0)