User token stops working 8 hours after /github connect (classic OAuth App)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- github, go
调研方向
Start with the OAuth flow and token storage around server/plugin/plugin.go, then inspect server/plugin/graphql/client.go and the existing mm_34646_token_refresh.go reset path. Confirm whether GitHub returns expires_in and refresh_token for this OAuth flow, then reproduce the failure and identify the point where refresh handling and tests should be added. Done means expiring tokens are refreshed before the next GitHub call, revoked-token behavior remains covered, and relevant tests pass.
由索引模型根据 Issue 内容生成。
描述
On our self-hosted Mattermost, the token the plugin gets from /github connect stops working about 8 hours later. From then on every GitHub call returns 401 Bad credentials, and the next morning the daily reminder triggers the “Your Github account was disconnected due to an invalid or revoked authorization token” DM.
Environment
- Mattermost Team Edition 11.11.1 (since upgraded to 12.0.0)
- GitHub plugin 2.6.0
- A classic OAuth App owned by our organization, not a GitHub App. Its settings page has no token expiration option.
- One connected user, a bot account
Timing
| Connect (UTC) | First 401 (UTC) | Lifetime |
|---|---|---|
| 13 Oct 07:29:36 | 13 Oct 15:30:11 | 8h 00m |
| 14 Oct 07:58:04 | 14 Oct 16:15:51 | 8h 17m |
| 15 Oct 06:20:15 | 15 Oct 14:31:47 | 8h 11m |
| 16 Oct 08:33:43 | 16 Oct 16:35:11 | 8h 01m |
Connect times come from the account’s security log (oauth_access.create), 401 times from the plugin’s Failed to search for the sidebar data errors. The 401 appears at the first plugin call after the 8 hours, which explains the extra minutes.
What we ruled out
- The MM-34646 reset in
mm_34646_token_refresh.go. It skips users who connected through/github connect, since those getMM34646ResetTokenDone: true, and itsUpdated user access token for MM-34646debug line never appears in our logs. - Revocation. The security log has no
oauth_authorization.destroy, password change or 2FA change. It does have anoauth_access.regenerateby “GitHub System” within a second of everyoauth_access.create, but that also happens for an unrelated integration (Copilot), so it looks like part of normal token issuance. - Mattermost itself. No restart or plugin configuration change around the first failure.
Suggestion
Eight hours is the lifetime of GitHub’s expiring user tokens. If GitHub now issues those to OAuth Apps too, the plugin needs to keep the refresh token and refresh on expiry. Today it wraps the stored token in oauth2.StaticTokenSource (server/plugin/plugin.go, server/plugin/graphql/client.go), so it never refreshes. We inferred the 8 hours from the timings above and haven’t inspected the token response for expires_in or refresh_token. Can anyone confirm whether GitHub changed this for classic OAuth Apps?
- 主要语言
- Go
- 星标
- 181
- 派生
- 180
- 平均合并
- 21 小时 4 分钟
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mattermost/mattermost-plugin-github 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 55/100
-
难度 3/5 1-2 天 新手友好度 48/100
mattermost/mattermost-plugin-github#996 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
mattermost/mattermost-plugin-github#937 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
查看 mattermost/mattermost-plugin-github 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
dataiku/kiji-proxy#635 ·
-
难度 2/5 1-3 小时 新手友好度 67/100
hyperledger-firefly/signer#126 ·
-
agent-review-finding chore
难度 2/5 1-3 小时 新手友好度 73/100
jordansmall/spindrift#5748 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
-
Resource links written as host:port without a scheme are broken可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复