-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix: cluster member role user should not be able to delete node on Harvester Hosts page #83
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Yi-Ya Chen <[email protected]>
Could you also check this PR works well on harvester standalone mode with multiple nodes env ? |
return node; | ||
}); | ||
} | ||
} |
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.
I'm not sure if there's a more elegant way to handle this, any suggestions would be helpful. 🙏
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.
I think we should move the logic in the node's model.
I any case, I think the delete action should be blocked by the backend. @Yu-Jack WDYT ?
}); | ||
|
||
// keep availableActions non-enumerable | ||
Object.defineProperty(node, 'availableActions', { |
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.
In general, availableActions
should be defined in the model, in this case it would be pkg/harvester/models/harvester/node.js
.
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.
Sounds good, but the trade-off is that the model will have a broader impact, and using async within the getter could lead to infinite recursion, so we need the _initialized
flag to prevent repetition.
update in commit 43b10b2.
Hi @torchiaf Actually, backend has blocked this request. So, I think the point here is to hide the cluster-member demo.movcluster-owner demo-02.mov |
Signed-off-by: Yi-Ya Chen <[email protected]>
Signed-off-by: Yi-Ya Chen <[email protected]>
Sorry, what I actually mean is: should the server remove the DELETE method from node's schema depending on user's roles ? |
@torchiaf But, I don't find the
Besides, there is no "remove" in links map. How does it work? And it seems dashboard has checked |
The UI gets the actions list from For instance,
The mechanism should be the same for Harvester's schemas |
I think I found the root cause, @torchiaf @Yu-Jack Thanks for stepping in here. It helped me gain a better understanding of the Harvester architecture. |
Signed-off-by: Yi-Ya Chen <[email protected]>
Thanks Yiya, so I would change the function like this:
and test the action as cluster member user |
Summary
For security concern, cluster member role user should not be able to delete node on Harvester Hosts page.
PR Checklists
Related Issue
[BUG] Cluster member role user should not be able to delete node on Harvester Hosts page on Rancher managed Harvester #7255
Test screenshot/video
if current user is
cluster-owner
if current user is
cluster-member
Extra technical notes summary
Test with
API=https://rancher.192.168.0.141.sslip.io yarn dev