# @rnw-scripts/extract-zip This private workspace replaces `extract-zip` 2.x for `puppeteer-core` 5.5 through a root Yarn resolution. This repository-local resolution does not propagate to consumers of published packages, including `@react-native-windows/automation`. Updating that dependency chain requires a separately validated consumer migration. ## API compatibility The CommonJS API is `extract(zipPath, options)`, returning a promise. `options.dir` must be an absolute destination path. The API preserves file and directory extraction, ordinary overwrites, entry modes, `defaultDirMode`, `defaultFileMode`, `onEntry(entry, zipfile)`, and contained symbolic-link entries. ## Containment guarantees and limitations Before creating an entry's directories, file, or symbolic link, the extractor validates its path and any symbolic-link target against the destination. It rejects absolute or traversing entry paths, outside canonical parents, and escaping symbolic-link targets, including dangling targets. Paths are validated again after `onEntry`, which receives a mutable entry. Regular files cannot overwrite existing symbolic-link leaves, even when their targets are inside the destination. Parent symbolic links are resolved and checked for containment before extraction. Symbolic-link targets may contain leading `..` segments only when the target remains contained. `..` segments after other path components are refused because lexical and link-following resolution can disagree. These checks also apply to existing symbolic-link targets encountered during resolution. The destination root may be created before entry validation. Checks are per entry, not an archive-wide preflight. Callers must prevent concurrent filesystem changes during extraction; containment checks do not protect against filesystem races. ## Tests Root `yarn test` runs [`.ado/tests/extract-zip.test.cjs`](../../../.ado/tests/extract-zip.test.cjs), including benign extraction through Puppeteer's resolved module, API compatibility, and containment checks. Real symbolic-link cases require Windows Developer Mode or symbolic-link privileges; they are skipped when Windows denies symbolic-link creation. Mocked leaf and error checks run regardless.