below query fetches information from. Query: select getpgusername(), current_database(), current_user, session_user, version(); how can we restrict the users from fetching these details. ?
First of all, those are mostly FUNCTIONS. you can deny access to them. But be careful as some are declared by the SQL standard. And if your "user" is an ORM... It might use them. you can find functions in PSQL with: \df *.getpgusername the HINT that they are functions is the () but some do not require the () because of the screwy SQL standard. You can probably find the right ALTER statement to REMOVE EXECUTE on them for a specific user. BUT TREAD LIGHTLY. Disabling things like this CAN have TERRIBLE unintended consequences. And it is likely that you are only blocking one way to get to that information. It may also be exposed in the information_schema.* views or functions...
Обсуждают сегодня