Skip to content

Commit bca97f3

Browse files
lsr911claude
andcommitted
fix(minimax): bound OAuth JSON response via shared provider reader
Use readProviderJsonResponse (shared 16 MiB default cap) instead of unbounded response.json() for MiniMax OAuth authorization code endpoint. Co-Authored-By: Claude <[email protected]> Signed-off-by: lsr911 <[email protected]>
1 parent fbfadbd commit bca97f3

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

extensions/minimax/oauth.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import {
77
resolvePositiveTimerTimeoutMs,
88
} from "openclaw/plugin-sdk/number-runtime";
99
import { generatePkceVerifierChallenge, toFormUrlEncoded } from "openclaw/plugin-sdk/provider-auth";
10-
import { readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
10+
import {
11+
readProviderJsonResponse,
12+
readResponseTextLimited,
13+
} from "openclaw/plugin-sdk/provider-http";
1114
import { ensureGlobalUndiciEnvProxyDispatcher } from "openclaw/plugin-sdk/runtime-env";
1215
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
1316

@@ -121,7 +124,10 @@ async function requestOAuthCode(params: {
121124
throw new Error(`MiniMax OAuth authorization failed: ${text || response.statusText}`);
122125
}
123126

124-
const payload = (await response.json()) as MiniMaxOAuthAuthorization & { error?: string };
127+
const payload = (await readProviderJsonResponse(
128+
response,
129+
"minimax.oauth-code",
130+
)) as MiniMaxOAuthAuthorization & { error?: string };
125131
if (!payload.user_code || !payload.verification_uri) {
126132
throw new Error(
127133
payload.error ??

0 commit comments

Comments
 (0)