Switching default instance silently invalidates user sessions with no notice or re-auth prompt
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- go
- Domain
- authentication, backend
Research direction
Start in server/instance.go at setDefaultInstance, then read server/configuration.go and server/plugin.go to trace how the active instance changes and how user tokens are stored. Check the connection and status paths that use those tokens. Done means users are told to reconnect after a default switch and invalid tokens produce a reconnect prompt; the issue names no tests to run.
Written by the indexing model from the issue text.
Description
Summary
When an administrator switches the default GitLab instance using /gitlab instance set-default <name>, all currently connected users' OAuth tokens become invalid against the new instance. However, no notification, broadcast, or token invalidation occurs, leaving users with broken slash commands and silent notification failures.
Steps to Reproduce
- Have two instances installed (
instance-aandinstance-b), withinstance-aas the default. - Users connect their accounts via
/gitlab connect(storing tokens issued byinstance-a). - An administrator switches the default instance using
/gitlab instance set-default instance-b. - A connected user runs
/gitlab me,/gitlab todo, or creates an issue.- Result: Commands fail with
401 Unauthorizedor token errors because the plugin passesinstance-atokens toinstance-b.
- Result: Commands fail with
Expected Behavior
- When the default instance changes, connected users should receive a notification (or a system message in Town Square / DM) informing them that the active instance changed to
<name>(<url>) and prompting them to reconnect via/gitlab connect. - The user profile / status check should recognize that stored tokens do not match the active instance and display a disconnected / reconnect prompt instead of raw API errors.
Root Cause / Code References
server/instance.go:setDefaultInstanceonly mutatesconfig.DefaultInstanceNameand callsp.refreshEffectiveInstance().
server/configuration.go:refreshEffectiveInstancere-resolves the internal API client and command autocomplete, but does not notify users or inspect stored user tokens.
server/plugin.go:- Stored tokens in KV (
<userID>_userinfoand<userID>_gitlabtoken) are global to the Mattermost user and lack instance metadata, meaning the plugin blindly sends the prior instance's token to the newly selected instance.
- Stored tokens in KV (
Proposed Fix
- In
setDefaultInstance, notify connected users or post a broadcast message alerting them to reconnect to the new default instance. - In user connection verification, check token validity against
/api/v4/useron the active instance and guide the user to reconnect if a401 Unauthorizedis encountered.
- Dominant language
- JavaScript
- Stars
- 158
- Forks
- 97
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 21
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mattermost/mattermost-plugin-gitlab
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
mattermost/mattermost-plugin-gitlab#746 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
mattermost/mattermost-plugin-gitlab#738 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 1-2 days Newbie friendliness 53/100
mattermost/mattermost-plugin-gitlab#736 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
mattermost/mattermost-plugin-gitlab#668 · 1 comment · 2 reactions ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
mattermost/mattermost-plugin-gitlab#616 ·
Maintainers usually reply within 2 days
All issues in mattermost/mattermost-plugin-gitlab
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
liberation-data/drivine#826 ·
Maintainers usually reply within 1 day
-
docs(website): add a GitLab CI/CD button next to the GitHub Action button on the homepagePossibly taken @shryssssss-maker claimed this today. Opendocumentation enhancement first-timers-only good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
OWASP/cve-lite-cli#1739 · 2 comments ·
Maintainers usually reply within 2 days
-
Mend: dependency security vulnerability untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
opensearch-project/OpenSearch-Dashboards#13241 ·
Maintainers usually reply within 1 day
-
config-report via-web
Difficulty 1/5 Under an hour Newbie friendliness 61/100
ch-bas/cctv-camera-database#432 ·
Maintainers usually reply within 1 day
-
Bugs UI / UX / Design System
Difficulty 2/5 1-3 hours Newbie friendliness 68/100