chore: fix redaction lint
This commit is contained in:
@@ -330,7 +330,9 @@ export const ClawdbotSchema = z.object({
|
|||||||
consoleStyle: z
|
consoleStyle: z
|
||||||
.union([z.literal("pretty"), z.literal("compact"), z.literal("json")])
|
.union([z.literal("pretty"), z.literal("compact"), z.literal("json")])
|
||||||
.optional(),
|
.optional(),
|
||||||
redactSensitive: z.union([z.literal("off"), z.literal("tools")]).optional(),
|
redactSensitive: z
|
||||||
|
.union([z.literal("off"), z.literal("tools")])
|
||||||
|
.optional(),
|
||||||
redactPatterns: z.array(z.string()).optional(),
|
redactPatterns: z.array(z.string()).optional(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { loadConfig } from "../config/config.js";
|
import { loadConfig } from "../config/config.js";
|
||||||
import type { LoggingConfig } from "../config/types.js";
|
|
||||||
|
|
||||||
export type RedactSensitiveMode = "off" | "tools";
|
export type RedactSensitiveMode = "off" | "tools";
|
||||||
|
|
||||||
@@ -88,10 +87,8 @@ function redactMatch(match: string, groups: string[]): string {
|
|||||||
function redactText(text: string, patterns: RegExp[]): string {
|
function redactText(text: string, patterns: RegExp[]): string {
|
||||||
let next = text;
|
let next = text;
|
||||||
for (const pattern of patterns) {
|
for (const pattern of patterns) {
|
||||||
next = next.replace(
|
next = next.replace(pattern, (...args: string[]) =>
|
||||||
pattern,
|
redactMatch(args[0], args.slice(1, args.length - 2)),
|
||||||
(...args: string[]) =>
|
|
||||||
redactMatch(args[0], args.slice(1, args.length - 2)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return next;
|
return next;
|
||||||
|
|||||||
Reference in New Issue
Block a user