Shellharden is a syntax highlighter and linter that semi-automates the rewriting of bash scripts to conform to ShellCheck recommendations, with particular focus on proper quoting practices.
The tool addresses the fundamental bash vulnerability where unquoted variables behave unpredictably through word splitting and glob expansion. Shellharden operates by displaying scripts with syntax highlighting in foreground colors while using background colors to suggest corrections. Its core capability is the `--transform` option, which applies these suggested changes automatically, effectively doing what ShellCheck can only recommend. The tool parses bash syntax to identify quoting issues and other vulnerable patterns, then presents both a visual representation of problems and the ability to fix them in a single pass.
Shellharden suits developers who maintain bash scripts and want to harden them against common vulnerabilities without manually implementing every ShellCheck suggestion. It works best for scripts where the developer can review changes and confirm the script does not intentionally rely on unquoted variable expansion. The tool differs from ShellCheck in that it provides automated correction rather than detection alone, though it assumes the user takes responsibility for code review before applying transformations. The README emphasizes that blind application of the transform option is unsafe; scripts that depend on word splitting or glob expansion will break, though the documentation suggests such patterns should generally be rewritten using safer alternatives like arrays.
The project maintains active test coverage instrumentation and includes fuzzing infrastructure to validate parser robustness. Development includes comprehensive test suites that require bash and tooling for coverage analysis and fuzz testing.