-
Notifications
You must be signed in to change notification settings - Fork 931
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
Auth: Allow listing unmanaged networks with fine-grained auth #14447
Conversation
Heads up @mionaalex - the "Documentation" label was applied to this issue. |
4777eac
to
20724a7
Compare
lxd/networks.go
Outdated
|
||
err = s.DB.Cluster.Transaction(r.Context(), func(ctx context.Context, tx *db.ClusterTx) error { | ||
// Get list of managed networks (that may or may not have network interfaces on the host). | ||
networkNames, err = tx.GetNetworks(ctx, effectiveProjectName) | ||
networks[0], err = tx.GetNetworks(ctx, effectiveProjectName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please can we have local constants for the magic numbers 0 and 1 so we dont end up with hard to read logic like this:
if !shared.ValueInSlice(iface.Name, networks[0]) {
networks[1] = append(networks[1], iface.Name)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep sure. I wasn't sure about this either and contemplated using a map but it seemed overkill for something so simple. I'll add some constants.
Signed-off-by: Mark Laing <[email protected]>
Signed-off-by: Mark Laing <[email protected]>
Signed-off-by: Mark Laing <[email protected]>
Signed-off-by: Mark Laing <[email protected]>
Signed-off-by: Mark Laing <[email protected]>
Signed-off-by: Mark Laing <[email protected]>
…orks. Signed-off-by: Mark Laing <[email protected]>
20724a7
to
152584e
Compare
Thanks! |
Fixes issue where fine-grained authorization was filtering out unmanaged networks (because they aren't in the database). To do this I added a new entitlement at the server level:
can_view_unmanaged_networks
. Restricted TLS clients are granted this by default to not break existing behaviour.Opening this now but will mark as draft until I add some tests.
Closes #14085