Skip to content

Commit 151f2bb

Browse files
committed
GHSA-j2pc-v64r-mv4f: Fix protoc digest not being verified if using protoc on the system path
1 parent 43131ae commit 151f2bb

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

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

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
@@ -89,19 +89,20 @@ public Optional<Path> resolve(
8989
);
9090
}
9191

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

96-
// It is likely a URL, not a version string.
97-
var path = version.contains(":")
98-
? resolveFromUri(version)
99-
: resolveFromMavenRepositories(version);
100-
101102
if (path.isEmpty()) {
102103
return Optional.empty();
103-
104104
}
105+
105106
var resolvedPath = path.get();
106107

107108
if (digest != null) {

0 commit comments

Comments
 (0)