Just use [`REVOKE`](https://www.postgresql.org/docs/current/static/sql-revoke.html) to control the permissions Postgres assigns to roles.

Documentation:

>The `REVOKE` command revokes previously granted privileges from one or more roles. The key word `PUBLIC` refers to the implicitly defined group of all roles.

>See the description of the [`GRANT`](https://www.postgresql.org/docs/current/static/sql-grant.html) command for the meaning of the privilege types.

    CREATE FUNCTION nocando()
    RETURNS void AS $$
      SELECT null::void
    $$ LANGUAGE sql;
    
    REVOKE ALL
      ON FUNCTION nocando ()
      FROM PUBLIC ;