Skip to content

[18.0][IMP]auth_oidc: verify self-signed certificates#837

Open
ChristophAbenthungCibex wants to merge 1 commit intoOCA:18.0from
cibex:18.0-self_signed_verification
Open

[18.0][IMP]auth_oidc: verify self-signed certificates#837
ChristophAbenthungCibex wants to merge 1 commit intoOCA:18.0from
cibex:18.0-self_signed_verification

Conversation

@ChristophAbenthungCibex
Copy link

If the connection between odoo and an oauth provider uses self-signed certificates, a ssl error is thrown because the self-signed certificated cannot be verified.
Even if the user credentials are correct, the user will not get logged in.

Following error gets thrown:
requests.exceptions.SSLError: HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: /realms//protocol/openid-connect/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1000)')))

Steps to reproduce:

  1. Setup a oauth provider (for example keycloak)
  2. Setup odoo the oauth provider in odoo (used OpenID Connect (authorization code flow) as Auth Flow for my tests)
  3. Logout
  4. Try to login with the oauth provider
  5. Type in the correct credentials
  6. The oauth provider will redirect to Odoo
  7. Odoo shows an error message and the user is not logged in

@OCA-git-bot
Copy link
Contributor

Hi @sbidoul,
some modules you are maintaining are being modified, check this out!

Copy link
Contributor

@ap-wtioit ap-wtioit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good (just the missing space is a requirement for the PR to be correct from my point of view)

This is a useful addition for checking with local HTTPS were one cannot really get official certificates.

Copy link
Member

@sbidoul sbidoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. A couple a comment after a quick look.

string="Self-signed",
help="Disable certificate checks for server to server token requests "
"when using self signed certificates.",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this does not make it sufficiently clear that this enables an insecure option. Could we name this field, say, "insecure" like curl does?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with sbidoul. If we add this kind of feature we should add a big warning in the descripiton.md and add a reference here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. I renamed the fields and added a security note. Is that good enough?

string="Self-signed verify path",
help="Path to the self-signed certificate for the verification process. "
"Empty value disables the verification.",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would name this field ca_bundle, but I have a strong preference to let that be configured at the system level, or with the REQUESTS_CA_BUNDLE environment variable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me the benefit here would be that this is only for one OAuth server connection while REQUESTS_CA_BUNDLE is for all requests from Odoo to other servers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the attributes self_signed and self_signed_verify, how about only have ca_bundle, where you can add your valid self signed certificates (automatically used, when set), and a disable_certificate_check which bypasses the check. (same as self_signed=True + self_signed_verify="")

I think this would be more clear and less risky for false configurations.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I renamed the field as suggested by @CRogos . I agree that this way is less risky.

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added stale PR/Issue without recent activity, it'll be soon closed automatically. and removed stale PR/Issue without recent activity, it'll be soon closed automatically. labels Jan 11, 2026
@ChristophAbenthungCibex ChristophAbenthungCibex force-pushed the 18.0-self_signed_verification branch from 02e4c85 to 0bd90c3 Compare February 11, 2026 08:17
Copy link
Contributor

@CRogos CRogos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation LGTM.
I am not sure if the merge commit is a problem, or if it would be better to rebase your changes.

Could you also add some tests for your changes?

@ChristophAbenthungCibex ChristophAbenthungCibex force-pushed the 18.0-self_signed_verification branch from 66ea4f0 to 2be0600 Compare February 11, 2026 08:56
@ChristophAbenthungCibex
Copy link
Author

ChristophAbenthungCibex commented Feb 11, 2026

Implementation LGTM. I am not sure if the merge commit is a problem, or if it would be better to rebase your changes.

Could you also add some tests for your changes?

I rebased it.

I'll check if I can add tests.

@ChristophAbenthungCibex ChristophAbenthungCibex force-pushed the 18.0-self_signed_verification branch from 2be0600 to 1199ee9 Compare February 11, 2026 09:06
If the connection between odoo and an oauth provider uses self-signed certificates, a ssl error is thrown because the self-signed certificated cannot be verified.
@ChristophAbenthungCibex ChristophAbenthungCibex force-pushed the 18.0-self_signed_verification branch from 1199ee9 to 5b22d17 Compare February 11, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants