fix(pairing): handle missing accountId in allowFrom reads (#31369)

* pairing: honor default account in allowFrom read when accountId omitted

* changelog: credit pairing allowFrom fallback fix
This commit is contained in:
Vincent Koc
2026-03-01 23:24:33 -08:00
committed by GitHub
parent e055afd000
commit fbc1585b3f
3 changed files with 26 additions and 6 deletions

View File

@@ -225,6 +225,10 @@ function shouldIncludeLegacyAllowFromEntries(normalizedAccountId: string): boole
return !normalizedAccountId || normalizedAccountId === DEFAULT_ACCOUNT_ID;
}
function resolveAllowFromAccountId(accountId?: string): string {
return normalizePairingAccountId(accountId) || DEFAULT_ACCOUNT_ID;
}
function normalizeId(value: string | number): string {
return String(value).trim();
}
@@ -395,10 +399,9 @@ export async function readLegacyChannelAllowFromStore(
export async function readChannelAllowFromStore(
channel: PairingChannel,
env: NodeJS.ProcessEnv = process.env,
accountId: string,
accountId?: string,
): Promise<string[]> {
const normalizedAccountId = accountId.trim().toLowerCase();
const resolvedAccountId = normalizedAccountId || DEFAULT_ACCOUNT_ID;
const resolvedAccountId = resolveAllowFromAccountId(accountId);
if (!shouldIncludeLegacyAllowFromEntries(resolvedAccountId)) {
return await readNonDefaultAccountAllowFrom({
@@ -427,10 +430,9 @@ export function readLegacyChannelAllowFromStoreSync(
export function readChannelAllowFromStoreSync(
channel: PairingChannel,
env: NodeJS.ProcessEnv = process.env,
accountId: string,
accountId?: string,
): string[] {
const normalizedAccountId = accountId.trim().toLowerCase();
const resolvedAccountId = normalizedAccountId || DEFAULT_ACCOUNT_ID;
const resolvedAccountId = resolveAllowFromAccountId(accountId);
if (!shouldIncludeLegacyAllowFromEntries(resolvedAccountId)) {
return readNonDefaultAccountAllowFromSync({