From 378b2c2f5cdf68965ca9a7f7682d6100dbfd47e6 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 6 Apr 2026 15:56:02 +0100 Subject: [PATCH] fix(check): absorb latest main lint drift --- extensions/msteams/src/file-consent.ts | 44 +++++++++++++------ src/plugins/web-provider-resolution-shared.ts | 8 +++- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/extensions/msteams/src/file-consent.ts b/extensions/msteams/src/file-consent.ts index ba1e5f31922..220741d9e63 100644 --- a/extensions/msteams/src/file-consent.ts +++ b/extensions/msteams/src/file-consent.ts @@ -52,29 +52,49 @@ export function isPrivateOrReservedIP(ip: string): boolean { } const [a, b] = octets; // 10.0.0.0/8 - if (a === 10) return true; + if (a === 10) { + return true; + } // 172.16.0.0/12 - if (a === 172 && b >= 16 && b <= 31) return true; + if (a === 172 && b >= 16 && b <= 31) { + return true; + } // 192.168.0.0/16 - if (a === 192 && b === 168) return true; + if (a === 192 && b === 168) { + return true; + } // 127.0.0.0/8 (loopback) - if (a === 127) return true; + if (a === 127) { + return true; + } // 169.254.0.0/16 (link-local) - if (a === 169 && b === 254) return true; + if (a === 169 && b === 254) { + return true; + } // 0.0.0.0/8 - if (a === 0) return true; + if (a === 0) { + return true; + } } // IPv6 checks const normalized = ip.toLowerCase(); // ::1 loopback - if (normalized === "::1") return true; + if (normalized === "::1") { + return true; + } // fe80::/10 link-local - if (normalized.startsWith("fe80:") || normalized.startsWith("fe80")) return true; + if (normalized.startsWith("fe80:") || normalized.startsWith("fe80")) { + return true; + } // fc00::/7 unique-local (fc00:: and fd00::) - if (normalized.startsWith("fc") || normalized.startsWith("fd")) return true; + if (normalized.startsWith("fc") || normalized.startsWith("fd")) { + return true; + } // :: unspecified - if (normalized === "::") return true; + if (normalized === "::") { + return true; + } return false; } @@ -130,9 +150,7 @@ export async function validateConsentUploadUrl( for (const entry of resolved) { if (isPrivateOrReservedIP(entry.address)) { - throw new Error( - `Consent upload URL resolves to a private/reserved IP (${entry.address})`, - ); + throw new Error(`Consent upload URL resolves to a private/reserved IP (${entry.address})`); } } } diff --git a/src/plugins/web-provider-resolution-shared.ts b/src/plugins/web-provider-resolution-shared.ts index f76c7cd9147..ed423145856 100644 --- a/src/plugins/web-provider-resolution-shared.ts +++ b/src/plugins/web-provider-resolution-shared.ts @@ -154,8 +154,12 @@ export function buildWebProviderSnapshotCacheKey(params: { bundledAllowlistCompat?: boolean; onlyPluginIds?: readonly string[]; origin?: PluginManifestRecord["origin"]; - envKey: Record; + envKey: string | Record; }): string { + const envKey = + typeof params.envKey === "string" + ? params.envKey + : Object.entries(params.envKey).toSorted(([left], [right]) => left.localeCompare(right)); return JSON.stringify({ workspaceDir: params.workspaceDir ?? "", bundledAllowlistCompat: params.bundledAllowlistCompat === true, @@ -163,7 +167,7 @@ export function buildWebProviderSnapshotCacheKey(params: { onlyPluginIds: [...new Set(params.onlyPluginIds ?? [])].toSorted((left, right) => left.localeCompare(right), ), - env: Object.entries(params.envKey).toSorted(([left], [right]) => left.localeCompare(right)), + env: envKey, }); }