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:
@@ -5,6 +5,10 @@ import type {
|
||||
BrowserScenarioUrl,
|
||||
BrowserScenarioValue,
|
||||
} from "../domain/browserScenario.js";
|
||||
import {
|
||||
sanitizeBrowserUrl,
|
||||
type SanitizedBrowserUrl,
|
||||
} from "../domain/browserObservation.js";
|
||||
import type { BrowserStorageValueFingerprint } from "../domain/browserScenarioCaptureValues.js";
|
||||
|
||||
const REDACTION_PREFIX = "[REDACTED:";
|
||||
@@ -20,7 +24,11 @@ export class BrowserScenarioSecrets {
|
||||
const values = new Map<string, string>();
|
||||
for (const declaration of scenario.secrets) {
|
||||
const value = environment[declaration.environment_variable];
|
||||
if (value === undefined) return undefined;
|
||||
if (
|
||||
!Object.hasOwn(environment, declaration.environment_variable) ||
|
||||
typeof value !== "string"
|
||||
)
|
||||
return undefined;
|
||||
values.set(declaration.secret_id, value);
|
||||
}
|
||||
return new BrowserScenarioSecrets(values);
|
||||
@@ -54,6 +62,34 @@ export class BrowserScenarioSecrets {
|
||||
return output;
|
||||
}
|
||||
|
||||
/** Remove only declared secret values from one URL and report that action. */
|
||||
sanitizeUrl(value: string): SanitizedBrowserUrl {
|
||||
let output = value;
|
||||
const replacements = [...this.values].sort(
|
||||
([leftId, left], [rightId, right]) =>
|
||||
right.length - left.length ||
|
||||
(leftId < rightId ? -1 : leftId > rightId ? 1 : 0),
|
||||
);
|
||||
for (const [id, secret] of replacements) {
|
||||
if (secret === "") continue;
|
||||
const marker = `${REDACTION_PREFIX}${id}]`;
|
||||
const searchParamsValue = new URLSearchParams([["value", secret]])
|
||||
.toString()
|
||||
.slice("value=".length);
|
||||
for (const candidate of new Set([
|
||||
secret,
|
||||
encodeURIComponent(secret),
|
||||
searchParamsValue,
|
||||
]))
|
||||
output = output.replaceAll(candidate, marker);
|
||||
}
|
||||
const sanitized = sanitizeBrowserUrl(output);
|
||||
return {
|
||||
...sanitized,
|
||||
redacted: sanitized.redacted || output !== value,
|
||||
};
|
||||
}
|
||||
|
||||
fingerprint(value: string): BrowserStorageValueFingerprint {
|
||||
for (const secret of this.values.values())
|
||||
if (secret !== "" && value.includes(secret))
|
||||
|
||||
Reference in New Issue
Block a user