Skip to content

[18.0][FIX] auth_api_key: revoke keys immediately and do not leak them in errors - #1086

Merged
OCA-git-bot merged 1 commit into
OCA:18.0from
camptocamp:18-imp-auth_api_key-revocation-errors
Dec 1, 2026
Merged

OCA-git-bot merged 1 commit into
OCA:18.0from
camptocamp:18-imp-auth_api_key-revocation-errors

Conversation

@simahawk

@simahawk simahawk commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Hardening of auth_api_key, first of three independent-in-scope steps.

  • A deleted or archived key kept working until the key cache was cleared (cleared only on create and on writes of key/user_id). The cache is now also cleared on unlink and when a key is (un)archived.
  • The error for an unknown key contained the submitted key (so it ended up in logs and error pages, and a mistyped or rotated key is almost a valid one). It no longer does, and the message is now really translatable (it was an f-string inside _()).
  • An unknown key raised a ValidationError out of the auth method instead of answering 401 like a missing key. It now answers 401 and the log reports the caller address (not the key).

…rrors

* Clear the key cache on unlink and when a key is (un)archived, so a
  deleted or archived key stops working right away instead of when the
  cache happens to be cleared.
* The error for an unknown key no longer contains the submitted key
  (it ended up in logs and error pages) and the message is translatable.
* An unknown key now answers 401, like a missing one, instead of a user
  error, and the failure log reports the caller address.
@simahawk

simahawk commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/ocabot merge patch

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 18.0-ocabot-merge-pr-1086-by-simahawk-bump-patch, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit b2a309b into OCA:18.0 Dec 1, 2026
12 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at dc31a0c. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants