Skip to content

security: remove .claude/settings.json and block re-adding via semgrep#24584

Merged
ishaan-berri merged 1 commit intomainfrom
worktree-floofy-prancing-crystal
Mar 25, 2026
Merged

security: remove .claude/settings.json and block re-adding via semgrep#24584
ishaan-berri merged 1 commit intomainfrom
worktree-floofy-prancing-crystal

Conversation

@ishaan-berri
Copy link
Copy Markdown
Contributor

@ishaan-berri ishaan-berri commented Mar 25, 2026

Relevant issues

Removes accidentally committed .claude/settings.json which contained local Claude Code permissions referencing internal machine paths.

Changes

  • Delete .claude/settings.json from the repo
  • Add .semgrep/rules/security/no-claude-directory.yml — a semgrep rule (severity: ERROR) that fires if any file under .claude/ is committed

How enforcement works

The CircleCI semgrep job (.circleci/config.yml line 126) runs:

semgrep scan --config .semgrep/rules . --error

It scans the entire .semgrep/rules/ directory, so this new rule is picked up automatically. The --error flag means any finding blocks the build.

Pre-Submission checklist

  • No new test needed (file deletion + static analysis rule)
  • semgrep scan --config .semgrep/rules/security/no-claude-directory.yml passes on current tree (0 findings after deletion)
  • Verified the rule catches .claude/settings.json when the file exists (1 blocking finding)

Type

  • Bug fix / Security

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Mar 25, 2026 6:59pm

Request Review

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq bot commented Mar 25, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing worktree-floofy-prancing-crystal (b77e1cc) with main (7d7045c)

Open in CodSpeed

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 25, 2026

Greptile Summary

This PR removes an accidentally committed .claude/settings.json that contained developer-machine-specific Claude Code permissions (absolute paths to private local branches) and adds a semgrep rule to prevent the file from being re-added. The file deletion is correct and necessary. The defense-in-depth approach of adding a static-analysis rule is sound, but its stated blocking behaviour in CI is unverified.

Key findings:

  • .claude/settings.json is correctly removed; it exposed internal branch names (litellm-mcp-jwt-groups, litellm-claude-code-guardrails, etc.) and krrishdholakia's local machine paths.
  • ⚠️ No GitHub Actions workflow invokes semgrep scan, so the new rule does not automatically block PRs unless a Semgrep SaaS / GitHub App integration exists outside the visible workflow files. The PR description's claim that "the CI semgrep job runs with --error" is not evidenced by any workflow file.
  • ℹ️ .claude is already listed on line 5 of the root .gitignore, so the rule's message telling contributors to "add .claude/ to .gitignore instead" is misleading.

Confidence Score: 4/5

  • Safe to merge for the deletion itself; the semgrep rule's CI enforcement should be confirmed or added before treating it as a blocking guardrail.
  • The primary fix (deleting the leaked settings file) is straightforward and unambiguously correct. The new semgrep rule is well-formed and the author verified it locally. The main gap is the absence of a visible CI job to actually run it, which means the "blocking" claim is unverified. This is worth resolving but does not block the safety benefit of the deletion itself.
  • .semgrep/rules/security/no-claude-directory.yml — confirm CI integration exists or add a workflow step.

Important Files Changed

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]
Loading

Reviews (1): Last reviewed commit: "security: remove .claude/settings.json a..." | Re-trigger Greptile

Comment on lines +1 to +18
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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/ --error

this 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.

Comment on lines +3 to +7
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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
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.

@ishaan-berri ishaan-berri merged commit 67609e0 into main Mar 25, 2026
37 of 38 checks passed
@ishaan-berri ishaan-berri deleted the worktree-floofy-prancing-crystal branch March 26, 2026 22:30
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.

2 participants