fix(mcp): coordinate OAuth token refresh and authorization polling
Prevent concurrent refresh-token rotation across instances, distinguish expired-but-refreshable tokens from active authorization, and bind OAuth popup polling to a per-attempt ID so stale tokens cannot satisfy new consent.
This commit is contained in:
@@ -53,6 +53,11 @@ func TestSanitizeBody(t *testing.T) {
|
||||
in: `{"baseUrl":"https://example.com","modelName":"gpt"}`,
|
||||
want: `{"baseUrl":"https://example.com","modelName":"gpt"}`,
|
||||
},
|
||||
{
|
||||
name: "OAuth authorization response fields",
|
||||
in: `{"authorization_url":"https://idp.example/authorize?state=secret","authorization_attempt":"secret-state"}`,
|
||||
want: `{"authorization_url":"***","authorization_attempt":"***"}`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
@@ -64,3 +69,11 @@ func TestSanitizeBody(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSanitizeQuery(t *testing.T) {
|
||||
got := sanitizeQuery("code=secret-code&state=secret-state&next=%2Fsettings&state=second")
|
||||
want := "code=%2A%2A%2A&next=%2Fsettings&state=%2A%2A%2A"
|
||||
if got != want {
|
||||
t.Fatalf("sanitizeQuery() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user