security: remove .claude/settings.json and block re-adding via semgrep#24584
security: remove .claude/settings.json and block re-adding via semgrep#24584ishaan-berri merged 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR removes an accidentally committed Key findings:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| .claude/settings.json | Correctly deletes accidentally committed developer-machine-specific Claude Code permissions file containing internal absolute paths (e.g., /Users/krrishdholakia/Documents/...) and references to private branch names. |
| .semgrep/rules/security/no-claude-directory.yml | Adds a semgrep ERROR-severity rule to block .claude/ files from being committed; however, no GitHub Actions workflow runs this rule, so enforcement exists only for manual scans unless a Semgrep SaaS integration is already configured elsewhere. The rule message also incorrectly implies .claude/ is not yet in .gitignore when it already is (line 5 of root .gitignore). |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Developer commits a file\nunder .claude/] --> B{.gitignore check\n.claude already listed}
B -->|File force-added\nor was pre-tracked| C[File included in commit]
B -->|Normal add| D[git silently ignores file ✅]
C --> E{CI Pipeline}
E --> F[test-linting.yml\nBlack / Ruff / MyPy / ggshield]
E --> G{Semgrep scan?\nno-claude-directory rule}
G -->|No workflow found| H[⚠️ Rule NOT enforced automatically]
G -->|If Semgrep SaaS / App configured| I[Rule fires → ERROR → PR blocked ✅]
F --> J[PR may still be merged\nwithout semgrep check]
Reviews (1): Last reviewed commit: "security: remove .claude/settings.json a..." | Re-trigger Greptile
| rules: | ||
| - id: no-claude-directory-committed | ||
| message: > | ||
| .claude/ directory must not be committed to the repository. | ||
| It contains local Claude Code settings (permissions, worktree paths) that are | ||
| developer-machine-specific and may expose internal paths or credentials. | ||
| Add .claude/ to .gitignore instead. | ||
| severity: ERROR | ||
| languages: [generic] | ||
| paths: | ||
| include: | ||
| - "/.claude/**" | ||
| - "/.claude/*" | ||
| pattern-regex: '[\s\S]+' | ||
| metadata: | ||
| category: security | ||
| tags: [supply-chain, secrets] | ||
| confidence: HIGH |
There was a problem hiding this comment.
No CI job actually runs this semgrep rule
The PR description states "The CI semgrep job runs with --error so this will block the PR", but there is no GitHub Actions workflow in .github/workflows/ that invokes semgrep scan. The existing linting pipeline (test-linting.yml) runs Black, Ruff, MyPy, and ggshield — but not semgrep.
Without a CI step such as:
- name: Run semgrep security rules
run: semgrep scan --config .semgrep/rules/security/ --errorthis rule file can only be run manually. A future developer could accidentally commit .claude/settings.json again and the rule would never fire in CI to block the PR.
If enforcement is via a Semgrep SaaS/GitHub App integration that's not visible in the workflow files, please document that in the PR or the rule file's metadata so it's clear to other contributors how the rule is enforced.
| message: > | ||
| .claude/ directory must not be committed to the repository. | ||
| It contains local Claude Code settings (permissions, worktree paths) that are | ||
| developer-machine-specific and may expose internal paths or credentials. | ||
| Add .claude/ to .gitignore instead. |
There was a problem hiding this comment.
Rule message references missing
.gitignore entry
The rule message advises "Add .claude/ to .gitignore instead", but .claude is already present on line 5 of the root .gitignore. The wording could confuse contributors into thinking this step hasn't been taken yet.
| message: > | |
| .claude/ directory must not be committed to the repository. | |
| It contains local Claude Code settings (permissions, worktree paths) that are | |
| developer-machine-specific and may expose internal paths or credentials. | |
| Add .claude/ to .gitignore instead. | |
| .claude/ directory must not be committed to the repository. | |
| It contains local Claude Code settings (permissions, worktree paths) that are | |
| developer-machine-specific and may expose internal paths or credentials. | |
| .claude/ is already listed in .gitignore; do not force-add files under this directory. |
Relevant issues
Removes accidentally committed
.claude/settings.jsonwhich contained local Claude Code permissions referencing internal machine paths.Changes
.claude/settings.jsonfrom the repo.semgrep/rules/security/no-claude-directory.yml— a semgrep rule (severity: ERROR) that fires if any file under.claude/is committedHow enforcement works
The CircleCI
semgrepjob (.circleci/config.ymlline 126) runs:It scans the entire
.semgrep/rules/directory, so this new rule is picked up automatically. The--errorflag means any finding blocks the build.Pre-Submission checklist
semgrep scan --config .semgrep/rules/security/no-claude-directory.ymlpasses on current tree (0 findings after deletion).claude/settings.jsonwhen the file exists (1 blocking finding)Type