fix(auth): strip line breaks from pasted keys

This commit is contained in:
Peter Steinberger
2026-02-09 11:25:54 -06:00
parent fb8c653f53
commit 42a07791c4
15 changed files with 293 additions and 30 deletions

View File

@@ -6,6 +6,7 @@ import {
resolveAuthProfileOrder,
} from "../../agents/auth-profiles.js";
import { resolveEnvApiKey } from "../../agents/model-auth.js";
import { normalizeOptionalSecretInput } from "../../utils/normalize-secret-input.js";
export type NonInteractiveApiKeySource = "flag" | "env" | "profile";
@@ -48,7 +49,7 @@ export async function resolveNonInteractiveApiKey(params: {
agentDir?: string;
allowProfile?: boolean;
}): Promise<{ key: string; source: NonInteractiveApiKeySource } | null> {
const flagKey = params.flagValue?.trim();
const flagKey = normalizeOptionalSecretInput(params.flagValue);
if (flagKey) {
return { key: flagKey, source: "flag" };
}