mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-14 08:36:26 +00:00
22 lines
432 B
TypeScript
22 lines
432 B
TypeScript
const secrets = new Set<string>();
|
|
|
|
export function sanitize(input: string): string {
|
|
if (!input) {
|
|
return input;
|
|
}
|
|
let output: string = input;
|
|
secrets.forEach(secret => {
|
|
while (output.includes(secret)) {
|
|
output = output.replace(secret, '**redacted**');
|
|
}
|
|
});
|
|
return output;
|
|
}
|
|
|
|
export function add(secret: string): void {
|
|
secrets.add(secret);
|
|
}
|
|
|
|
export function clear(): void {
|
|
secrets.clear();
|
|
}
|