Firebird 4.0: Disabling PUBLIC Role Membership to Prevent Accidental Public Access
0 reputation · 18 Mar 2020, 01:52 UTC
0 reputation · 18 Mar 2020, 01:52 UTC
Prevent unintended exposure of database objects by controlling the default PUBLIC role in Firebird 4.0.
The PUBLIC role is automatically granted to every user and cannot be revoked. Only privileges granted to PUBLIC can be revoked, which may break existing applications that rely on implicit PUBLIC rights. Firebird’s current configuration offers no toggle to disable PUBLIC role membership or to restrict its privileges automatically.
Firebird 4.0’s firebird.conf defaults to RemoteAccess=yes, exposing the server on port 3050 to any reachable host. Even with RemoteAccess disabled, a broad PUBLIC privilege set can still grant access to newly created users.
RemoteAccess setting interact with PUBLIC role privileges when the server is exposed to external networks?35775 reputation · 18 Mar 2020, 08:38 UTC
In Firebird 4.0 the PUBLIC role is built‑in and cannot be disabled or revoked. The only thing you can control is the set of privileges that are granted to PUBLIC. To prevent accidental public exposure you must revoke those privileges and, if your applications rely on implicit PUBLIC rights, replace them with explicit roles that you grant to users.
firebird.conf that turns PUBLIC off.REVOKE.Run the following in isql to list all objects that currently have PUBLIC privileges:
SHOW GRANTS FOR PUBLIC;
Document which privileges (SELECT, INSERT, UPDATE, DELETE, EXECUTE) appear.
For each object, revoke the privilege you want to restrict:
REVOKE SELECT ON <table> FROM PUBLIC;
REVOKE EXECUTE ON <procedure> FROM PUBLIC;
Repeat until no unwanted PUBLIC rights remain.
Define roles that encapsulate the privileges your applications need:
CREATE ROLE app_reader;
GRANT SELECT ON <table> TO app_reader;
Grant the role to the intended users:
GRANT app_reader TO <user>;
Connect as a user that only has the explicit role and confirm that the application behaves as expected. Verify that a user without the role cannot access the object.
Setting RemoteAccess=no in firebird.conf limits the server to local connections only. It does not alter PUBLIC privileges, so use it as a network hardening step in addition to the privilege changes.
SHOW USER to verify role memberships and ensure that PUBLIC still appears automatically.To refine this recommendation, could you share which specific privileges (e.g., SELECT on EMPLOYEES, EXECUTE on PROC_UPDATE) are currently granted to PUBLIC in your database? This will help determine whether a role‑based replacement is necessary or if revoking the privilege alone suffices.
Use comments to ask for clarification. Post a solution as an answer.
35,775 reputation · 18 Mar 2020, 13:04 UTC
Setting RemoteAccess=no only stops the server from listening on port 3050; it does not change the fact that every user is still a member of the PUBLIC role. PUBLIC privileges are evaluated for every connection, regardless of the network exposure.
RDB$ROLE_PRIVILEGES to see what PUBLIC actually owns.REVOKE … FROM PUBLIC before adding explicit roles.CREATE ROLE app_user; and GRANT app_user TO ; to give only the needed rights.Remember to test the new model in a staging environment and back up the database before making bulk changes.