Skip to content

Commit d51584d

Browse files
committed
fix(archives): prevent zip symlink overwrite
1 parent fab8f91 commit d51584d

20 files changed

Lines changed: 316 additions & 341 deletions

File tree

.config/repo/tsconfig.check.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"//": "Member-owned half of the type-check config. .config/fleet/tsconfig.check.json extends this LAST, so anything declared here wins over the fleet defaults. Its main job is compilerOptions.paths: a member's package aliases resolve for `pnpm run type` only when they are declared here, because the root tsconfig.json is a sibling of the check chain rather than an ancestor. Paths are relative to THIS file, so a src/ wrapper reads ../../src/external/<name>. Seeded empty and extended unconditionally, so leave the file in place even with nothing in it.",
33
"compilerOptions": {
44
"paths": {
5-
"adm-zip": ["../../src/external/adm-zip"],
65
"cacache": ["../../src/external/cacache"],
76
"fast-sort": ["../../src/external/fast-sort"],
87
"make-fetch-happen": ["../../src/external/make-fetch-happen"],

docs/repo/agents.md/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Per-repo CLAUDE.md detail extracted to fit the 40KB whole-file cap. The CLAUDE.m
77
Core infrastructure library for Socket.dev security tools.
88

99
- **Internal imports:** relative paths (e.g. `'../constants/packages'`). Path aliases are intentionally avoided.
10-
- **Vendored externals:** `cacache`, `make-fetch-happen`, `fast-sort`, `pacote`, `adm-zip`, `tar-fs`, `picomatch` live in `src/external/` and are remapped via `tsconfig.json` `paths`. Import them by bare package name.
10+
- **Vendored externals:** `cacache`, `make-fetch-happen`, `fast-sort`, `pacote`, `tar-fs`, `picomatch` live in `src/external/` and are remapped via `tsconfig.json` `paths`. Import them by bare package name.
1111

1212
## Commands
1313

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4092,7 +4092,6 @@
40924092
"@vitest/ui": "catalog:",
40934093
"@vitiate/core": "catalog:",
40944094
"@yarnpkg/extensions": "2.0.7",
4095-
"adm-zip": "0.6.0",
40964095
"ast-v8-to-istanbul": "catalog:",
40974096
"c8": "catalog:",
40984097
"cacache": "20.0.4",
@@ -4104,6 +4103,7 @@
41044103
"fast-check": "catalog:",
41054104
"fast-glob": "3.3.3",
41064105
"fast-sort": "3.4.1",
4106+
"fflate": "0.8.3",
41074107
"get-east-asian-width": "1.6.0",
41084108
"globals": "17.11.0",
41094109
"has-flag": "5.0.1",

pnpm-lock.yaml

Lines changed: 3 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/repo/build-externals/config.mts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const externalPackages = [
2525
{ name: 'normalize-package-data', bundle: false },
2626
{ name: 'semver', bundle: true },
2727
// Utilities
28-
{ name: 'adm-zip', bundle: true },
2928
{ name: 'debug', bundle: true },
3029
{ name: 'tar-fs', bundle: true },
3130
// p-map: Standalone bundle. ESM-only package, bundled before pico-pack.

scripts/repo/build-externals/rolldown-config.mts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ const STUB_MAP: Record<string, string | [RegExp, string]> = {
111111
*/
112112
export function createForceNodeModulesPlugin(): Plugin {
113113
const packagesWithPathMappings = [
114-
'adm-zip',
115114
'cacache',
116115
'make-fetch-happen',
117116
'fast-sort',

src/archives/shared.mts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
/**
22
* @file Private internals for `archives/*` modules — defaults, lazy module
3-
* accessors (adm-zip, tar-fs, node:path), shared pre-extraction validators
3+
* accessors (tar-fs, node:path), shared pre-extraction validators
44
* (`assertArchiveExists`, `validatePathWithinBase`).
55
*/
66

77
import { ErrorCtor } from '../primordials/error.mjs'
88
import { StringPrototypeStartsWith } from '../primordials/string.mjs'
9-
import type AdmZipType from '../external/adm-zip.js'
109
import type tarFsType from '../external/tar-fs.js'
1110
import { getNodePath } from '../node/path.mjs'
1211
import { getNodeFs } from '../node/fs.mjs'
@@ -21,17 +20,14 @@ export {
2120
DEFAULT_MAX_TOTAL_SIZE,
2221
} from './types.mjs'
2322

24-
let admZip: typeof AdmZipType | undefined
2523
let tarFs: typeof tarFsType | undefined
2624

2725
/**
2826
* Assert that an archive file exists on disk before handing it to the
2927
* underlying extractor. Normalizes the "missing archive" surface across all
3028
* three extractors (zip/tar/tar.gz): each now throws a Node-style `ENOENT`
3129
* error with the archive path. Without this preflight, `zip` goes through
32-
* adm-zip and surfaces as `"Invalid filename"`, while `tar`/`tar.gz` surface
33-
* the raw Node `ENOENT` — inconsistent, and adm-zip's message didn't include
34-
* the path.
30+
* the underlying extractor. The error includes the missing path.
3531
*
3632
* @private
3733
*
@@ -49,13 +45,6 @@ export function assertArchiveExists(archivePath: string): void {
4945
}
5046
}
5147

52-
export function getAdmZip() {
53-
if (admZip === undefined) {
54-
admZip = /*@__PURE__*/ require('../external/adm-zip.js')
55-
}
56-
return admZip!
57-
}
58-
5948
export function getTarFs() {
6049
if (tarFs === undefined) {
6150
tarFs = /*@__PURE__*/ require('../external/tar-fs.js')

src/archives/types.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* limits that record documents. No imports and no side effects, which is
55
* load-bearing: `npm/registry/tarball/shared` reads the defaults from here
66
* on the BROWSER path, and the sibling `archives/shared` cannot serve them
7-
* because it also owns the adm-zip / tar-fs / `node:fs` accessors.
7+
* because it also owns the tar-fs / `node:fs` accessors.
88
*/
99

1010
/**

0 commit comments

Comments
 (0)