Expand description
Auto-fix suggestion logic for SARIF output.
Auto-fix suggestions: turn each finding into “replace this credential
with ${ENV_VAR_NAME}” advice.
Tier-B moat innovation #15 + #17 from audits/legendary-2026-04-26:
moves keyhog from “find” to “fix.” We surface the suggestion in SARIF
result.fixes[] per the v2.2.0 spec; CLI consumers can apply the edit
interactively or in a pre-commit hook.
This module provides only the SUGGESTION step (deterministic env-var
name from service + the ${VAR} replacement string). Actually rewriting
files belongs in the CLI, where we can prompt the user before clobbering
their working tree.
Functions§
- env_
var_ name_ for_ service - Map a detector’s
servicestring to a conventional environment-variable name. Falls back to<UPPER_SERVICE>_KEYwhen the service isn’t in the curated map. - fix_
replacement_ text - Render the
${ENV_VAR_NAME}shell-interpolation replacement string for a detector. Reporters embed this in theirfixes[]output. Return the recommended replacement text for a leaked credential (e.g., “${STRIPE_KEY}”).