|
1 | 1 | import { createHash } from 'node:crypto'; |
2 | 2 | import { createServer } from 'node:http'; |
3 | | -import { chmod, lstat, mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'; |
| 3 | +import { chmod, lstat, mkdtemp, mkdir, readFile, realpath, rm, writeFile } from 'node:fs/promises'; |
4 | 4 | import { tmpdir } from 'node:os'; |
5 | 5 | import { dirname, join } from 'node:path'; |
6 | 6 | import { fileURLToPath, pathToFileURL } from 'node:url'; |
@@ -84,19 +84,23 @@ async function verifyRealDependencyInstall({ |
84 | 84 | const fixtureRoot = join(scratchProject, 'registry-fixture'); |
85 | 85 | const packageRoot = join(fixtureRoot, 'package'); |
86 | 86 | const tarballPath = join(fixtureRoot, 'maka-fixture-bin-1.0.0.tgz'); |
87 | | - const projectRoot = join(scratchProject, 'project'); |
| 87 | + const requestedProjectRoot = join(scratchProject, 'project'); |
| 88 | + await Promise.all([ |
| 89 | + mkdir(join(packageRoot, 'bin'), { recursive: true }), |
| 90 | + mkdir(join(requestedProjectRoot, 'node_modules'), { recursive: true }), |
| 91 | + mkdir(join(requestedProjectRoot, '.maka-runtime', 'home'), { recursive: true }), |
| 92 | + mkdir(join(requestedProjectRoot, '.maka-runtime', 'cache'), { recursive: true }), |
| 93 | + mkdir(join(requestedProjectRoot, '.maka-runtime', 'temp'), { recursive: true }), |
| 94 | + ]); |
| 95 | + // Windows hosted runners commonly expose TEMP through an 8.3 alias such as |
| 96 | + // RUNNER~1. The producer owner canonicalizes cwd before spawn, so the |
| 97 | + // verifier must build its Permission Model allowlist from the same identity. |
| 98 | + const projectRoot = await realpath(requestedProjectRoot); |
88 | 99 | const outputRoot = join(projectRoot, 'node_modules'); |
89 | 100 | const scratchRoot = join(projectRoot, '.maka-runtime'); |
90 | 101 | const homeRoot = join(scratchRoot, 'home'); |
91 | 102 | const cacheRoot = join(scratchRoot, 'cache'); |
92 | 103 | const tempRoot = join(scratchRoot, 'temp'); |
93 | | - await Promise.all([ |
94 | | - mkdir(join(packageRoot, 'bin'), { recursive: true }), |
95 | | - mkdir(outputRoot, { recursive: true }), |
96 | | - mkdir(homeRoot, { recursive: true }), |
97 | | - mkdir(cacheRoot, { recursive: true }), |
98 | | - mkdir(tempRoot, { recursive: true }), |
99 | | - ]); |
100 | 104 | await Promise.all([ |
101 | 105 | writeFile( |
102 | 106 | join(packageRoot, 'package.json'), |
|
0 commit comments