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

Function parseForSecurity

source code/utils/bash/ast.ts:383–394  ·  view source on GitHub ↗
(
  cmd: string,
)

Source from the content-addressed store, hash-verified

381 * loaded — caller should fall back to conservative behavior.
382 */
383export async function parseForSecurity(
384 cmd: string,
385): Promise<ParseForSecurityResult> {
386 // parseCommandRaw('') returns null (falsy check), so short-circuit here.
387 // Don't use .trim() — it strips Unicode whitespace (\u00a0 etc.) which the
388 // pre-checks in parseForSecurityFromAst need to see and reject.
389 if (cmd === '') return { kind: 'simple', commands: [] }
390 const root = await parseCommandRaw(cmd)
391 return root === null
392 ? { kind: 'parse-unavailable' }
393 : parseForSecurityFromAst(cmd, root)
394}
395
396/**
397 * Same as parseForSecurity but takes a pre-parsed AST root so callers that

Callers 1

preparePermissionMatcherFunction · 0.85

Calls 2

parseCommandRawFunction · 0.85
parseForSecurityFromAstFunction · 0.85

Tested by

no test coverage detected