Repository navigation
Conversation
…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.
Store only the SHA-256 of a key instead of the key itself, so that
reading the table, a backup or a restored dump does not give usable
keys. Keys are long random values: a fast hash is enough and the lookup
becomes an indexed search instead of a loop over all the keys.
* Enabled by default, optional ("Store API keys hashed" in the settings).
Enabling it also hashes the keys already stored.
* Keys stored in plain text keep working, so a database can be switched
progressively.
* The upgrade disables it on databases already having keys, as code
reading the keys would break.
* auth_api_key_server_env never hashes: the key comes from the
environment.
* The neutralization clears the hash too.
This was referenced Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on/includes:
Store only the SHA-256 of an API key instead of the key itself, so that reading the table, a backup or a restored dump does not give usable keys. Keys are long random values: a fast hash is enough, and the lookup becomes an indexed search instead of a loop over all the keys.
auth.api.key.keywould break. Administrators opt in.auth_api_key_server_envnever hashes: the key comes from the environment.Note: with hashing enabled,
keyreads back as a placeholder after creation, so tests that create a key and read it back must use the value they passed.