Replies: 2 comments 10 replies
-
Indeed, the filter built by SecurityDomain works in such a way as to put the various domains in {
securityDomain: {
userId: [
"628f7deaf6c13488b29797a0",
],
roleCode: [
"USER",
],
},
} will be built in: { $or: [{ userId: { $in: ["628f7deaf6c13488b29797a0"] } }, { roleCode: { $in: ["USER"] } }] } I guess that makes more sense to built it between { $and: [{ userId: { $in: ["628f7deaf6c13488b29797a0"] } }, { roleCode: { $in: ["USER"] } }] } As for update and delete: it is correct that the operation is successful because we do not check the original filter, however the original filter is put in |
Beta Was this translation helpful? Give feedback.
-
In other words, a user should not be able to update fields that are in at
least one security domain of an entity.
It makes sense to me, but we can check if it is general enough to be added
to the framework.
Il Ven 27 Mag 2022, 18:54 Atlinx ***@***.***> ha scritto:
… I'm not too familiar with the Typetta internals but maybe you need to have
a check for whether the changes for the update operation abide by the
permissions?
—
Reply to this email directly, view it on GitHub
<#214 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD7YBAVBWVGSHB3JFZMD2DVMD43ZANCNFSM5XCVFO3Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Problem
I have this security setting for one of my models:
I have this security context generated for a query
And this is the operation domain, which is specified by the user on every request
However, I'm allowed to query for user roles whose roleCode matches but whose userId doesn't match. Additionally, users are able to update their existing roles to a higher roleCode, despite the roleCode not existing in their securityContext. Finally, users can delete roles they have from others.
Summary
BROKEN
Users can query for roles that aren't theirs.
BROKEN
Users can promote their roles by updating their roleCode to something that isn't in their security context:
BROKEN
Users can delete all roles that match only the roleCode, meaning they can remove their own roles from others
WORKS
User cannot create a new role that's not in their security context
Beta Was this translation helpful? Give feedback.
All reactions