[20.0][MIG] auth_oidc: Migration to 20.0 #1036
Tested this branch against a real Odoo 20.0 + Keycloak 26 deployment.
Sharing the results since the PR has no review activity yet.
Environment
pkce.code.challenge.method = S256python-jose 3.5.0 installed in the venvauth_oidc, auth_oauth, auth_signupResults
| Scenario | Outcome |
|---|---|
| Valid credentials via authorization code flow | PASS — session established, preferred_username mapped to res.users.login |
| Wrong password | PASS — rejected at the IdP, no session created |
| Cross-client authorization code replayed against /auth_oauth/signin | PASS — rejected |
The third case is the one I care most about. Implicit-flow tokens are
accepted without an audience check, so the code flow closes a real gap:
the exchange now happens server-side with Odoo's own client_id, and a
code issued to a different client cannot be turned into a token.
Installation notes for anyone else testing
Two things tripped me up, both worth documenting in the README:
1. Manifest version. Testing the 19.0 branch on 20.0 requires bumping
"version": "19.0.1.0.0" to "20.0.1.0.0" first. check_version()
compares the major prefix and silently sets installable=False
otherwise — the module shows in the list but cannot be installed, with
only a warning in the log.
2. werkzeug.urls.url_decode / url_encode were removed in Werkzeug 3.
The import in controllers/main.py looks broken when tested standalone,
but works at runtime because Odoo 20 patches those names back into
werkzeug.urls from odoo/init.py via _monkeypatches/werkzeug.py.
Worth a comment so nobody "fixes" a non-issue.
One issue found while testing
code_verifier is still a stored field on auth.oauth.provider
(models/auth_oauth_provider.py:41), generated once at provider creation
and never rotated. Since it is read in two places that must agree
(controllers/main.py:35 for the challenge, models/res_users.py:36 for
the token request), every user in a realm shares the same PKCE verifier.
That defeats the point of PKCE: RFC 7636 §5.1 asks for a fresh verifier per
authorization request, and the protection comes from an attacker not being
able to pair a captured code with the matching verifier. A single shared
value stored in the database gives that away to anyone who can read the
table (admin accounts, read-only reporting users, database backups).
I have a separate fix prepared and will open it against 19.0 and 20.0 —
happy to adjust the approach if you would prefer a different shape.
Scope of what I did not test: enterprise modules beyond the base
authentication stack, multi-company, portal users, coexistence withauth_ldap / auth_totp, and logout. This comment only covers the
authentication path.
— Zamba Lee (tested with Claude Code)
Functional review on Odoo 20.0 Community (nightly 20261110). We use this module in production on 19.0 with the authorization code flow.
The 10 tests pass, no warnings from the module in the log.
End to end in a browser against a small local OpenID Connect provider (authorization code flow, RS256 id_token, JWKS endpoint, PKCE checked on the provider side):
response_type=code, nonce, code_challenge with S256 and the scope.code_verifier that matches the challenge.id_token: the user is logged in, matched on sub.id_token signed with another key: rejected ("Signature verification failed"), no session.id_token for another audience: rejected ("Invalid audience"), no session.LGTM.
Can we merge this please?
I think we should add PRs which are missing in previous versions versions but were added in 16.0.
https://github.com/OCA/server-auth/pull/857/
https://github.com/OCA/server-auth/pull/595/
https://github.com/OCA/server-auth/pull/797/
https://github.com/OCA/server-auth/pull/650/
bm1-phillip
micheledic
No description provided by author.