Merge branch 'min-length-fix' into 'master'

Log warning instead of stack trace if token is too short

See merge request mangadex-pub/mangadex_at_home!62
This commit is contained in:
carbotaniuman 2020-07-18 16:34:09 +00:00
commit e0a4b04c70

View file

@ -95,6 +95,10 @@ class ImageServer(
if (tokenized || serverSettings.forceTokens) { if (tokenized || serverSettings.forceTokens) {
val tokenArr = Base64.getUrlDecoder().decode(Path.of("token")(request)) 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 { val token = try {
JACKSON.readValue<Token>( JACKSON.readValue<Token>(
try { try {