-
Notifications
You must be signed in to change notification settings - Fork 850
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
dashboard: add authority for archive experiments and events #1261
dashboard: add authority for archive experiments and events #1261
Conversation
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
@g1eny0ung I update the HTTP request on front-end at 408ef7d, PTAL |
/run-e2e-tests |
Signed-off-by: xiang <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #1261 +/- ##
==========================================
- Coverage 55.78% 51.57% -4.21%
==========================================
Files 68 78 +10
Lines 4383 5012 +629
==========================================
+ Hits 2445 2585 +140
- Misses 1768 2159 +391
- Partials 170 268 +98
Continue to review full report at Codecov.
|
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.
LGTM
@STRRL PTAL |
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.
How about printing some log when utils.CanListChaos
return false
.
The current implementation is NOT so good for presenting authorization failed with HTTP API:
- It seems just to return empty results(not empty array
[]
) with HTTP status 200, and the frontend needs more logic to resolve it. - We should return
403
with authorization failed.
If this implementation is a temporary solution, just appending some logs is OK to me.
I take the |
Oh, I missed it.🙈 But I think making errors in |
Why not implementing a specific middleware to define this authority? |
pkg/apiserver/archive/archive.go
Outdated
@@ -93,6 +93,11 @@ func (s *Service) list(c *gin.Context) { | |||
name := c.Query("name") | |||
ns := c.Query("namespace") | |||
|
|||
canList := utils.CanListChaos(c, ns) | |||
if !canList { | |||
return |
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.
Is it more reasonable to return some errors here, such as returning error codes (403 and so on?) ?
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.
yes, you are right, I will refine this logic, maybe use the middleware @cwen0 mentioned
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
Signed-off-by: xiang <[email protected]>
refine this logic by using the middleware in 584aa18, PTAL again @STRRL @cwen0 @g1eny0ung @fewdan |
Signed-off-by: xiang <[email protected]>
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.
LGTM
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.
LGTM
/merge |
/run-all-tests |
/run-e2e-tests |
What problem does this PR solve?
add authority for archive experiments and events
What is changed and how does it work?
when querying the archive experiments and events, will use
SelfSubjectAccessReviews
to judge whether the token can list the information.Checklist
Tests
Side effects
Related changes
Does this PR introduce a user-facing change?