Skip to content

Commit 0ca8578

Browse files
committed
fix(xport): double-cast through unknown for null-prototype merge maps
Restores `{ __proto__: null }` literal (fleet-preferred form) with `as unknown as Record<...>` to satisfy strict tsconfigs. All 6 fleet repos byte-identical.
1 parent 1c0155f commit 0ca8578

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

scripts/xport.mts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,17 @@ function loadManifestTree(rootManifestPath: string): {
186186
areas.push({ area, manifest: sub })
187187
}
188188

189-
// Null-prototype objects prevent prototype-pollution via untrusted
190-
// manifest keys. Object.create(null) + a plain-object cast works
191-
// under both relaxed and strict (exactOptionalPropertyTypes) tsconfigs.
192-
const mergedUpstreams = Object.create(null) as Record<string, Upstream>
193-
const mergedSites = Object.create(null) as Record<string, Site>
189+
// Null-prototype maps guard against prototype pollution via untrusted
190+
// manifest keys. Double-cast through `unknown` so the
191+
// `exactOptionalPropertyTypes + noUncheckedIndexedAccess` strict
192+
// tsconfig in some repos accepts the `__proto__` sigil.
193+
const mergedUpstreams: Record<string, Upstream> = {
194+
__proto__: null,
195+
} as unknown as Record<string, Upstream>
196+
const mergedSites: Record<string, Site> = {
197+
__proto__: null,
198+
} as unknown as Record<string, Site>
199+
194200
const mergedRows: Row[] = []
195201
// Include order, root last so it wins on duplicate keys.
196202
for (const { manifest } of [...areas.slice(1), ...areas.slice(0, 1)]) {

0 commit comments

Comments
 (0)