fix(tools)!: simplify direct invocation and harden boundary contracts (#555)
Remove REA permission grants, scope ceilings, approval confirmations, and inert settings. Preserve selected local evidence, accept caller-chosen commands and paths, and report actual runtime failures. Harden provider results, schema serialization, snapshot evidence binding, archive paths, source maps, native screenshots, managed EH parsing, and cancellation cleanup. Regenerate tool metadata and document direct invocation. BREAKING CHANGE: Removed permission configuration and policy commands, approval fields, filesystem scope inputs, and fixed confirmation options. Process capture inherits the host environment and accepts command names; callers must refresh tool schemas and migrate removed fields.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { posix, relative } from "node:path";
|
||||
import { posix, relative, win32 } from "node:path";
|
||||
|
||||
import { isPathWithinRoot } from "./localPath.js";
|
||||
import {
|
||||
compareCodePoints,
|
||||
type ApplicationNode,
|
||||
@@ -208,14 +207,31 @@ const candidateDigests = (
|
||||
};
|
||||
|
||||
const pathBelowRoot = (root: string, value: string): string | null => {
|
||||
const remainder = relative(root, value);
|
||||
const rootStyle = absoluteFilePathStyle(root);
|
||||
if (rootStyle === null || rootStyle !== absoluteFilePathStyle(value))
|
||||
return null;
|
||||
const remainder =
|
||||
rootStyle === "windows"
|
||||
? win32.relative(root, value)
|
||||
: relative(root, value);
|
||||
const portableRemainder = remainder.replaceAll("\\", "/");
|
||||
if (
|
||||
remainder === "" ||
|
||||
!isPathWithinRoot(root, value) ||
|
||||
remainder.includes("\\")
|
||||
(rootStyle === "windows" && win32.isAbsolute(remainder)) ||
|
||||
portableRemainder === ".." ||
|
||||
portableRemainder.startsWith("../")
|
||||
)
|
||||
return null;
|
||||
return normalizeArtifactPath(remainder);
|
||||
return normalizeArtifactPath(portableRemainder);
|
||||
};
|
||||
|
||||
const absoluteFilePathStyle = (path: string): "posix" | "windows" | null => {
|
||||
if (
|
||||
/^[a-z]:[\\/]/iu.test(path) ||
|
||||
/^(?:\\\\|\/\/)[^\\/]+[\\/][^\\/]+(?:[\\/]|$)/u.test(path)
|
||||
)
|
||||
return "windows";
|
||||
return path.startsWith("/") ? "posix" : null;
|
||||
};
|
||||
|
||||
const pathBelowUrlPrefix = (prefix: string, value: string): string | null => {
|
||||
|
||||
Reference in New Issue
Block a user