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

v1: expose groups in user customization (HMS-4901) #1385

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

Conversation

croissanne
Copy link
Member

@croissanne croissanne commented Oct 28, 2024

When adding a user, immediately add it to the specified groups.


It should be fine to drop the default as the edge-api always adds the groups already
https://github.com/RedHatInsights/edge-api/blob/622244f04989159709332e67788c04296989e431/pkg/clients/imagebuilder/client.go#L353-L358

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
internal/v1/api.go 49.02% <ø> (ø)
internal/v1/handler_compose_image.go 65.31% <100.00%> (-0.05%) ⬇️

@@ -751,13 +751,12 @@ func (h *Handlers) buildCustomizations(ctx echo.Context, cr *ComposeRequest, d *
if cust.Users != nil {
var users []composer.User
for _, u := range *cust.Users {
groups := &[]string{"wheel"}
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess I'm stating the obvious here but I will do it anyway. Unless there is somewhere adding "wheel" to u.Group automatically this is a behavior change - I guess it's okay because the frontend is aware and takes care of this and we have no other consumers? Might still be nice to mention it in the commit message maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point, I'll do that :)

Copy link
Collaborator

@lzap lzap left a comment

Choose a reason for hiding this comment

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

This is a chance to improve the API docs.

I am assuming that the code currently works that for a user named test a primary group test is added and now the new field allows customization of secondary (also known as supplementary) groups.

I suggest to document all of that, details do matter when it comes to security.

@mvo5 has a point, tho I think it is okay since the patch is actually removing a group. If this was the opposite, then it would have been much bigger problem.

@croissanne croissanne force-pushed the wheel-groups branch 2 times, most recently from 5074701 to 6de88f5 Compare October 30, 2024 11:42
When adding a user, immediately add it to the specified groups.

This patch technically includes a behavioural change (the wheel group
will no longer be added by default). But the main consumers of this
api (the edge-api) already add the wheel group each time, and the api
doesn't have `additionalProperties` disabled for the users
customization.
@croissanne
Copy link
Member Author

/retest

1 similar comment
@croissanne
Copy link
Member Author

/retest

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.

3 participants