-
Notifications
You must be signed in to change notification settings - Fork 886
chore(cli): add linter to detect potential spurious usage of owner user in cli tests #10133
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
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.
Diff doesn't seem as bad as I would have guessed. Sweet!
Curious how robust the rules.go is. I guess we never nest those 2 things in different scopes, so it should work pretty well.
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.
This solution turned out nice, awesome job!
There does seem to be room for improvement, it didn't actually catch the port-forwarding thing because the calls to |
Detects the following pattern where the CLI is initialized with a client authenticated as the "first user":
When updating the unit tests, I tried to stick to the principle of least privilege as much as possible. Note that this doesn't stop you from using the owner if needed, you just need to add a
//nolint:gocritic
with reasoning.Note: In the course of going through this, I also noted an inaccuracy in our admin RBAC docs regarding updating other workspaces. Updated.