MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / sanitizeCore

Function sanitizeCore

source code/utils/computerUse/appNames.ts:134–150  ·  view source on GitHub ↗

* Length cap + trim + dedupe + sort. `applyCharFilter` — skip for trusted * bundle IDs (Apple/Google/MS; a localized "Réglages Système" with unusual * punctuation shouldn't be dropped), apply for anything attacker-installable.

(
  raw: readonly string[],
  applyCharFilter: boolean,
)

Source from the content-addressed store, hash-verified

132 * punctuation shouldn't be dropped), apply for anything attacker-installable.
133 */
134function sanitizeCore(
135 raw: readonly string[],
136 applyCharFilter: boolean,
137): string[] {
138 const seen = new Set<string>()
139 return raw
140 .map(name => name.trim())
141 .filter(trimmed => {
142 if (!trimmed) return false
143 if (trimmed.length > APP_NAME_MAX_LEN) return false
144 if (applyCharFilter && !APP_NAME_ALLOWED.test(trimmed)) return false
145 if (seen.has(trimmed)) return false
146 seen.add(trimmed)
147 return true
148 })
149 .sort((a, b) => a.localeCompare(b))
150}
151
152function sanitizeAppNames(raw: readonly string[]): string[] {
153 const filtered = sanitizeCore(raw, true)

Callers 2

sanitizeAppNamesFunction · 0.85
sanitizeTrustedNamesFunction · 0.85

Calls 2

hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected