Repository navigation
fix(jira): widen connection token column to text so long tokens are not truncated - #9335
Open
RyoKusnadi wants to merge 1 commit into
Open
RyoKusnadi wants to merge 1 commit into
RyoKusnadi wants to merge 1 commit into
Conversation
…ot truncated Signed-off-by: Ryo Kusnadi <ryokusnadi@gmail.com>
3 tasks done
Contributor
Author
|
@klesh friendly ping on this one when you have a moment. Happy to change anything. |
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
Problem: A Jira Cloud connection that uses a long token (for example a scoped service-account token) passes Test Connection, but fails after it is saved. Opening the connection or its data scopes returns HTTP 500 with
illegal base64 data at input byte 252.How it happens: The token is stored encrypted and base64 encoded, which makes it longer than the plain token. The
tokencolumn of_tool_jira_connectionsisvarchar(255), so the saved value is cut off (or the write is rejected on strict MySQL modes). Reading it back, theencdecserializer cannot decode the cut value. Test Connection works because it uses the token from the request, not the database.Cause:
helper.AccessToken.Tokenhas no explicit column type (backend/helpers/pluginhelper/api/connection_auths.go), so the column was created asvarchar(255).Fix: Add a Jira migration
20261104_change_connection_token_to_text.gothat changes_tool_jira_connections.tokentotext, usingModifyColumnTypeas other plugins do (for example GitHub20260819_expand_text_columns.go). Changing the sharedAccessTokentag would not touch existing tables, so a per-plugin migration is needed anyway.Scope: Other plugins that embed
helper.AccessToken(gitee, incidentio, testmo, pagerduty, circleci, grafana_irm, linear, clickup, youtrack, bamboo, github, tempo, rootly, opsgenie, slack, sonarqube) could have the same limit. I left them out to keep this PR to the reported Jira case; I can follow up if the maintainers want it.password(basic auth) is alsovarchar(255)but those values are short. Connections that already saved a cut token must have the token entered again.Testing: Added
TestChangeConnectionTokenToText. It checks thatUpcallsModifyColumnType("_tool_jira_connections", "token", "text")and that the script is registered inAll(). Before registering, it failed withmigration version 20261104120000 is not registered. After, it passes. Rango vet ./plugins/jira/models/...,go test ./plugins/jira/models/...,gofmt -l. The migration itself was not run against a real MySQL or Postgres database, and the full suite and e2e tests were not run.Risk: Low. Only the Jira token column type changes (
MODIFY COLUMN ... text). Existing values are kept. Rolling back means changing the column back tovarchar(255), which would cut long tokens again.Does this close any open issues?
Closes #9328
Other Information
None.