/rpc/functions callable from web_anon (security issue?) #1741
-
Environment
Description of issueExpected behaviorThe route GET /rpc/uuid_generate_v4 should not be callable by an anonymous user. Actual behaviorThe route GET /rpc/uuid_generate_v4 can be called by an anonymous user and delivers a generated UUID. SetupI did a setup following the documentation, one user "authenticator" that can switch to "web_anon". web_anon has no permissions whatsoever. docker envs for postgrest: I also enabled the uuid-ossp extension in postgres. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is a postgres permissions thing. Any endpoint that the anonymous user has privileges for will be accessible. The public schema is accessible by any postgres user by default - and any function in that schema will be callable for the anonymous user. Here are some guidelines for how to prevent that:
Alternatively you can just revoke privileges from the public schema. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for the helpful advice! |
Beta Was this translation helpful? Give feedback.
This is a postgres permissions thing. Any endpoint that the anonymous user has privileges for will be accessible. The public schema is accessible by any postgres user by default - and any function in that schema will be callable for the anonymous user.
Here are some guidelines for how to prevent that:
db-schema
. Use another schema specifically created for it, e.g.api
.db-schema=api
, you can install those extensions into public. This will prevent the exposure of many of the functions of that extension as RPCs.db-extra-search-path=public
to be able to access those extensions without pr…