-
-
Notifications
You must be signed in to change notification settings - Fork 731
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
user.Manager: fix ACL write, read order #917
Conversation
This should fix "read-only access to topic *" being applied before "read-write access to topic _PREFIX_*" Before this if we have: ntfy access user "mytopic*" rw ntfy access user "*" ro read-only access rule was applied first and user couldn't write to mytopic*
This PR still does not solve the following case
The user will still be able to write into Maybe query should be something like that selectTopicPermsQuery = `
SELECT read, write
FROM user_access a
JOIN user u ON u.id = a.user_id
WHERE (u.user = ? OR u.user = ?) AND ? LIKE a.topic ESCAPE '\'
ORDER BY u.user DESC, LENGTH(a.topic) DESC, a.write DESC
` For each user, we should test in order |
For each user, we should test in order `THE_LONGEST_RULE`->`WRITE_PERMISSION`
Can you add a bunch of unit tests to check these cases? I don't want to just yolo merge this. |
Add new test for user john The user should have: "deny" to mytopic_deny*, "ro" to mytopic_ro*, "rw" to mytopic*, "ro" to the rest
A new test was added, and some old tests had to be rearranged to follow the new rules chain Longest->Shortest. P.S.
|
I don't know how fast the |
I would like to apologize for not addressing this earlier. I am looking at your solution now, and I'm trying to understand the root cause. Thank you for the tests and all the work. It is much appreciated!! |
This should fix
read-only access to topic *
being applied beforeread-write access to topic _PREFIX_*
Before this if we have:read-only access rule was applied first and user couldn't write to mytopic*
See #914