| From: | cca5507 <cca5507(at)qq(dot)com> |
|---|---|
| To: | preTham <prezza672(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [PATCH] Why is_admin_of_role() uses ROLERECURSE_MEMBERS ratherthan ROLERECURSE_PRIVS? |
| Date: | 2025-12-22 12:35:00 |
| Message-ID: | tencent_9EA14A8563B54E29443236781807D9760008@qq.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
Thank you for your reply.
> PostgreSQL calls select_best_admin() internally. If that function returns
> InvalidOid, I think it means that “The system tried all the possible
> grantor roles (roles we belong to that have ADMIN OPTION), but none are
> currently usable.” i.e the system couldn’t find a grantor role in the
> current context, so it reports: "no possible grantors"
+1
> Again I think a “permission denied” would imply we tried as a specific
> role, and that role doesn’t have permission. But here, Postgres never even
> found which role we could be acting as. So from the system’s logic, it’s
> not a denied action; it’s “no valid takers found to even attempt the
> action.”
Due to the "revoke inherit option for u2 from u1", I think reporting "permission denied ..."
here is reasonable. The "no possible grantors" is more like an internal error, and should
not be reported to users.
> I believe is_admin_of_role() uses ROLERECURSE_MEMBERS because
> is_admin_of_role() is not used for permission enforcement and Its purpose
> is to answer checks like “does A have the ADMIN OPTION for B (anywhere in
> the membership graph)?” So it needs to see all possible relationships, even
> if the intermediate memberships are non-inheriting or currently inactive.
But many places report "permission denied ..." if is_admin_of_role() return false.
--
Regards,
ChangAo Chen
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nazir Bilal Yavuz | 2025-12-22 12:35:31 | Re: ditaa --svg option is missing when building doc/src/sgml/images |
| Previous Message | VASUKI M | 2025-12-22 12:25:57 | Re: [PATCH] psql: tab completion for ALTER ROLE ... IN DATABASE ... |