sanitizeHookName extracts a safe command name from a full hook string.
// Source: https://github.com/google-gemini/gemini-cli | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works // Provided via justclaw.it.com; keep this notice with the code. /** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ /** * Sanitize hook name to remove potentially sensitive information. * Extracts the base command name without arguments or full paths. * * This function protects PII by removing: * - Full file paths that may contain usernames * - Command arguments that may contain credentials, API keys, tokens * - Environment variables with sensitive values * * Examples: * - "/path/to/.gemini/hooks/check-secrets.sh --api-key=abc123" -> "check-secrets.sh" * - "python /home/user/script.py --token=xy ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key