You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: extensions/git auto-commit.sh stages every untracked file with git add . — risks committing secrets / artifacts #2478
`extensions/git/scripts/bash/auto-commit.sh` line 137 calls `git add .` to stage changes for the auto-commit, which indiscriminately stages every modified or untracked file in the working tree at the time the hook fires (after_specify / after_plan / after_tasks etc.). Anything not in `.gitignore` — `.env`, ad-hoc local debug files, build artifacts, IDE state — gets committed and pushed under `[Spec Kit] Auto-commit ...`.
The auto-commit hook is intended to capture Spec Kit artifacts (spec.md, plan.md, tasks.md, .specify/, etc.). Bulk `git add .` violates least-privilege staging and turns a workflow hook into a foot-gun for users who keep transient files in their workspace.
Steps to Reproduce
Initialize Spec Kit with the git extension enabled (the default on recent versions).
In the project root, create a file the user did not intend to commit: `echo 'OPENAI_API_KEY=sk-real' > .env.local` (or any uncommitted untracked file not covered by gitignore).
Run `/speckit.specify` or any command whose `after_*` hook triggers auto-commit.
Inspect `git log -p -1` — the unrelated untracked file is included in the auto-commit.
Expected Behavior
The hook stages only Spec Kit's own artifacts. Suggested set:
`.specify/` (excluding generated scratch state if any)
`.claude/`, `.gemini/`, `.copilot/` etc. depending on integration
`CLAUDE.md` / `AGENTS.md` if the integration appended SPECKIT markers
Actual Behavior
`git add .` stages everything not gitignored, including secrets the user simply hadn't gitignored yet.
Specify CLI Version
0.7.4.dev0
AI Agent
Claude Code
Suggested Fix
Replace line 137 with an explicit allowlist of paths Spec Kit owns. Example sketch (refine per integration):
_paths=(
\".specify\"\"specs\"\"CLAUDE.md\"\"AGENTS.md\"\"GEMINI.md\"# only the ones that exist
)
# Resolve integration-managed dotdirs (.claude/, .gemini/, .copilot/, .agents/ ...)case\"\$INTEGRATION\"in
claude) _paths+=(\".claude\") ;;
gemini) _paths+=(\".gemini\") ;;
copilot) _paths+=(\".github\") ;;
...
esac
# Filter to existing entries to avoid \"pathspec did not match\" errors:
_existing=()
for_pin\"\${_paths[@]}\";do [ -e\"\$_p\" ] && _existing+=(\"\$_p\");done
[ \${#_existing[@]} -gt 0 ] && git add -- \"\${_existing[@]}\"
If a generic allowlist is too tight (for users who customize), an opt-in env var (e.g. `SPECKIT_AUTO_COMMIT_ALL=1`) could preserve the current bulk behavior for users who want it.
Context
Surfaced during a defensive code review while bulk-installing Spec Kit + auto-commit hooks across 20 internal repos. Several of those repos contain medical / security tooling where stray local files would be high-impact to commit. The current `git add .` makes the extension unsafe to enable by default in any repo where users keep `.env*` or similar locally.
Closing this as works as designed because the git extension itself cannot know the set of files it must or must not commit. That is what .gitignore is designed to address.
Activity
mnriem commentedon May 7, 2026
Closing this as works as designed because the git extension itself cannot know the set of files it must or must not commit. That is what .gitignore is designed to address.