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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<!-- Plugin version -->
<build.helper-maven-plugin.version>3.6.2</build.helper-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.15</jacoco-maven-plugin.version>
<spotless-maven-plugin.version>3.10.3</spotless-maven-plugin.version>
<spotless-maven-plugin.version>3.10.4</spotless-maven-plugin.version>
<maven-compiler-plugin.version>3.16.0</maven-compiler-plugin.version>
<maven-clean-plugin.version>3.5.0</maven-clean-plugin.version>
<maven-install-plugin.version>3.2.0</maven-install-plugin.version>
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/land/oras/auth/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -718,13 +718,12 @@ private <T> ResponseWrapper<T> executeRequest(
// Scopes are invariant across retries β€” compute once.
ContainerRef containerRef = scopes.getContainerRef();
LOG.debug("Scopes are adding registry scopes");
Scopes newScopes =
switch (method) {
case "GET", "HEAD" -> scopes.withAddedRegistryScopes(Scope.PULL);
case "POST", "PUT", "PATCH" -> scopes.withAddedRegistryScopes(Scope.PUSH);
case "DELETE" -> scopes.withAddedRegistryScopes(Scope.DELETE);
default -> throw new OrasException("Unsupported HTTP method: " + method);
};
Scopes newScopes = switch (method) {
case "GET", "HEAD" -> scopes.withAddedRegistryScopes(Scope.PULL);
case "POST", "PUT", "PATCH" -> scopes.withAddedRegistryScopes(Scope.PUSH);
case "DELETE" -> scopes.withAddedRegistryScopes(Scope.DELETE);
default -> throw new OrasException("Unsupported HTTP method: " + method);
};
newScopes = newScopes.withIdentity(authProvider.getIdentity(containerRef));
LOG.debug("Existing scopes: {}", scopes.getScopes());
LOG.debug("New scopes: {}", newScopes.getScopes());
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/land/oras/policy/SigstoreVerifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,10 @@ private static boolean digestMatches(byte[] payload, String imageDigest) {
*/
private static boolean verifySignature(PublicKey key, byte[] content, byte[] signature) {
// Might support other algorithm in the future
String algorithm =
switch (key.getAlgorithm()) {
case Const.KEY_EC_ALGORITHM -> Const.KEY_SHA256_ECDSA_SIGNATURE_ALGORITHM;
default -> null;
};
String algorithm = switch (key.getAlgorithm()) {
case Const.KEY_EC_ALGORITHM -> Const.KEY_SHA256_ECDSA_SIGNATURE_ALGORITHM;
default -> null;
};
if (algorithm == null) {
LOG.warn("Unsupported public key algorithm for Sigstore verification: {}", key.getAlgorithm());
return false;
Expand Down
Loading