fix: increase secret value column from VARCHAR(255) to TEXT#6180
Open
DragonBot00 wants to merge 2 commits intokeephq:mainfrom
Open
fix: increase secret value column from VARCHAR(255) to TEXT#6180DragonBot00 wants to merge 2 commits intokeephq:mainfrom
DragonBot00 wants to merge 2 commits intokeephq:mainfrom
Conversation
When SECRET_MANAGER_TYPE=db, the secret.value column was defined as VARCHAR(255) via SQLModel's default str mapping, causing OAuth tokens and other secrets longer than 255 characters to be silently truncated. Changed to sa.Text (unlimited length) to fix the truncation issue. Fixes keephq#5353
Alembic migration to ALTER the secret table's value column from VARCHAR(255) to TEXT, fixing truncation of long OAuth tokens. Fixes keephq#5353
|
@DragonBot00 is attempting to deploy a commit to the KeepHQ Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
Fix: Increase
secret.valuecolumn from VARCHAR(255) to TEXTProblem
Fixes #5353
When
SECRET_MANAGER_TYPE=db, thesecret.valuecolumn in theSecretSQLModel was defined asvalue: str, which SQLModel maps toVARCHAR(255)by default. This causes any secret value exceeding 255 characters (such as OAuth access tokens, refresh tokens, or JWT tokens) to be silently truncated at the database level.Root Cause
In
keep/api/models/db/secret.py, thevaluefield lacked an explicit SQLAlchemy column type:Solution
Explicitly set the column type to
sa.Text(unlimited length):Changes
keep/api/models/db/secret.py— Changedvaluefield to usesa.Textinstead of the implicitVARCHAR(255).keep/api/models/db/migrations/versions/2026-04-01-07-55_a1b2c3d4e5f6.py— Added Alembic migration toALTER TABLE secret ALTER COLUMN value TYPE TEXTon existing deployments.Testing
Secrettable will be created with aTEXTcolumn forvalue.alembic upgrade headwill apply the migration and widen the column with no data loss.Impact