ARGO-5877 ams: introduce hashed auth tokens - #534
Merged
Conversation
agelostsal
force-pushed
the
feature/enahnce-token-storage
branch
from
August 24, 2026 12:56
873d2a3 to
5798226
Compare
agelostsal
force-pushed
the
feature/enahnce-token-storage
branch
from
August 30, 2026 18:50
5798226 to
973e2c5
Compare
kaggis
approved these changes
Aug 31, 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.
User API tokens were stored (and matched) in plaintext. This PR introduces a hashed token field (token_v2) alongside token and switches the auth read path to look up by hash with a temporary fallback to the legacy plaintext field. A backfill script populates token_v2 for existing users that will be run on the relevant mongodb clusters by the admin. The API contract is unchanged ,the plaintext token is still what users present at the door and what token-generation endpoints return.
In order to properly log fallback attempts in the DB layer, we needed to introduce a trace_id context propagation fix. All non-handler log lines were emitting trace_id="". Root cause was a context.Context key-type mismatch: producers wrote with a typed key (ContextStringValue), consumers read with a raw string. Go's context matches on (type, value), so no lookup ever resolved. Fixed by moving the key into a new leaf package tracectx with an unexported struct-typed key and helpers, wired through every producer and consumer.