Skip to content

Conversation

@jesusVMayor
Copy link
Member

No description provided.

@OCA-git-bot
Copy link
Contributor

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

return validator._decode(token, secret=validator._get_jwt_cookie_secret())
secret = None
if validator.renew_cookie_on_response:
secret = validator._get_jwt_cookie_secret()
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this part. If we don't check that the cookie is signed with the expected secret, a malicious client could send a forged cookie, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, if renew_cookie_on_response is False, _decode will be called with secret=None, so the funcion will check the cookie with the secret or public key configured in the validator.

raise UnauthorizedCompositeJwtError(exceptions)

if validator.cookie_enabled:
if validator.cookie_enabled and validator.renew_cookie_on_response:
Copy link
Member

Choose a reason for hiding this comment

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

This completely disable the cookie setting mechanism is renew_cookie_on_response is not set, so that's probably not what you intended?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, is the idea. We need a flow where odoo only checks the cookie/header and validate against the secret/public key configured in the validator, we dont need the cookie to be setted again in the response

Copy link
Member

Choose a reason for hiding this comment

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

I don't get it, sorry. What will then set the cookie in the first place?

Copy link
Member Author

Choose a reason for hiding this comment

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

Another service in the same domain, the cookie can be shared, or odoo itself in a public controller who checks the credentials and sets the cookie.

Our goal is to implement a flow in the module where it only checks the token and give access to the endpoint.
This can be done with the token in the header, but is a problem with cookies, because odoo set it again with his own secret and also extends the expire time.

@jesusVMayor jesusVMayor force-pushed the 16.0_auth_jwt_cookie_renew_field branch from c480a25 to 2721a0c Compare July 21, 2025 12:55
@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 the stale PR/Issue without recent activity, it'll be soon closed automatically. label Nov 23, 2025
@github-actions github-actions bot closed this Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants