Skip to content
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

Show only exposed schemas to which the user has access in error message #3824

Open
laurenceisla opened this issue Dec 18, 2024 · 1 comment
Labels
enhancement a feature, ready for implementation messages user-facing error/informative messages

Comments

@laurenceisla
Copy link
Member

Problem

When a user uses an incorrect schema, it returns the error message with all exposed schemas:

$ curl 'localhost:3000/todos' -H 'Accept-Profile: wrong'

{
  ...,
  "message": "The schema must be one of the following: api, auth_api"
}

For this example, the anon user has not USAGE access to the auth_api schema, but it's still shown.

Solution

It's expected that any exposed schema is already accessible by any request (the burden is on the dev to secure it), but it wouldn't hurt to show only the allowed schemas for the specific role in the error message, i.e.:

$ curl 'localhost:3000/todos' -H 'Accept-Profile: wrong'

{
  ...,
  "message": "The schema must be one of the following: api"
}

Adding the usage to the cached user profile and using it to filter the schemas should do it:

queryRoleSettings :: PgVersion -> Bool -> Session (RoleSettings, RoleIsolationLvl)
queryRoleSettings pgVer prepared =

@laurenceisla laurenceisla added idea Needs of discussion to become an enhancement, not ready for implementation messages user-facing error/informative messages labels Dec 18, 2024
@steve-chavez
Copy link
Member

I don't see harm in providing a bit of security through obscurity.

@steve-chavez steve-chavez added enhancement a feature, ready for implementation and removed idea Needs of discussion to become an enhancement, not ready for implementation labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement a feature, ready for implementation messages user-facing error/informative messages
Development

No branches or pull requests

2 participants