Log warning instead of stack trace if token is too short

This commit is contained in:
radonbark 2020-07-18 00:47:32 -04:00
parent bba979c212
commit 5d8fe5b272

View file

@ -95,6 +95,10 @@ class ImageServer(
if (tokenized || serverSettings.forceTokens) {
val tokenArr = Base64.getUrlDecoder().decode(Path.of("token")(request))
if (tokenArr.size < 24) {
LOGGER.info { "Request for $sanitizedUri rejected for invalid token" }
return@then Response(Status.FORBIDDEN)
}
val token = try {
JACKSON.readValue<Token>(
try {