Skip to content

Commit 923b5d9

Browse files
authored
Always allow access to __edgedbsys__ to all roles (#9059)
This ensures that roles can enumerate the branches.
1 parent fa0ae90 commit 923b5d9

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

edb/server/protocol/frontend.pyx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ from edgedb import scram
2626

2727
from edb import errors
2828
from edb.common import debug
29+
from edb.server import defines
2930
from edb.server import args as srvargs, metrics
3031
from edb.server.pgcon import errors as pgerror
3132

@@ -648,7 +649,11 @@ cdef class FrontendConnection(AbstractFrontendConnection):
648649
if not role:
649650
raise errors.AuthenticationError('authentication failed')
650651
branches = role['branches']
651-
if '*' not in branches and database not in branches:
652+
if (
653+
'*' not in branches
654+
and database not in branches
655+
and database != defines.EDGEDB_SYSTEM_DB
656+
):
652657
raise errors.AuthenticationError(
653658
f"authentication failed: user does not have permission for "
654659
f"database branch '{database}'"

tests/test_server_auth.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ async def test_server_auth_01(self):
9595
database='auth_failure',
9696
)
9797

98+
# __edgedbsys__ on a role with a whitelist -- should still work
99+
syscon = await self.connect(
100+
user='foo',
101+
password='foo-pass',
102+
database='__edgedbsys__',
103+
)
104+
await syscon.aclose()
105+
98106
body, code = await self._basic_http_request(
99107
None, 'foo', 'foo-pass', db='auth_failure')
100108
self.assertEqual(code, 401, f"Wrong result: {body}")

0 commit comments

Comments
 (0)