Repository navigation
fix: widen api_keys.key_prefix from 12 to 20 chars - #83
Merged
Merged
Conversation
M13 (live/test key prefixes) changed the stored prefix to
len("omni_sk_live_"/"omni_sk_test_") + 4 display chars = 17 characters,
but never widened this column from its pre-M13 size of 12 (sized for
the plain "omni_sk_XXXX" scheme).
Impact: every real key creation against a real MySQL database has
failed with "Data too long for column 'key_prefix'" since M13 shipped.
SQLite enforces no VARCHAR length limit at all, so the existing
(SQLite-backed) test suite never caught this -- found while testing a
real account's "Create key" flow against a live MySQL-backed stack.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Two tests pinned the full-upgrade alembic_version to the previous head (0028_auth_audit_integrity); update both to the new head this branch adds (0029_widen_api_key_prefix). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
M13 (live/test key prefixes) changed the stored prefix to
len("omni_sk_live_"/"omni_sk_test_") + 4display chars = 17 characters, but never widened this column from its pre-M13 size of 12 (sized for the plainomni_sk_XXXXscheme).Impact: every real key creation against a real MySQL database has failed with
Data too long for column 'key_prefix'since M13 shipped. SQLite enforces no VARCHAR length limit at all, so the existing (SQLite-backed) test suite never caught this -- found while testing a real account's "Create key" flow against a live MySQL-backed stack.Test plan
pytest tests/test_apikeys.py tests/test_me_api_keys.py tests/test_apikey_exchange.py -q-- 50 passedalembic heads-- single head, chain intactDataErrordirectly against the live stack before fixing, confirmedALTER TABLE api_keys MODIFY COLUMN key_prefix VARCHAR(20)+ model change resolves it (full round trip: license login -> create key -> succeeds)🤖 Generated with Claude Code