Skip to content

Commit

Permalink
Fix auth_jwt under Cython 3 (#7986)
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix authored Nov 14, 2024
1 parent 30490ad commit c6e249c
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .github/workflows.src/tests.inc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
id: ext-cache
with:
path: build/extensions
key: edb-ext-v5-${{ hashFiles('shared-artifacts/ext_cache_key.txt') }}
key: edb-ext-v6-${{ hashFiles('shared-artifacts/ext_cache_key.txt') }}

- name: Handle cached PostgreSQL build
uses: actions/cache@v4
Expand Down Expand Up @@ -195,7 +195,7 @@
if: steps.ext-cache.outputs.cache-hit != 'true'
with:
path: ${{ env.BUILD_TEMP }}/edb
key: edb-ext-build-v3-${{ hashFiles('shared-artifacts/ext_cache_key.txt') }}
key: edb-ext-build-v4-${{ hashFiles('shared-artifacts/ext_cache_key.txt') }}

- name: Build Cython extensions
env:
Expand Down Expand Up @@ -377,7 +377,7 @@
id: ext-cache
with:
path: build/extensions
key: edb-ext-v5-${{ hashFiles('shared-artifacts/ext_cache_key.txt') }}
key: edb-ext-v6-${{ hashFiles('shared-artifacts/ext_cache_key.txt') }}

- name: Restore compiled parsers cache
uses: actions/cache@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests-ha.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .github/workflows/tests-inplace.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions .github/workflows/tests-managed-pg.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .github/workflows/tests-patches.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .github/workflows/tests-pg-versions.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .github/workflows/tests-pool.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions .github/workflows/tests-reflection.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions .github/workflows/tests.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion edb/server/protocol/auth_helpers.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


cdef extract_token_from_auth_data(bytes auth_data)
cdef auth_jwt(tenant, str prefixed_token, str user, str dbname)
cdef auth_jwt(tenant, prefixed_token, str user, str dbname)
cdef _check_jwt_authz(tenant, claims, token_version, str user, str dbname)
cdef _get_jwt_edb_scope(claims, claim)
cdef scram_get_verifier(tenant, str user)
Expand Down
2 changes: 1 addition & 1 deletion edb/server/protocol/auth_helpers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ cdef extract_token_from_auth_data(auth_data: bytes):
return scheme.lower(), payload.strip()


cdef auth_jwt(tenant, prefixed_token: str, user: str, dbname: str):
cdef auth_jwt(tenant, prefixed_token: str | None, user: str, dbname: str):
if not prefixed_token:
raise errors.AuthenticationError(
'authentication failed: no authorization data provided')
Expand Down
6 changes: 6 additions & 0 deletions tests/test_server_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ async def test_server_auth_jwt_1(self):
''')
await conn.aclose()

with self.assertRaisesRegex(
edgedb.AuthenticationError,
'authentication failed: no authorization data provided',
):
await sd.connect()

# bad secret keys
with self.assertRaisesRegex(
edgedb.AuthenticationError,
Expand Down

0 comments on commit c6e249c

Please sign in to comment.