Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid providing internal notes to /whoami endpoint (fixes #170) #171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pmauduit
Copy link
Member

@pmauduit pmauduit commented Jan 21, 2025

See mentioned issue #170 and related one (georchestra/georchestra#4280). This PR aims to avoid having the /whoami endpoint revealing the "internal notes" field from the LDAP, as it is an internal note on the user and is not meant to be available from the endpoint.

Tests: 2 tests added, also making sure that the /whoami endpoint will work when not connected (user is null).

@pmauduit pmauduit force-pushed the knowledge-info-whoami-170 branch from 6823a48 to da242bf Compare January 21, 2025 15:35
@pmauduit pmauduit requested a review from groldan January 21, 2025 15:38
@pmauduit pmauduit marked this pull request as ready for review January 21, 2025 15:39
@pmauduit pmauduit requested a review from f-necas January 21, 2025 15:40
@@ -106,6 +106,11 @@ public Mono<Map<String, Object>> whoami(Authentication principal, ServerWebExcha
}

Map<String, Object> ret = new LinkedHashMap<>();
if (user != null) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Auto-reviewing myself): I am not very fond of null testing user, as using an Optional some lines above should be about avoiding it, but is there another way ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but is there another way ?

I don't think so.

@pmauduit
Copy link
Member Author

Also I am wondering if we should handle sensitive fields one by one (hashed passwords from the LDAP, internal CRM notes, ...), or if there are no other means for doing so ?

@pmauduit pmauduit linked an issue Jan 21, 2025 that may be closed by this pull request
@Gaetanbrl
Copy link

Gaetanbrl commented Jan 21, 2025

Perhaps it would be interesting to be able to configure these fields ?

@pmauduit
Copy link
Member Author

pmauduit commented Jan 21, 2025

Perhaps it would be interesting to be able to configure these fields ?

why not, but we can't really predict what would be needed on the GeorchestraUser object in the coming months / years / ... and what should be stripped from the whoami endpoint, in my opinion.

Also making it configureable would leave the opportunity to the administrators to have flawed configurations revealing undesired fields, so I am a bit puzzled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gateway leaks internal notes to user
2 participants