Skip to content

[codex] Handle spaces in pre-commit secret scan#204

Merged
yibeichan merged 2 commits into
mainfrom
codex/issue-202-pre-commit-spaces
Jun 11, 2026
Merged

[codex] Handle spaces in pre-commit secret scan#204
yibeichan merged 2 commits into
mainfrom
codex/issue-202-pre-commit-spaces

Conversation

@yibeichan

Copy link
Copy Markdown
Owner

Summary

  • scan staged filenames with NUL-delimited git output and xargs -0
  • keep canonical hook templates in hooks/ and cli/schist/sync.py in sync
  • bump hook template version to v3 so doctor can flag stale installed hooks
  • add regression coverage for a staged secret in a filename containing spaces

Root cause

The pre-commit hook piped newline-delimited staged paths through xargs without -0. xargs split filenames on whitespace, grep skipped the resulting nonexistent path fragments with stderr suppressed, and staged files with spaces could bypass secret scanning silently.

Validation

  • cd cli && uv run --with pytest --with . python -m pytest tests/test_pre_commit_hook.py
  • cd cli && uv run --with pytest --with . python -m pytest tests/

Closes #202

@yibeichan yibeichan marked this pull request as ready for review June 11, 2026 19:42
@yibeichan yibeichan merged commit bdee62a into main Jun 11, 2026
5 checks passed
@yibeichan yibeichan deleted the codex/issue-202-pre-commit-spaces branch June 11, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: pre-commit hook silently skips secret detection for filenames containing spaces

1 participant