* Looks up a command in the allowlist, resolving aliases first. * Returns the config if found, or undefined.
(name: string)
| 1086 | * Returns the config if found, or undefined. |
| 1087 | */ |
| 1088 | function lookupAllowlist(name: string): CommandConfig | undefined { |
| 1089 | const lower = name.toLowerCase() |
| 1090 | // Direct lookup first |
| 1091 | const direct = CMDLET_ALLOWLIST[lower] |
| 1092 | if (direct) { |
| 1093 | return direct |
| 1094 | } |
| 1095 | // Resolve alias to canonical and look up |
| 1096 | const canonical = resolveToCanonical(lower) |
| 1097 | if (canonical !== lower) { |
| 1098 | return CMDLET_ALLOWLIST[canonical] |
| 1099 | } |
| 1100 | return undefined |
| 1101 | } |
| 1102 | |
| 1103 | /** |
| 1104 | * Sync regex-based check for security-concerning patterns in a PowerShell command. |
no test coverage detected