0

Is there a way to remove access to all system information functions for a given user (which is already limited to read only access) in Postgres?

For example, a user could normally run pg_conf_load_time() or SELECT current_setting('datestyle');.

Normally you could do do

REVOKE ALL ON FUNCTION current_setting(text) FROM my_user;

but I get no privileges could be revoked for "current_setting".

Is there a way to disallow access to all functions on these pages?

Laurenz Albe
62.1k4 gold badges57 silver badges93 bronze badges
asked Oct 3, 2019 at 11:23

1 Answer 1

2

You would have to

REVOKE EXECUTE ON FUNCTION ... FROM PUBLIC;

because that's the default privilege for functions.

Revoking a privilege that was not granted is a no-op in SQL.

After revoking the privilege from PUBLIC, you'd have to explicitly grant it to all users that should have it.

But I think you shouldn't do that.

Why not?

  1. These modifications will not survive a major upgrade.

  2. PostgreSQL does not consider this information security critical, and I think that is correct.

    Everybody should be able to see the settings relevant for the session.

    Note that certain parameters that reveal details about the operating system where PostgreSQL is running are only visible to superusers or members of the pg_read_all_settings role anyway.

  3. You may break applications that rely on these functions.

answered Oct 3, 2019 at 11:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.