Limit signed URL duration

Found via s3-tests.
pull/305/head
Andrew Gaul 2019-05-20 12:39:06 +09:00
rodzic 8c9bfe5ea5
commit b9e0714b2d
1 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -488,6 +488,10 @@ public class S3ProxyHandler {
long expires = Long.parseLong(expiresString);
long nowSeconds = System.currentTimeMillis() / 1000;
if (nowSeconds >= expires) {
throw new S3Exception(S3ErrorCode.ACCESS_DENIED,
"Request has expired");
}
if (expires - nowSeconds > TimeUnit.DAYS.toSeconds(365)) {
throw new S3Exception(S3ErrorCode.ACCESS_DENIED);
}
}
@ -503,6 +507,9 @@ public class S3ProxyHandler {
throw new S3Exception(S3ErrorCode.ACCESS_DENIED,
"Request has expired");
}
if (expires > TimeUnit.DAYS.toSeconds(7)) {
throw new S3Exception(S3ErrorCode.ACCESS_DENIED);
}
}
// The aim ?
switch (authHeader.authenticationType) {