Skip to content

Commit 086296a

Browse files
Handle null headers properly in auth filters.
1 parent f2ea14f commit 086296a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/kotlin/org/exploit/keeper/filter/KeeperAuthFilter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ class KeeperAuthFilter(
2222
return
2323

2424
val instanceId = p0.getHeaderString(KeeperAuthenticator.HEADER_INSTANCE_ID)
25-
.toIntOrNull() ?: throw NotAuthorizedException("Invalid instance id")
25+
?.toIntOrNull() ?: throw NotAuthorizedException("Invalid instance id")
2626

2727
val signature = p0.getHeaderString(KeeperAuthenticator.HEADER_SIGNATURE)
2828
?: throw NotAuthorizedException("Missing signature")
2929

30-
val timestamp = p0.getHeaderString(KeeperAuthenticator.HEADER_TIMESTAMP).toLongOrNull()
30+
val timestamp = p0.getHeaderString(KeeperAuthenticator.HEADER_TIMESTAMP)?.toLongOrNull()
3131
?: throw NotAuthorizedException("Missing timestamp")
3232

3333
try {

src/main/kotlin/org/exploit/keeper/filter/MachineAuthFilter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class MachineAuthFilter(
4242
return
4343
}
4444

45-
val token = ctx.getHeaderString(HEADER)
45+
val token: String? = ctx.getHeaderString(HEADER)
4646

4747
if (token.isNullOrBlank()) {
4848
ctx.abortWith(Response.status(Response.Status.UNAUTHORIZED).build())

0 commit comments

Comments
 (0)