-
Notifications
You must be signed in to change notification settings - Fork 904
fix(coderd): ensure correct RBAC when enqueueing notifications #15478
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
Conversation
…e notification messages
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.
review: moved to its own package to avoid import cycle
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.
review: no changes are needed to lifecycle_executor.go
as it has its own actor to which I've added the required permissions
testutil/notifications.go
Outdated
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.
review: moved to notificationstest
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.
self-review: Another option I'm considering is just moving the dbauthz.AsNotifier calls inside the notifications enqueuer. That way, external callers don't need to think about authz when they enqueue a notification. This is both a pro and a con IMO. If folks feel strongly enough about it being the other way, I can make the necessary modifications.
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.
Blocking merge since you have an approval already; I think leaving these in was not intentional?
Why do you think it'd be a con? I think this would make sense and express the intent clearly. |
@dannykopping Danielle made a good point on that in this thread. |
I could imagine later-on creating an endpoint
If |
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.
👍
Before you all start going deeper into discussions keep in mind that firstly we need to mitigate the issue.
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.
TYVM for addressing this! 🦸♂️
Local smoke-testing:
|
While investigating #15477 I noticed the following on my test workspace:
I expanded the search and found that this was a fundamental problem with our test notifier implementation -- namely, that it made absolutely no RBAC assertions.
Logs (loki)
The prospect of creating a completely new test implementation backed by a real
database.Store
was more than I could stomach right now, so I wired in some minimal RBAC assertions and fixed what tests ended up breaking.Hoever, this is not the ideal fix. Changes to our RBAC policy on notifications will not be captured here and may result in similar sadness in future.