Skip to content

ARGO-5877 ams: introduce hashed auth tokens - #534

Merged
kaggis merged 1 commit into
ARGOeu:develfrom
agelostsal:feature/enahnce-token-storage
Aug 31, 2026
Merged

ARGO-5877 ams: introduce hashed auth tokens#534
kaggis merged 1 commit into
ARGOeu:develfrom
agelostsal:feature/enahnce-token-storage

Conversation

@agelostsal

@agelostsal agelostsal commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

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.

@agelostsal
agelostsal force-pushed the feature/enahnce-token-storage branch from 873d2a3 to 5798226 Compare August 24, 2026 12:56
@agelostsal
agelostsal force-pushed the feature/enahnce-token-storage branch from 5798226 to 973e2c5 Compare August 30, 2026 18:50
@kaggis
kaggis merged commit 0a9d3de into ARGOeu:devel Aug 31, 2026
2 checks passed
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.

2 participants