agent-sanitizer 2.47.2 → 2.47.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -81,7 +81,8 @@ const HOOK_NAME = "pretooluse-sanitize";
|
|
|
81
81
|
* must be blocked, or null to let the pipeline continue. Hosts use these for
|
|
82
82
|
* policy the package has no view of (a required workflow step, a project-local
|
|
83
83
|
* rule); the package ships none.
|
|
84
|
-
* @typedef {(input: { tool_name: string | null, tool_input: any, session_id?: string
|
|
84
|
+
* @typedef {(input: { tool_name: string | null, tool_input: any, session_id?: string,
|
|
85
|
+
* permission_mode?: string })
|
|
85
86
|
* => string | null | undefined} HostGate
|
|
86
87
|
*/
|
|
87
88
|
|
|
@@ -595,13 +596,16 @@ export async function judgePreToolUseSanitize(event, rehydrate, opts = {}) {
|
|
|
595
596
|
// a pass is the one incentive a gate must never create.
|
|
596
597
|
if (event.event === EventKind.UNKNOWN)
|
|
597
598
|
return { decision: Decision.DENY, reason: messages.unknownEvent };
|
|
598
|
-
// The session identity
|
|
599
|
-
// gate keyed on the session (a once-per-session checkpoint)
|
|
600
|
-
// sessions apart without
|
|
599
|
+
// The session identity and the permission mode travel in `meta`, not alongside
|
|
600
|
+
// the tool input. A gate keyed on the session (a once-per-session checkpoint)
|
|
601
|
+
// cannot tell two sessions apart without the first, and a gate keyed on the
|
|
602
|
+
// mode reads `undefined` without the second — so it fires in EVERY mode, which
|
|
603
|
+
// is the safe direction but not the intended one.
|
|
601
604
|
const input = {
|
|
602
605
|
tool_name: event.tool,
|
|
603
606
|
tool_input: event.input,
|
|
604
607
|
session_id: event.meta?.session_id,
|
|
608
|
+
permission_mode: event.meta?.permission_mode,
|
|
605
609
|
};
|
|
606
610
|
// Host gates run BEFORE any rewriting layer, because they decide whether the
|
|
607
611
|
// call may happen at all rather than what its input contains — and returning
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-sanitizer",
|
|
3
|
-
"version": "2.47.
|
|
3
|
+
"version": "2.47.3",
|
|
4
4
|
"description": "Defend an agent against hidden-content injection: strip payload-capable invisible Unicode and ANSI, splice out human-invisible HTML, and flag data-exfil URLs in untrusted text before any model sees it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -188,7 +188,8 @@ export function cliMain(opts?: {
|
|
|
188
188
|
* must be blocked, or null to let the pipeline continue. Hosts use these for
|
|
189
189
|
* policy the package has no view of (a required workflow step, a project-local
|
|
190
190
|
* rule); the package ships none.
|
|
191
|
-
* @typedef {(input: { tool_name: string | null, tool_input: any, session_id?: string
|
|
191
|
+
* @typedef {(input: { tool_name: string | null, tool_input: any, session_id?: string,
|
|
192
|
+
* permission_mode?: string })
|
|
192
193
|
* => string | null | undefined} HostGate
|
|
193
194
|
*/
|
|
194
195
|
/**
|
|
@@ -221,6 +222,7 @@ export type HostGate = (input: {
|
|
|
221
222
|
tool_name: string | null;
|
|
222
223
|
tool_input: any;
|
|
223
224
|
session_id?: string;
|
|
225
|
+
permission_mode?: string;
|
|
224
226
|
}) => string | null | undefined;
|
|
225
227
|
declare const rehydrateRedacted: typeof import("agent-sanitizer/rehydrate").rehydrateRedacted;
|
|
226
228
|
export {};
|