Skip to content

Commit

Permalink
Merge pull request #150 from scireum/jvo/authentication-fix
Browse files Browse the repository at this point in the history
Fix: Authentication Check
  • Loading branch information
jakobvogel committed Sep 15, 2020
2 parents f5f874a + 7aaf82d commit 94876a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/ninja/S3Dispatcher.java
Expand Up @@ -546,7 +546,7 @@ private boolean checkObjectRequest(WebContext ctx, Bucket bucket, String id) {

private boolean objectCheckAuth(WebContext ctx, Bucket bucket, String key) {
String hash = getAuthHash(ctx);
if (hash != null) {
if (Strings.isFilled(hash)) {
String expectedHash = hashCalculator.computeHash(ctx, "");
String alternativeHash = hashCalculator.computeHash(ctx, "/s3");
if (!expectedHash.equals(hash) && !alternativeHash.equals(hash)) {
Expand All @@ -562,7 +562,7 @@ private boolean objectCheckAuth(WebContext ctx, Bucket bucket, String key) {
return false;
}
}
if (bucket.isPrivate() && !ctx.get("noAuth").isFilled() && hash == null) {
if (bucket.isPrivate() && !ctx.get("noAuth").isFilled() && Strings.isEmpty(hash)) {
errorSynthesizer.synthesiseError(ctx,
bucket.getName(),
key,
Expand Down

0 comments on commit 94876a9

Please sign in to comment.