fix(artifacts): reject Windows stream paths before extraction
Validate Windows destination representability at the writer before registering or creating any entry. Preserve literal logical names in inventory and POSIX output. Refuse NTFS alternate stream syntax with typed path evidence and roll back prior extracted files. Return producer path diagnostics directly, removing the presentation layer English-prefix classifier. Verify stream leaf/parent syntax, input stream cleanup, extraction rollback, inventory fidelity, POSIX materialization, and error projection: 63 passed, one platform-specific skip. Native Windows execution remains unverified here. Fixes #1574. Adapted from and supersedes #1575.
This commit is contained in:
@@ -191,7 +191,7 @@ export class SafeOutputTree {
|
||||
"format",
|
||||
`Invalid expected extraction size for ${relativePath}`,
|
||||
);
|
||||
const path = normalizeArtifactPath(relativePath);
|
||||
const path = normalizeDestinationPath(relativePath, this.platform);
|
||||
this.#registry.add(path, "file");
|
||||
const lineage = await this.#prepareParent(path);
|
||||
const parent = lineage.at(-1);
|
||||
@@ -569,6 +569,19 @@ const writeAll = async (
|
||||
}
|
||||
};
|
||||
|
||||
const normalizeDestinationPath = (
|
||||
relativePath: string,
|
||||
platform: NodeJS.Platform,
|
||||
): string => {
|
||||
const path = normalizeArtifactPath(relativePath);
|
||||
if (platform === "win32" && path.includes(":"))
|
||||
throw new ArtifactReaderFailure(
|
||||
"path",
|
||||
`Windows destination cannot materialize artifact path as a regular file: ${path}; ':' denotes alternate data stream syntax.`,
|
||||
);
|
||||
return path;
|
||||
};
|
||||
|
||||
const abortIfNeeded = (signal?: AbortSignal): void => {
|
||||
if (signal?.aborted === true)
|
||||
throw new ArtifactReaderFailure(
|
||||
|
||||
Reference in New Issue
Block a user