Skip to content

Commit 6c81da9

Browse files
wesmclaude
andcommitted
Validate token client for all explicit --oauth-app values
Including --oauth-app "" (clear to default). Previously the empty string skipped the client check on first-time registration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ce0b874 commit 6c81da9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cmd/msgvault/cmd/addaccount.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,10 @@ Examples:
135135
}
136136

137137
// If a valid token exists, check if we can reuse it.
138-
// When --oauth-app is explicitly set (binding change or first
139-
// registration), verify the token was minted by that app's
140-
// client. A mismatched token would fail on next refresh.
141-
needsClientCheck := bindingChanged ||
142-
(oauthAppExplicit && resolvedApp != "")
138+
// When --oauth-app is explicitly set (any value including empty),
139+
// verify the token was minted by the resolved app's client.
140+
// A mismatched token would fail on next refresh.
141+
needsClientCheck := bindingChanged || oauthAppExplicit
143142
tokenReusable := !forceReauth && oauthMgr.HasToken(email) &&
144143
(!needsClientCheck || oauthMgr.TokenMatchesClient(email))
145144
if tokenReusable {

0 commit comments

Comments
 (0)