Fix: high-frequency retry loop on RBAC permission errors - #184
Closed
braghettos wants to merge 2 commits into
Closed
Fix: high-frequency retry loop on RBAC permission errors#184braghettos wants to merge 2 commits into
braghettos wants to merge 2 commits into
Conversation
Return an error from rbac.UserCan if the SelfSubjectAccessReviews call fails. This allows the caller to distinguish between a permission denied and an error during the check.
Handle the error returned from rbac.UserCan. If an error occurs, log it and set the allowed status to false. This prevents the retry loop caused by the inability to perform the SelfSubjectAccessReview.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a high-frequency retry loop in the snowplow component.
The root cause of the issue was that the
rbac.UserCanfunction did not differentiate between an API error during theSelfSubjectAccessReviewand a definitive "permission denied" from the API server. It returnedfalsein both cases. The calling code ininternal/resolvers/widgets/resourcesrefs/resolve.godid not have a mechanism to handle thefalsereturn value as a potential error, leading to a high-frequency retry loop when theSelfSubjectAccessReviewcheck itself was failing due to RBAC issues.This PR addresses the issue by:
rbac.UserCanto return an error if theSelfSubjectAccessReviewcall fails.internal/resolvers/widgets/resourcesrefs/resolve.goto handle the error fromrbac.UserCan. If an error occurs, it is logged and the permission is set tofalse, preventing the retry loop.