Design and code implementation to achieve RBAC capabilities in current framework.
Principal roadmap #3287.
Tasks: - [X] Implement RBAC framework module - [x] Implement RBAC module unit tests
该提问来源于开源项目:wazuh/wazuh
Design and code implementation to achieve RBAC capabilities in current framework.
Principal roadmap #3287.
Tasks: - [X] Implement RBAC framework module - [x] Implement RBAC module unit tests
该提问来源于开源项目:wazuh/wazuh
Status update
Today I have been working in the implementation of RBAC capabilities for the new API
matches_privileges to be used in API controllers as in example below:rbac.py function get_user_permissions to obtain and format user permissions from the jwt tokenrbac.py function get_required_permissions to obtain and format required permissions to execute the requestrbac.py function match_pairs to match user and required permissions to allow or deny execution of the requestjwtmatch_pairs function to reduce nested loopsmatch_pairs function to include black_list and white_list modespython
(actions=['decoder:get'], resources='decoder:name:some')
def get_decoders(pretty: bool = False, wait_for_complete: bool = False, offset: int = 0, limit: int = None,
sort: str = None, search: str = None, file: str = None, path: str = None,
status: str = None):
root:/# curl -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3YXp1aCIsImlhdCI6MTU1ODYwNTA5NCwiZXhwIjoxNTU4NjA1Njk0LCJzdWIiOiJmb28iLCJyYmFjIjpbeyJhY3Rpb25zIjpbImRlY29kZXI6Z2V0Il0sInJlc291cmNlcyI6WyJkZWNvZGVyOm5hbWU6YWxsIl0sImVmZmVjdCI6ImRlbnkifV19.w7DDO94PwA4hTkusRh6WYuZgO5jqHUSKbabMLKSdsN4" "http://localhost:55000/decoders"
{
"code": 4000,
"dapi_errors": {},
"detail": "Permission denied",
"remediation": "Please, make sure you have permissions to execute current request, for more information on setting up permissions please visit XXXX",
"status": 500,
"title": "Wazuh Internal Error",
"type": "about:blank"
}
* as a resource id to matching capabilitiesrback.py