← Back to Pull requests

[20.0][MIG] auth_oidc: Migration to 20.0 #1036

Open
micheledic opened this pull request with 4357 lines diff across 35 files
View on GitHub
micheledic micheledic commented on Oct 12, 2026 10:40 UTC
Author

No description provided by author.

Diff: 4357 lines (+4357 / -0) across 35 files Reviewer: bm1-phillip Review duration: 71642m
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.96) × (1 − Review Confidence (0.75)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.96 · 4357 lines diff across 35 files
0.96
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.58 · 3 substantive comment(s)
0.58
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
74%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.400
Sensitive Paths sensitive_paths
0.096
Mass File Touch mass_file_touch
0.080
Empty Description empty_description
0.060
Real PR Conversation Timeline
5 items
zambalee zambalee commented on Nov 01, 2026 13:59 UTC
Contributor

Tested this branch against a real Odoo 20.0 + Keycloak 26 deployment.
Sharing the results since the PR has no review activity yet.

Environment

  • Odoo 20.0 (branch 20.0), Python 3.12

  • Keycloak 26, confidential-free setup: public client, standard flow only,

  • pkce.code.challenge.method = S256
  • python-jose 3.5.0 installed in the venv

  • Installed onto a fresh database with auth_oidc, auth_oauth, auth_signup
  • Results

    | 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 with
    auth_ldap / auth_totp, and logout. This comment only covers the
    authentication path.

    — Zamba Lee (tested with Claude Code)

    bm1-phillip bm1-phillip approved these changes on Nov 10, 2026 12:19 UTC
    Approved Reviewer

    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):

  • The authorize request carries response_type=code, nonce, code_challenge with S256 and the scope.

  • The token request sends a code_verifier that matches the challenge.

  • Valid 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.

    1ukastesar 1ukastesar commented on Nov 16, 2026 21:06 UTC
    Contributor

    Can we merge this please?

    CRogos CRogos commented on Nov 23, 2026 21:01 UTC
    Contributor
    Reviewers
    Assignees
    micheledic micheledic
    Labels
    risk: low confidence: 74.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 96% (HIGH) · Higher = larger blast radius
    96%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 74.5% · Lower = rushed or shallow review
    74.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.5% · Safe to merge
    24.5%