Skip to content

Commit

Permalink
Avoid DB error when sessionId is passed in the incorrect format
Browse files Browse the repository at this point in the history
closes keycloak#34304

Signed-off-by: mposolda <[email protected]>
  • Loading branch information
mposolda committed Nov 13, 2024
1 parent fbfdfe5 commit 6dc6400
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public String getSessionId() {
}

public void setSessionId(String sessionId) {
this.sessionId = sessionId;
this.sessionId = maxLength(sessionId, 255);
}

public String getIpAddress() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ public void lengthExceedLimit(){
testing().onEvent(create(System.currentTimeMillis() - 30000, EventType.LOGIN, StringUtils.repeat(realmId, 100), "clientId", "userId", "127.0.0.1", "error"));
testing().onEvent(create(System.currentTimeMillis() - 30000, EventType.LOGIN, realmId, "clientId", StringUtils.repeat("userId", 100), "127.0.0.1", "error"));

EventRepresentation event = create(System.currentTimeMillis() - 30000, EventType.LOGIN, realmId, "clientId", "userId", "127.0.0.1", "error");
event.setSessionId(StringUtils.repeat("sessionId", 100));
testing().onEvent(event);
}

@Test
Expand Down

0 comments on commit 6dc6400

Please sign in to comment.