@mutmutco/kilo-plugin 3.125.0 → 3.126.0
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.
- package/package.json +1 -1
- package/scripts/hook-run.mjs +11 -1
package/package.json
CHANGED
package/scripts/hook-run.mjs
CHANGED
|
@@ -343,7 +343,7 @@ export async function runPolicyGate({ surface, gate: gateId, input = Buffer.allo
|
|
|
343
343
|
hookSurface(surface);
|
|
344
344
|
const root = pluginRoot(surface, env, here);
|
|
345
345
|
const target = join(root, 'scripts', gate.script);
|
|
346
|
-
const normalizedInput = normalizeInput(surface, gateId, input);
|
|
346
|
+
const normalizedInput = normalizeInput(surface, gateId, stripUtf8Bom(input));
|
|
347
347
|
const effectiveEnv = childEnv(surface, normalizedInput, env);
|
|
348
348
|
let result;
|
|
349
349
|
|
|
@@ -395,6 +395,16 @@ export async function runPolicyGate({ surface, gate: gateId, input = Buffer.allo
|
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
+
/** #4878: Cursor's Windows payload transport pipes the hook payload through PowerShell with
|
|
399
|
+
* `$OutputEncoding = [System.Text.Encoding]::UTF8` — the BOM-EMITTING encoder — so the JSON arrives
|
|
400
|
+
* prefixed with EF BB BF. JSON.parse refuses a BOM, every parse in this chain (normalizeInput,
|
|
401
|
+
* payloadMeta, the gate scripts) came back empty, and the fail-open no-payload arm (#2992) silently
|
|
402
|
+
* waved the call through. Stripped once at the gate entry so every consumer parses the same bytes. */
|
|
403
|
+
function stripUtf8Bom(input) {
|
|
404
|
+
const buffer = Buffer.from(input);
|
|
405
|
+
return buffer[0] === 0xef && buffer[1] === 0xbb && buffer[2] === 0xbf ? buffer.subarray(3) : buffer;
|
|
406
|
+
}
|
|
407
|
+
|
|
398
408
|
function readStdin() {
|
|
399
409
|
try {
|
|
400
410
|
return readFileSync(0);
|