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

Fixes #24708: Groups node ids list in API is still exhaustive even with restricted tenant access #5608

Conversation

clarktsiory
Copy link
Contributor

@clarktsiory clarktsiory commented Apr 17, 2024

https://issues.rudder.io/issues/24708

Everything that needs to "get a group" from LDAP now needs to have a QueryContext.

It propagates in many directions, up to plugins, which need to be merged along this PR :

.foreach(g.serverList)(nodeFactRepo.get _)
.map(_.flatMap(_.map(_.id)))
.map(nodeIds => g.copy(serverList = nodeIds))
})
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering if it wasn't quicker to get nodeIds from nodeFact (keySet, already filtered for the tenant) and intersect with g.serverlist. My intuition is that it's better, but my perf intuition are generaly not good. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is a clever idea ! I agree that it may be not so performant as it is : the ZIO.foreach on a set may be as slow as O(n)...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

✅ Fixed in 567f916 (I expect it to be also at most O(n) but better memory-wise, as we don't store complete NodeFact objects)

@fanf
Copy link
Member

fanf commented Apr 17, 2024

WOUAH, in retrospective, I'm so happy to have missed that case on the original code... That PR looks like it was a super thrilling piece of cake to do 😅 GG, appart for the perf question, looks awesome.

@fanf fanf marked this pull request as draft April 17, 2024 20:51
@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

2 similar comments
@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

@clarktsiory clarktsiory marked this pull request as ready for review April 18, 2024 10:52
@clarktsiory clarktsiory force-pushed the bug_24708/groups_node_ids_list_in_api_is_still_exhaustive_even_with_restricted_tenant_access branch from 21d9541 to 710a1fd Compare April 22, 2024 15:19
@clarktsiory
Copy link
Contributor Author

PR rebased

Copy link
Member

@fanf fanf left a comment

Choose a reason for hiding this comment

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

LGTM

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/5608
-- Your faithful QA
Kant merge: "It is beyond a doubt that all our knowledge begins with experience."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/83629/console)

@fanf
Copy link
Member

fanf commented Apr 22, 2024

OK, squash merging this PR

@fanf fanf force-pushed the bug_24708/groups_node_ids_list_in_api_is_still_exhaustive_even_with_restricted_tenant_access branch from 710a1fd to 7da1f63 Compare April 22, 2024 19:13
@fanf fanf merged commit 7da1f63 into Normation:branches/rudder/8.1 Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants