MCPcopy Create free account
hub / github.com/chhoumann/quickadd / stripSecretRefsFromSettings

Function stripSecretRefsFromSettings

src/utils/userScriptSecrets.ts:874–897  ·  view source on GitHub ↗
(
	settings: unknown,
	secretOptionNames: ReadonlySet<string> | null | undefined,
	options?: UserScriptSecretSanitizerOptions,
)

Source from the content-addressed store, hash-verified

872}
873
874function stripSecretRefsFromSettings(
875 settings: unknown,
876 secretOptionNames: ReadonlySet<string> | null | undefined,
877 options?: UserScriptSecretSanitizerOptions,
878): void {
879 if (!isRecord(settings)) return;
880
881 for (const [name, value] of Object.entries(settings)) {
882 if (isUserScriptSecretRef(value)) {
883 delete settings[name];
884 continue;
885 }
886
887 if (
888 typeof value === "string" &&
889 (secretOptionNames === null ||
890 secretOptionNames?.has(name) ||
891 (secretOptionNames === undefined &&
892 options?.stripUnknownStringSettings === true))
893 ) {
894 delete settings[name];
895 }
896 }
897}
898
899export function stripUserScriptSecretRefsFromCommand(
900 command: unknown,

Callers 1

Calls 2

isUserScriptSecretRefFunction · 0.85
isRecordFunction · 0.70

Tested by

no test coverage detected