Skip to content

Harden GitHook SSH command building and URL construction#64756

Merged
potiuk merged 1 commit intoapache:mainfrom
potiuk:fix-git-hook-shell-injection
Apr 6, 2026
Merged

Harden GitHook SSH command building and URL construction#64756
potiuk merged 1 commit intoapache:mainfrom
potiuk:fix-git-hook-shell-injection

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented Apr 6, 2026

  • Quote user-controlled values in _build_ssh_command with shlex.quote
  • Validate strict_host_key_checking against allowlist of valid SSH values
  • URL-encode username and auth token when embedding in repo URLs
  • Fix logic bug: not X or not Ynot X and not Y for git@/https:// check
  • Limit str.replace to first occurrence

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Claude Opus 4.6)

Generated-by: Claude Code (Claude Opus 4.6) following the guidelines

- Quote user-controlled values in _build_ssh_command with shlex.quote
- Validate strict_host_key_checking against allowlist of valid SSH values
- URL-encode username and auth token when embedding in repo URLs
- Fix logic bug: `not X or not Y` → `not X and not Y` for git@/https:// check
- Limit str.replace to first occurrence
@potiuk potiuk merged commit 8ad491d into apache:main Apr 6, 2026
149 checks passed
@potiuk potiuk deleted the fix-git-hook-shell-injection branch April 6, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants