Skip to content

Commit

Permalink
avoid providing internal notes to /whoami endpoint (fixes #170)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmauduit committed Jan 21, 2025
1 parent 3bb5bec commit 6823a48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public Mono<Map<String, Object>> whoami(Authentication principal, ServerWebExcha
}

Map<String, Object> ret = new LinkedHashMap<>();
// notes is an internal field and should not be provided by the /whoami endpoint (see #170)
user.setNotes(null);
ret.put("GeorchestraUser", user);
if (principal == null) {
ret.put("Authentication", null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,14 @@ static void registerLdap(DynamicPropertyRegistry registry) {
.isEmpty();
}

public @Test void testWhoamiNoNotesRevealed() {
testClient.get().uri("/whoami")//
.header("Authorization", "Basic dGVzdGFkbWluOnRlc3RhZG1pbg==") // testadmin:testadmin
.exchange()//
.expectStatus()//
.is2xxSuccessful()//
.expectBody()//
.jsonPath("$.GeorchestraUser.notes").isEmpty();
}

}

0 comments on commit 6823a48

Please sign in to comment.