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:
@@ -345,7 +345,11 @@ const artifactMessage = ({
|
||||
return "Artifact operation was cancelled. Start it again when ready.";
|
||||
if (reason === "limit")
|
||||
return "Artifact is too large to process safely. Narrow the requested path or use a smaller artifact.";
|
||||
if (reason === "path") return artifactPathMessage(detail);
|
||||
if (reason === "path")
|
||||
return (
|
||||
detail ??
|
||||
"Artifact contains a conflicting internal path. Inspect the reported path before retrying."
|
||||
);
|
||||
if (reason === "unavailable" && details?.unpacked === true)
|
||||
return `ASAR unpacked companion bytes are unavailable for ${details.logicalPath}. Select the archive in place with its .unpacked directory beside it, then retry.`;
|
||||
if (reason === "unavailable")
|
||||
@@ -361,23 +365,6 @@ const artifactMessage = ({
|
||||
return "Artifact could not be read or written. Check file access and try again.";
|
||||
};
|
||||
|
||||
const artifactPathMessage = (detail: string | undefined): string => {
|
||||
// Kept in step with DESTINATION_CASE_COLLISION_PREFIX. Domain does not import
|
||||
// the artifact adapter that produces the detail.
|
||||
if (
|
||||
detail !== undefined &&
|
||||
detail.startsWith("Destination filesystem cannot store both ")
|
||||
)
|
||||
return detail;
|
||||
if (
|
||||
detail !== undefined &&
|
||||
(detail.startsWith("Artifact path is absolute or unsafe:") ||
|
||||
detail.startsWith("Artifact path is not normalized:"))
|
||||
)
|
||||
return "Artifact contains an unsafe internal path. Inspect the reported path and correct the artifact before retrying.";
|
||||
return "Artifact contains a conflicting internal path. Inspect the reported path before retrying.";
|
||||
};
|
||||
|
||||
const evidenceFileMessage = ({
|
||||
operation,
|
||||
reason,
|
||||
|
||||
Reference in New Issue
Block a user