Getting Started (अपडेट: 3/6/2026)

Claude Code permission audit checklist: allow/deny और risky commands को 5 मिनट में जांचें

हर सुबह 5 मिनट में Claude Code allow/deny, risky commands, environment variables और logs audit करने की checklist.

Claude Code permission audit checklist: allow/deny और risky commands को 5 मिनट में जांचें

Permission audit तय करता है कि Claude Code आज क्या कर सकता है

सबसे बड़ा जोखिम हमेशा “सब कुछ allow कर दो” नहीं होता। असली काम में अक्सर छोटा सा छूटा हुआ नियम खतरा बनता है: कल आपने Bash(git push *) या बहुत बड़ा WebFetch allow किया, और आज production repository खोलते समय भूल गए कि वह permission अभी भी active है।

यह लेख Claude Code permissions के लिए 5 मिनट की morning audit routine देता है। allow का मतलब है कि tool बिना फिर से पूछे चल सकता है, ask का मतलब है हर बार confirmation चाहिए, और deny का मतलब है block करना। Beginner के लिए यह agent को दिए गए workbench की boundary है।

3 June 2026 तक official docs बताते हैं कि /permissions tool permissions और उनका source settings file दिखाता है। Rules deny -> ask -> allow order में evaluate होते हैं, इसलिए deny priority लेता है। Policy बनाने से पहले official Claude Code Permissions, Settings, और Environment variables जरूर देखें।

इसे पहले 30 मिनट की checklist के बाद और team setup के लिए CLAUDE.md starter template से पहले रखें। लक्ष्य bureaucracy नहीं है; लक्ष्य है काम को इतना छोटा करना कि उसे ठीक से review किया जा सके।

5 मिनट का audit flow

JSON से नहीं, आज के task के risk से शुरू करें। Documentation, dependency update, form change और deployment के लिए एक जैसी permissions नहीं होनी चाहिए।

flowchart TD
  A[Start session] --> B[Check git status]
  B --> C[Open /permissions]
  C --> D[Review allow / ask / deny]
  D --> E[Inspect env and logs policy]
  E --> F[Run local audit script]
  F --> G[Write handoff note]
कहां देखेंक्या जांचेंखतरे का संकेत
git status --shortपहले से changes हैं या नहींdiff है, लेकिन owner साफ नहीं
/permissionsहर rule किस file से आयापूरा Bash, WebFetch, या Edit allow में है
.claude/settings.jsonteam-shared rulesdeploy, billing, या payment links auto-allowed हैं
.claude/settings.local.jsonpersonal temporary rulesकल की exploration rule अभी भी बची है
envhistory और subprocess policyaudit logs चाहिए, पर CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 है

एक official nuance जरूरी है: deny में सिर्फ Bash लिखने से Bash tool Claude के context से हट जाता है। Bash(rm *) जैसी scoped rule tool को रखती है और matching calls को रोकती है। CLAUDE.md में “मत चलाओ” लिखना guidance है, boundary नहीं। Boundary permissions, mode, hook और sandbox से बनती है।

Repository-level settings का minimum example

Shared settings में risky actions को पहले block करना और judgment वाली actions को ask में रखना आसान रहता है। यह .claude/settings.json के लिए practical starting point है।

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "allow": [
      "Bash(npm run lint)",
      "Bash(npm run test *)",
      "Bash(git status *)",
      "Bash(git diff *)",
      "Read(./src/**)",
      "Read(./docs/**)"
    ],
    "ask": [
      "Bash(npm install *)",
      "Bash(pnpm add *)",
      "Bash(git push *)",
      "Bash(npm run deploy *)",
      "Edit(./.github/**)"
    ],
    "deny": [
      "Bash(curl *)",
      "Bash(wget *)",
      "Bash(rm -rf *)",
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)",
      "WebFetch(domain:pastebin.com)"
    ],
    "defaultMode": "default",
    "disableBypassPermissionsMode": "disable"
  },
  "env": {
    "CLAUDE_CODE_SUBPROCESS_ENV_SCRUB": "1"
  }
}

यहां “harness” का अर्थ agent का काम करने वाला scaffold है: Claude Code, settings, hooks, sandbox और logging expectations साथ में। बात model पर ज्यादा भरोसा करने की नहीं, बल्कि उसका workspace छोटा और स्पष्ट करने की है।

Bash(npm run test *) wildcard use करता है। Current docs final :* shorthand भी पहचानते हैं, जैसे Bash(ls:*), लेकिन सिर्फ pattern के end पर। Team settings में Bash(git push *) वाला form पढ़ना आसान है।

Copy-paste repository audit checklist

Audit को लंबा security document न बनाएं। यह block PR, issue या handoff note में paste करें।

claude_code_permission_audit:
  date: "2026-06-03"
  repository:
    name: "your-repo"
    branch: "feature/your-task"
    dirty_before_start: "yes/no"
  allowed_today:
    - "Read project files"
    - "Edit MDX and test files"
    - "Run npm run lint"
    - "Run npm run test -- --runInBand"
  ask_before:
    - "Install or update packages"
    - "Change auth, billing, analytics, or deploy config"
    - "Push commits or create releases"
  never_allow:
    - "Print .env, tokens, cookies, or private keys"
    - "Run curl/wget for arbitrary URLs"
    - "Delete git history or force-push"
  proof_required:
    - "git diff reviewed"
    - "test or build command captured"
    - "rollback note written"
  owner_handoff:
    reviewer: "name"
    open_questions:
      - "Which production URL should be checked?"

सबसे important line allowed_today है। यह permanent permission नहीं है; यह आज के task को proof के साथ finish करने के लिए minimum permission set है।

Node से risky permission patterns detect करें

Manual review में पूरा Bash allow या कल छोड़ा हुआ Bash(npx *) आसानी से miss होता है। इसे scripts/audit-claude-permissions.mjs के रूप में save करें और repository root से run करें।

#!/usr/bin/env node
import fs from "node:fs";
import os from "node:os";
import path from "node:path";

const repo = process.cwd();
const settingsFiles = [
  path.join(os.homedir(), ".claude", "settings.json"),
  path.join(repo, ".claude", "settings.json"),
  path.join(repo, ".claude", "settings.local.json"),
].filter((file) => fs.existsSync(file));

const riskyAllowRules = [
  { pattern: /^Bash$/i, severity: "high", reason: "all Bash commands are auto-allowed" },
  { pattern: /^PowerShell$/i, severity: "high", reason: "all PowerShell commands are auto-allowed" },
  { pattern: /^(Edit|Write)$/i, severity: "high", reason: "all file edits are auto-allowed" },
  { pattern: /^WebFetch$/i, severity: "medium", reason: "all web fetches are auto-allowed" },
  {
    pattern: /^Bash\((curl|wget|nc|ncat|ssh|scp|rsync)\b.*\)$/i,
    severity: "high",
    reason: "network or transfer command is auto-allowed",
  },
  {
    pattern: /^Bash\(.*\b(rm\s+-[^\)]*r|git\s+push|npm\s+install|pnpm\s+add|yarn\s+add|npx|docker\s+exec|devbox\s+run|mise\s+exec|terraform\s+apply|kubectl\s+apply)\b.*\)$/i,
    severity: "high",
    reason: "destructive or environment-changing command is auto-allowed",
  },
  {
    pattern: /^PowerShell\(.*\b(Remove-Item|Invoke-WebRequest|Invoke-RestMethod|Start-Process)\b.*\)$/i,
    severity: "high",
    reason: "risky PowerShell command is auto-allowed",
  },
];

const expectedDenyRules = [
  "Read(./.env)",
  "Read(./.env.*)",
  "Read(./secrets/**)",
  "Bash(curl *)",
  "Bash(wget *)",
];

const findings = [];

function add(file, severity, rule, reason) {
  findings.push({ file: path.relative(repo, file) || file, severity, rule, reason });
}

function readJson(file) {
  try {
    return JSON.parse(fs.readFileSync(file, "utf8"));
  } catch (error) {
    add(file, "high", "JSON", `cannot parse settings: ${error.message}`);
    return null;
  }
}

for (const file of settingsFiles) {
  const settings = readJson(file);
  if (!settings) continue;

  const permissions = settings.permissions ?? {};
  const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
  const ask = Array.isArray(permissions.ask) ? permissions.ask : [];
  const deny = Array.isArray(permissions.deny) ? permissions.deny : [];

  if (permissions.defaultMode === "bypassPermissions") {
    add(file, "high", "permissions.defaultMode", "session starts in bypassPermissions");
  }

  if (permissions.disableBypassPermissionsMode !== "disable") {
    add(file, "medium", "permissions.disableBypassPermissionsMode", "bypass mode is not disabled here");
  }

  if (settings.env?.CLAUDE_CODE_SKIP_PROMPT_HISTORY === "1") {
    add(file, "low", "CLAUDE_CODE_SKIP_PROMPT_HISTORY", "prompt history and transcripts are not written");
  }

  if (settings.env?.CLAUDE_CODE_SUBPROCESS_ENV_SCRUB !== "1") {
    add(file, "low", "CLAUDE_CODE_SUBPROCESS_ENV_SCRUB", "subprocess credential scrubbing is not enabled here");
  }

  for (const rule of allow) {
    for (const risky of riskyAllowRules) {
      if (risky.pattern.test(rule)) add(file, risky.severity, rule, risky.reason);
    }
  }

  for (const required of expectedDenyRules) {
    if (!deny.includes(required)) add(file, "low", required, "consider adding this deny rule");
  }

  if (ask.length === 0) {
    add(file, "low", "permissions.ask", "no ask rules are defined");
  }

  for (const rule of [...allow, ...ask, ...deny]) {
    if (/:\*[^)]/.test(rule)) {
      add(file, "medium", rule, "the :* shorthand only behaves as a wildcard at the end of a pattern");
    }
  }
}

if (settingsFiles.length === 0) {
  console.log("No Claude Code settings files found in user or repo scope.");
} else if (findings.length === 0) {
  console.log("No risky Claude Code permission patterns found.");
} else {
  console.table(findings);
}

if (findings.some((finding) => finding.severity === "high")) {
  process.exitCode = 1;
}

PowerShell में ऐसे चलाएं:

New-Item -ItemType Directory -Force -Path .\scripts | Out-Null
node .\scripts\audit-claude-permissions.mjs

यह script complete security engine नहीं है। यह review की शुरुआत बनाता है। Bash(curl *) block होने पर भी allowed Bash कोई Node script चला सकता है जो network access करे। Strong boundary के लिए permissions के साथ sandbox या container use करें।

चार concrete use cases

1. Articles और documentation

MDX, README, translations और screenshots का risk सामान्यतः कम होता है। अक्सर Read(./src/**), Edit(./site/src/content/**), Bash(npm run lint) और Bash(npm run test *) allow किए जा सकते हैं, जबकि npm install और git push ask में रहते हैं।

Pitfall CTA है। Gumroad links, contact forms और free PDF URLs revenue और leads को affect करते हैं, इसलिए public URL check definition of done में होना चाहिए।

2. Dependency updates

Dependency work package.json, lockfile, build behavior और कभी-कभी security posture बदलता है। Install commands को ask में रखें और reason, test command, rollback note मांगें।

अच्छा prompt: “Update candidates को तीन तक सीमित करें और breaking-change risk, proof command और rollback को table में दिखाएं.”

3. Auth, billing और analytics

Login, Stripe, Gumroad, ad tags, email destinations और webhooks human approval के पीछे रहने चाहिए। Tests pass होना काफी नहीं है। कौन सा data भेजा जा रहा है, failure double-charge कर सकता है या नहीं, और logs में personal data तो नहीं बच रहा है, यह देखें।

CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 prompt history और session transcripts को disk पर लिखने से रोकता है। Sensitive temporary sessions के लिए useful है, लेकिन team audit में decision trail कमजोर कर देता है।

4. Team handoff

काम दूसरे व्यक्ति को देते समय केवल permissions नहीं, decision trail छोड़ें। अच्छी note बताती है कि क्या allow था, क्या blocked रहा, कौन सा proof है और क्या अभी human check मांगता है।

Handoff note:
- Allowed today: Edit content files, run lint, run unit tests.
- Asked before: package changes, deploy, payment links, analytics tags.
- Denied: .env reads, arbitrary curl/wget, recursive delete.
- Evidence: npm run lint passed, git diff reviewed.
- Remaining risk: production URL has not been checked after deploy.

Common pitfalls

पहला, auto-allow बहुत broad कर देना। Bash, PowerShell, Edit या WebFetch पूरे के पूरे allow में रखना fast लगता है, लेकिन boundary कमजोर कर देता है।

दूसरा, URL filtering सिर्फ Bash pattern से करना। Bash(curl https://github.com *) fragile है, क्योंकि options, redirects, variables और spacing बदल सकते हैं। curl और wget block करें, फिर जरूरत हो तो WebFetch(domain:example.com) या hook use करें।

तीसरा, wrapper commands। Docs timeout और time जैसे कुछ wrappers की built-in handling बताते हैं, लेकिन npx, docker exec, devbox run, mise exec जैसे runners पर extra care चाहिए।

चौथा, Read/Edit deny को OS-level isolation समझ लेना। यह Claude Code built-in tools और recognized file commands पर काम करता है, लेकिन कोई arbitrary script internally file खोल सकता है।

पहले turn के लिए team prompt

Implementation prompt से पहले audit prompt दें।

Before changing files, audit Claude Code permissions for this repository.
Return:
1. allow rules that are safe for today's task
2. ask rules that should stay behind human approval
3. deny rules that protect secrets, deploys, and destructive commands
4. environment variables that affect logs or subprocess secrets
5. the smallest task you can complete with proof and rollback notes
Do not edit files until the audit is summarized.

Prompt अकेला security enforce नहीं करता। Settings और permissions UI enforce करते हैं। इसका value यह है कि पहली edit से पहले boundary visible हो जाती है।

Revenue path को सुरक्षित रखें

जो site readers को free PDF, Gumroad products या consulting तक ले जाती है, उसके लिए permission audit security के साथ revenue भी बचाता है। Basic workflow सीख रहे हैं तो free cheatsheet से शुरू करें। CLAUDE.md, permissions, hooks और MCP को team process में व्यवस्थित करना है तो Setup Guide तेज रास्ता है। Real repository rollout के लिए training और consultation देखें।

असल काम में इसे आजमाने के बाद सबसे उपयोगी routine यह रही: Claude Code से edit करवाने से पहले git status, /permissions, .claude/settings.local.json और audit script जांचें। Gumroad links और deploy settings को ask में रखने से session थोड़ा धीमा होता है, लेकिन review तेज होता है क्योंकि revenue को छूने वाली हर change के साथ approval reason दिखता है।

#claude-code #permissions #security #setup #workflow #claude-md
मुफ़्त

मुफ़्त PDF: Claude Code cheatsheet

Email डालें और commands, review habits तथा safe workflow वाली एक-page PDF पाएँ.

हम आपका data सुरक्षित रखते हैं और spam नहीं भेजते.

Masa

लेखक के बारे में

Masa

Claude Code workflow और team adoption पर काम करने वाला engineer.