Skip to content

Commit

Permalink
Handle empty session and decode err
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy5189 committed Nov 27, 2023
1 parent 8207e38 commit 33263ff
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,20 @@ func handleCommand(
}
break
case "challenge_session":
if command.SessionId == "" {
log.Printf("KAFKA: challenge_session: session_id is EMPTY, break\n")
break
}
// exempt a site from challenge according to config
_, disabled := config.SitesToDisableBaskerville[command.Host]

if !disabled {
// gin does urldecode or cookie, so we decode any possible urlencoded session id from kafka
sessionIdDecoded, _ := url.QueryUnescape(command.SessionId)
sessionIdDecoded, decodeErr := url.QueryUnescape(command.SessionId)
if decodeErr != nil {
log.Printf("KAFKA: challenge_session: fail to urldecode session_id %s, break\n", command.SessionId)
break
}
updateExpiringDecisionListsSessionId(
config,
command.Value,
Expand Down

0 comments on commit 33263ff

Please sign in to comment.