






















@@ -5,10 +5,10 @@ import {
55isSensitiveUrlConfigPath,
66SENSITIVE_URL_HINT_TAG,
77} from "../shared/net/redact-sensitive-url.js";
8-import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
98import { FIELD_HELP } from "./schema.help.js";
109import { FIELD_LABELS } from "./schema.labels.js";
1110import { applyDerivedTags } from "./schema.tags.js";
11+import { isSensitiveConfigPath } from "./sensitive-paths.js";
1212import { sensitive } from "./zod-schema.sensitive.js";
13131414let log: ReturnType<typeof createSubsystemLogger> | null = null;
@@ -111,49 +111,7 @@ export function isPluginOwnedChannelHintPath(path: string): boolean {
111111return !isKernelOwnedChannelHintPath(path);
112112}
113113114-/**
115- * Non-sensitive field names that happen to match sensitive patterns.
116- * These are explicitly excluded from redaction (plugin config) and
117- * warnings about not being marked sensitive (base config).
118- */
119-const SENSITIVE_KEY_WHITELIST_SUFFIXES = [
120-"maxtokens",
121-"maxoutputtokens",
122-"maxinputtokens",
123-"maxcompletiontokens",
124-"contexttokens",
125-"totaltokens",
126-"tokencount",
127-"tokenlimit",
128-"tokenbudget",
129-"passwordFile",
130-] as const;
131-const NORMALIZED_SENSITIVE_KEY_WHITELIST_SUFFIXES = SENSITIVE_KEY_WHITELIST_SUFFIXES.map((suffix) =>
132-normalizeLowercaseStringOrEmpty(suffix),
133-);
134-135-const SENSITIVE_PATTERNS = [
136-/token$/i,
137-/password/i,
138-/secret/i,
139-/api.?key/i,
140-/encrypt.?key/i,
141-/private.?key/i,
142-/serviceaccount(?:ref)?$/i,
143-];
144-145-function isWhitelistedSensitivePath(path: string): boolean {
146-const lowerPath = normalizeLowercaseStringOrEmpty(path);
147-return NORMALIZED_SENSITIVE_KEY_WHITELIST_SUFFIXES.some((suffix) => lowerPath.endsWith(suffix));
148-}
149-150-function matchesSensitivePattern(path: string): boolean {
151-return SENSITIVE_PATTERNS.some((pattern) => pattern.test(path));
152-}
153-154-export function isSensitiveConfigPath(path: string): boolean {
155-return !isWhitelistedSensitivePath(path) && matchesSensitivePattern(path);
156-}
114+export { isSensitiveConfigPath };
157115158116export function buildBaseHints(): ConfigUiHints {
159117const hints: ConfigUiHints = {};
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。