@uniglot/wont-let-you-see 0.3.1 → 1.0.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/dist/index.js +3 -0
- package/package.json +1 -1
- package/src/__tests__/masker.test.ts +2 -1
- package/src/__tests__/patterns.test.ts +2 -10
- package/src/index.ts +9 -0
package/dist/index.js
CHANGED
|
@@ -349,6 +349,9 @@ var plugin = async (input) => {
|
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
351
|
output.output = mask(hookInput.sessionID, output.output);
|
|
352
|
+
if (output.metadata?.output) {
|
|
353
|
+
output.metadata.output = mask(hookInput.sessionID, output.metadata.output);
|
|
354
|
+
}
|
|
352
355
|
},
|
|
353
356
|
"chat.message": async (hookInput, output) => {
|
|
354
357
|
for (const part of output.parts) {
|
package/package.json
CHANGED
|
@@ -172,7 +172,8 @@ describe("masker", () => {
|
|
|
172
172
|
});
|
|
173
173
|
|
|
174
174
|
it("should not mask ARN when both eks-cluster and arn are revealed", () => {
|
|
175
|
-
process.env.WONT_LET_YOU_SEE_REVEALED_PATTERNS =
|
|
175
|
+
process.env.WONT_LET_YOU_SEE_REVEALED_PATTERNS =
|
|
176
|
+
"eks-cluster,arn,phone-us";
|
|
176
177
|
resetConfig();
|
|
177
178
|
|
|
178
179
|
const input =
|
|
@@ -210,14 +210,6 @@ describe("Kubernetes Patterns", () => {
|
|
|
210
210
|
resetPatternCache();
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
-
describe("Service Account Token", () => {
|
|
214
|
-
it("should match JWT format", () => {
|
|
215
|
-
const jwt =
|
|
216
|
-
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImRlZmF1bHQtdG9rZW4tYWJjZGUiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGVmYXVsdCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjEyMzQ1Njc4LTEyMzQtMTIzNC0xMjM0LTEyMzQ1Njc4OTAxMiIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZWZhdWx0OmRlZmF1bHQifQ.signature";
|
|
217
|
-
expect(getPattern("k8s-token").test(jwt)).toBe(true);
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
|
|
221
213
|
describe("Node Names", () => {
|
|
222
214
|
it("should match AWS node name", () => {
|
|
223
215
|
expect(
|
|
@@ -334,8 +326,8 @@ describe("loadPatterns", () => {
|
|
|
334
326
|
|
|
335
327
|
it("should load Kubernetes patterns", () => {
|
|
336
328
|
const patterns = loadPatterns();
|
|
337
|
-
const
|
|
338
|
-
expect(
|
|
329
|
+
const k8sNodePattern = patterns.find((p) => p.name === "k8s-node");
|
|
330
|
+
expect(k8sNodePattern).toBeDefined();
|
|
339
331
|
});
|
|
340
332
|
|
|
341
333
|
it("should load common patterns", () => {
|
package/src/index.ts
CHANGED
|
@@ -30,7 +30,16 @@ export const plugin: Plugin = async (input: PluginInput): Promise<Hooks> => {
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
// Mask output sent to LLM
|
|
33
34
|
output.output = mask(hookInput.sessionID, output.output);
|
|
35
|
+
|
|
36
|
+
// Also mask TUI display (metadata.output is used as fallback in TUI rendering)
|
|
37
|
+
if (output.metadata?.output) {
|
|
38
|
+
output.metadata.output = mask(
|
|
39
|
+
hookInput.sessionID,
|
|
40
|
+
output.metadata.output,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
34
43
|
},
|
|
35
44
|
|
|
36
45
|
"chat.message": async (hookInput, output) => {
|