dsh-perm-gate 5.5.7 → 5.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.5.8 (2026-11-22)
4
+
5
+ - **敏感文件扩展名族(cc-safety-net `secret.ext.*` / `ext-pattern.*` 对标)**:密钥材料、keystore 数据库、VPN 配置与磁盘加密卷躲在扩展名而不是 basename 里——此前 `vault.kdbx`、`tunnel.ovpn`、`server.pem` 的读取与递归删除完全无人问津。预设表新增 3 行(表水位 v3→v4):deny `secret.ext-delete`(`rm#recursive`/`rm#force`/`remove-item#recursive`/`rmdir`/`del` × 23 个扩展名 glob:.pem/.pfx/.p12/.pkcs12/.jks/.kdb/.kdbx/.key/.keypair/.keystore/.keyring/.keychain/.kwallet/.ovpn/.tpm/.rdp/.fve/.bek/.asc/.agilekeychain/.psafe3/.cscfg/.pcap)+ ask 读面两行(文件工具 `secret.ext-read` / shell 读命令 `secret.ext-read-shell`,同清单)——贯彻 secret 口径「读 ask / 写删 deny」。`.pem` 可能只是公钥证书:ask 廉价、三行均可单条撤销。glob 语义是结尾锚定,`api.key.ts`/`keystore-notes.md` 零命中。
6
+
3
7
  ## 5.5.7 (2026-11-22)
4
8
 
5
9
  - **SSH 私钥变体覆盖(cc-safety-net `secret.variant.*` 对标)**:密钥被复制改名后(`id_rsa.bak`/`id_rsa-old`/`github_deploy_ed25519`)此前完全裸奔——现有 `*id_rsa` glob 不带尾星、裸点分名是段尾精确匹配。两层修复:① `cred-families.ts` ssh 家族补四个点分变体形状(`id_rsa.*`/`id_ed25519.*`/`id_ecdsa.*`/`id_dsa.*`,段首锚定,`myid_rsa.notes` 不吞),familyOfPath 命中 → P0 凭据写地板同步覆盖变体;② 预设表新增 2 行(表水位 v2→v3,新 id 不动旧行)——shell 读面 `secret.ssh-key-variants` 与文件工具读面 `cred.ssh-variants`,args 收 `*id_rsa*`/`*_rsa`/`*_ed25519`/`*_ecdsa` 宽底名 + 泛名 `credentials`/`*/credentials`。两行放在家族阶梯**之后**:规范形态保持家族 tag 与 rung 治理,只有阶梯漏掉的变体才落到新行;`cred.ssh-variants` 不受家族档位治理(readonly/readwrite 不静音它),误伤按行撤销。白名单对照(`docs/credentials-guide.md`、`config/credentials.json`、`credentials.yaml`)零命中。
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "dsh-perm-gate",
3
3
  "name": "dsh-perm-gate",
4
- "version": "5.5.7",
4
+ "version": "5.5.8",
5
5
  "description": {
6
6
  "en": "Deterministic-first, fail-closed permission gate for DeepSeek Harness 0.1.2+: a P0 hard-deny -> P1 precise session grant -> P2 static allow/deny rule chain -> P3 optional LLM classifier -> P4 ask pipeline over the tools/pre-execute waterfall, with a standalone CLI dry-run evaluator and an auditable decision log. Credential handling is a seven-family ladder (ssh/cloud/package/gitcreds/env/cli/db) with deny/ask/readonly/readwrite rungs kept in the rules document plus a paired write-exemption list; a protected-branch push switch keeps the P0 floor by default. It only vetoes with deny/ask and always delegates otherwise, and unknown or malformed rules fail loud instead of silently standing the gate down.",
7
7
  "zh": "面向 DeepSeek Harness 0.1.2+ 的确定性优先、失败即拒的权限闸门:在 tools/pre-execute 瀑布上串起 P0 硬拒绝 → P1 精确会话授权 → P2 静态 allow/deny 规则链 → P3 可选 LLM 语义分类 → P4 ask,并附带独立 CLI 干跑评估器与可审计的决策日志。凭据处理为七族阶梯(ssh/cloud/package/gitcreds/env/cli/db)× deny/ask/readonly/readwrite 四档,档位存规则文档 + 成对写豁免清单;保护分支强推开关默认保留 P0 地板。只以 deny/ask 否决、其余一律放行,规则未知或非法时直接报错,绝不静默失效。",
@@ -35,9 +35,10 @@ import { type CredFamily } from './cred-families.js';
35
35
  * whenever `PRESET_RULES_YAML` gains entries that existing installs must receive
36
36
  * (v1 added the seven `cred.*` family rows; v2 added the four
37
37
  * `network.cloud-metadata*` rows with the pre-execution extractor; v3 added the
38
- * two ssh-key-variant rows and the dotted-variant shapes to the ssh family).
38
+ * two ssh-key-variant rows and the dotted-variant shapes to the ssh family; v4
39
+ * added the three sensitive-file-extension rows).
39
40
  */
40
- export declare const PRESET_TABLE_VERSION = 3;
41
+ export declare const PRESET_TABLE_VERSION = 4;
41
42
  /** Tag prefix carried by every preset entry's reason; locates an entry for revocation. */
42
43
  export declare const PRESET_RULE_MARKER = "[deny-rule:";
43
44
  /** Extract the `[deny-rule:<id>]` tag from one reason string (undefined when untagged). */
@@ -50,7 +51,7 @@ export declare function presetRuleId(reason: unknown): string | undefined;
50
51
  * the joined pipeline — see evaluate.ts), token co-occurrence NEVER through
51
52
  * args (args is any-token OR).
52
53
  */
53
- export declare const PRESET_RULES_YAML = "defaultAction: ask\n\ndeny:\n # \u2500\u2500 Git \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n - command: [git]\n argv: { pipeline: [\"git reset --hard*\", \"git reset *--hard*\"] }\n reason: \"[deny-rule:git.reset-hard] Hard reset discards uncommitted changes. Use git reset --soft/--mixed, or git stash first.\"\n - command: [git]\n argv: { pipeline: [\"git reset --merge*\", \"git reset --abort*\"] }\n reason: \"[deny-rule:git.reset-merge] Merge reset discards in-progress merge work. Stash first, then reset --soft/--mixed.\"\n - command: [git]\n argv: { pipeline: [\"git clean *-f*\", \"git clean *--force*\"] }\n reason: \"[deny-rule:git.clean-force] git clean permanently deletes untracked files. Dry-run first: git clean -nd.\"\n - command: [git]\n argv: { pipeline: [\"git push origin *--delete*\", \"git push * --delete *\", \"git push --delete*\"] }\n reason: \"[deny-rule:git.push-delete] Deleting remote refs is visible to collaborators and needs explicit consent.\"\n - command: [git]\n argv: { pipeline: [\"git push --mirror*\", \"git push * --mirror\"] }\n reason: \"[deny-rule:git.push-mirror] Mirror push force-updates and deletes remote refs wholesale.\"\n - command: [git]\n argv: { pipeline: [\"git branch -D*\", \"git branch * -D\", \"git branch *--force-delete*\"] }\n reason: \"[deny-rule:git.branch-force-delete] git branch -D drops unmerged commits. Prefer merged-safe git branch -d.\"\n - command: [git]\n argv: { pipeline: [\"git stash drop*\"] }\n reason: \"[deny-rule:git.stash-drop] Dropping a stash entry is unrecoverable after GC. Verify with git stash list.\"\n - command: [git]\n argv: { pipeline: [\"git stash clear*\"] }\n reason: \"[deny-rule:git.stash-clear] Clearing all stashes destroys every saved worktree state.\"\n - command: [git]\n argv: { pipeline: [\"git tag -d*\", \"git tag --delete*\"] }\n reason: \"[deny-rule:git.tag-delete] Tag deletion removes release anchors.\"\n - command: [git]\n argv: { pipeline: [\"git reflog delete*\", \"git reflog expire*\"] }\n reason: \"[deny-rule:git.reflog-delete] Reflog deletion removes the last recovery path for lost commits.\"\n - command: [git]\n argv: { pipeline: [\"git rebase --abort*\"] }\n reason: \"[deny-rule:git.rebase-abort] Aborting a rebase discards resolution work. Prefer --continue/--skip.\"\n - command: [git]\n argv: { pipeline: [\"git merge --abort*\"] }\n reason: \"[deny-rule:git.merge-abort] Aborting a merge discards conflict resolution.\"\n - command: [git]\n argv: { pipeline: [\"git rm -rf *\", \"git rm *-rf *\", \"git rm * -rf\", \"git rm -fr *\", \"git rm --force *\", \"git rm * --force\", \"git rm -f *\", \"git rm * -f\"] }\n reason: \"[deny-rule:git.rm-force] git rm -f deletes working-tree files even when modified. Stash them first.\"\n - command: [git]\n argv: { pipeline: [\"git checkout --force *\", \"git checkout * --force\", \"git checkout -f *\", \"git checkout * -f\", \"git checkout -f\", \"git checkout * --force *\"] }\n reason: \"[deny-rule:git.checkout-force] Forced checkout overwrites local changes. git stash, then checkout.\"\n - command: [git]\n argv: { pipeline: [\"git checkout -- *\"] }\n reason: \"[deny-rule:git.checkout-double-dash] Path restore from checkout discards local edits. Use git stash push -- <path>.\"\n - command: [git]\n argv: { pipeline: [\"git checkout * -- *\"] }\n reason: \"[deny-rule:git.checkout-ref-path] Checking out a ref with a path overwrites working-tree files. Stash the paths first.\"\n - command: [git]\n argv: { pipeline: [\"git checkout *--pathspec-from-file*\"] }\n reason: \"[deny-rule:git.checkout-pathspec-from-file] Bulk path restore from a file can silently overwrite edits. List the pathspec, stash, then restore.\"\n - command: [git]\n argv: { pipeline: [\"git switch *--discard-changes*\"] }\n reason: \"[deny-rule:git.switch-discard-changes] --discard-changes throws away edits. git stash first.\"\n - command: [git]\n argv: { pipeline: [\"git switch --force *\", \"git switch * --force\", \"git switch -f *\", \"git switch * -f\"] }\n reason: \"[deny-rule:git.switch-force] Forced switch overwrites local changes. git stash first.\"\n - command: [git]\n # git restore <bare path> (the plain unstaged discard) is NOT ported here:\n # any glob broad enough to catch it also catches the harmless\n # git restore --staged <path> (G6) \u2014 only the explicit discard forms are\n # denied, the bare-path case stays in the prompt layer.\n argv: { pipeline: [\"git restore --worktree *\", \"git restore * --worktree *\", \"git restore * --worktree\", \"git restore -W *\"] }\n reason: \"[deny-rule:git.restore-worktree] Worktree restore discards local edits. git stash push -- <path> first.\"\n - command: [git]\n argv: { pipeline: [\"git worktree remove --force *\", \"git worktree remove * --force\", \"git worktree remove -f *\", \"git worktree remove * -f\"] }\n reason: \"[deny-rule:git.worktree-remove-force] Forced worktree removal discards uncommitted work in that tree.\"\n - command: [git]\n args: [\"alias.*\"]\n reason: \"[deny-rule:git.alias-config] Command-line Git aliases run arbitrary shell and cannot be analyzed.\"\n # params matches the RAW command string: the env-assignment word lands as the\n # simple command's lowercased word, so a command:[git] dimension would never\n # see this form \u2014 match on params alone.\n - params: { command: [\"*GIT_SSH_COMMAND=*\", \"*git_ssh_command=*\", \"*GIT_SSH=*\", \"*git_ssh=*\"] }\n reason: \"[deny-rule:git.ssh-env] Git network ops with an SSH env override execute unanalyzable code.\"\n\n # \u2500\u2500 Filesystem \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n - command: [\"rm#recursive\", \"rm#force\"]\n args: [\".git\", \".git/*\", \"*/.git\"]\n reason: \"[deny-rule:rm.git-metadata] Removing Git metadata destroys history and the gate's audit anchors.\"\n - command: [find]\n argv: { pipeline: [\"find .git*\"] }\n reason: \"[deny-rule:find.delete-git-metadata] Selecting .git for deletion destroys repository state.\"\n - command: [find]\n argv: { pipeline: [\"find * -delete\"] }\n reason: \"[deny-rule:find.delete] find -delete removes everything selected. Enumerate with plain find first.\"\n - command: [find]\n argv: { pipeline: [\"find *-exec rm*\", \"find *-delete*\"] }\n reason: \"[deny-rule:find.exec-rm-recursive-force] find -exec rm removes the whole tree per match. Dry-run plain find, delete explicit paths.\"\n - command: [rsync]\n argv: { pipeline: [\"rsync * --delete*\", \"rsync --delete*\"] }\n reason: \"[deny-rule:rsync.delete] rsync --delete erases destination files absent from the source. Dry-run with rsync -n --delete first.\"\n - command: [dd]\n argv: { pipeline: [\"dd * of=/dev/sd*\", \"dd * of=/dev/nvme*\", \"dd * of=/dev/mmcblk*\"] }\n reason: \"[deny-rule:dd.device-write] dd writing to a block device destroys the disk.\"\n - command: [mkfs, mke2fs, newfs, \"mkfs.*\"]\n reason: \"[deny-rule:mkfs.device] Formatting a device erases it.\"\n - command: [diskutil, wipefs, sgdisk, parted]\n reason: \"[deny-rule:disk.erase] Disk erase/partition/wipe operations destroy data.\"\n - command: [shred]\n reason: \"[deny-rule:shred.target] shred irreversibly destroys files (even --help/--version reach it).\"\n - command: [cat, head, tail, dd]\n args: [\"*/dev/sd*\", \"*/dev/nvme*\", \"*/dev/disk*\", \"*/dev/mmcblk*\"]\n reason: \"[deny-rule:redirect.block-device] Redirect target resolving to a disk device path.\"\n\n # \u2500\u2500 Network \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n # Cloud metadata endpoints (cc-safety-net network.cloud-metadata): one request\n # returns the instance's IAM/STS credentials. The known HTTP clients, raw\n # sockets and interpreters are denied outright; anything else that merely\n # names an endpoint escalates to ask (the catch-all rows in the ask section).\n # ips and domains live on separate rows \u2014 the dimension's sub-dimensions are\n # AND, and one target can only ever be one of the two shapes. At the proxy\n # face these rows fire for attributed traffic regardless of the command\n # (command is invisible there); pre-execution the network candidates come\n # from network-extract.ts.\n - command: [curl, wget, http, httpie, nc, ncat, netcat, socat, python, python3, node, deno, ruby, perl, php]\n network: { ips: [\"169.254.169.254\", \"169.254.170.2\", \"169.254.170.23\", \"fd00:ec2::254\", \"fd00:ec2::23\", \"100.100.100.200\"] }\n reason: \"[deny-rule:network.cloud-metadata-ips] A cloud metadata endpoint returns the instance's IAM credentials to whoever asks. Fetch through the platform SDK or IMDSv2 session auth \u2014 never a bare client call.\"\n - command: [curl, wget, http, httpie, nc, ncat, netcat, socat, python, python3, node, deno, ruby, perl, php]\n network: { domains: [\"metadata.google.internal\", \"metadata.goog\"] }\n reason: \"[deny-rule:network.cloud-metadata-domains] A cloud metadata endpoint returns the instance's IAM credentials to whoever asks. Fetch through the platform SDK or IMDSv2 session auth \u2014 never a bare client call.\"\n\n # \u2500\u2500 PowerShell \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n # Command words are lowercased by the decomposer \u2014 command dimensions must\n # carry the lowercased verb (Remove-Item \u2192 remove-item).\n - command: [\"remove-item#recursive\"]\n args: [\".git\", \".git/*\", \"*/.git\"]\n reason: \"[deny-rule:powershell.remove-item-git-metadata] Never target .git.\"\n - command: [powershell, pwsh]\n argv: { pipeline: [\"pwsh *Remove-Item*\", \"powershell *Remove-Item*\", \"pwsh *remove-item*\", \"powershell *remove-item*\"] }\n reason: \"[deny-rule:powershell.nested-recursive-delete-unread] A delete handed to pwsh/powershell in a non-literal form cannot be verified before it runs.\"\n - command: [\"remove-item#recursive\"]\n args: [\".\", \"./\"]\n reason: \"[deny-rule:powershell.remove-item-recursive-force-cwd-self] Deleting the current directory removes the project.\"\n - command: [\"remove-item#recursive\"]\n args: [\"../*\", \"..\\\\*\"]\n reason: \"[deny-rule:powershell.remove-item-recursive-force-outside-cwd] Deleting above the cwd escapes task scope.\"\n\n # \u2500\u2500 Command Prompt \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n # (The cc escaped-quote-collapse rule cannot be expressed faithfully with\n # these globs \u2014 every cmd /c recursion is nested behind a second parser,\n # so its true target is undecidable: it moves to the ask section instead.)\n - command: [cmd, rmdir, del]\n args: [\".git\", \".git/*\", \"*/.git\"]\n reason: \"[deny-rule:cmd.recursive-delete-git-metadata] Never target .git.\"\n - command: [rmdir, del]\n args: [\".\", \"./\"]\n reason: \"[deny-rule:cmd.recursive-delete-cwd-self] Deleting the current directory removes the project.\"\n - command: [rmdir, del]\n args: [\"../*\", \"..\\\\*\"]\n reason: \"[deny-rule:cmd.recursive-delete-outside-cwd] Delete above cwd escapes task scope.\"\n\n # \u2500\u2500 Secret targets (write/delete deny; reads are the ask section below) \u2500\u2500\n - command: [\"rm#recursive\", \"remove-item#recursive\", rmdir, del]\n args: [\"*/.ssh\", \"*/.aws\", \"*/.gnupg\", \".ssh\", \".aws\"]\n reason: \"[deny-rule:secret.delete-credential-path] Deleting credential stores destroys keys you cannot regenerate.\"\n - command: [echo, \"set-content\", \"out-file\"]\n args: [\".env\", \".env.*\"]\n reason: \"[deny-rule:secret.write-overwrite-env] Overwriting .env destroys existing secrets. Edit specific lines.\"\n - command: [\"rm#recursive\", \"remove-item#recursive\", rmdir, del]\n args: [\"*/.git-credentials\", \".git-credentials\"]\n reason: \"[deny-rule:secret.delete-git-credentials] Deleting the git credential store breaks push/pull auth.\"\n\nask:\n # Force push: ask, not deny (revoked from cc's deny ruling 2026-10-13).\n - command: [git]\n argv: { pipeline: [\"git push *--force*\", \"git push *-f*\"] }\n reason: \"[deny-rule:git.push-force] Force push rewrites shared history. Prefer git push --force-with-lease.\"\n\n # cmd /c recursion hides the real target behind a second parser (and quoting):\n # undecidable \u2192 ask, where cc denied only the drive-root-collapse variant.\n - command: [cmd]\n argv: { pipeline: [\"cmd /c *rmdir /s*\", \"cmd /c *del /s*\"] }\n reason: \"[deny-rule:cmd.recursive-delete-nested] cmd /c recursion nests a second parser; the real target cannot be resolved. Run rmdir/del directly so the gate can see the target.\"\n\n # Dynamic targets: this gate's ruling is \"undecidable \u2192 ask\", not fail-closed deny.\n - command: [\"rm#recursive\", \"remove-item#recursive\"]\n args: [\"$*\"]\n reason: \"[deny-rule:rm.recursive-force-dynamic-target] Recursive delete of a substitution-assembled target \u2014 verify the variable yourself.\"\n # The wrapper word xargs is stripped by the decomposer, so pipeline patterns\n # never see it \u2014 match the raw command string through the params dimension.\n - params: { command: [\"*xargs rm*\", \"*xargs del*\"] }\n reason: \"[deny-rule:xargs.rm-recursive-force-dynamic] xargs-fed removals have unverifiable target sets.\"\n - command: [parallel]\n argv: { pipeline: [\"parallel *rm*\", \"*| parallel*\"] }\n reason: \"[deny-rule:parallel.rm-recursive-force-dynamic] parallel-fed rm has unresolvable targets.\"\n - command: [awk]\n args: [\"*system(*\"]\n reason: \"[deny-rule:awk.system-dynamic] awk program text containing system() cannot be analyzed.\"\n # NOTE: cc's git checkout <ref> <path> ambiguity (G5) is NOT ported \u2014 a glob\n # cannot tell ref candidates from paths, and a broad pattern would prompt on\n # every git checkout -b new-branch. Documented residual gap.\n\n # The catch-all half of the metadata guard: a non-client call (echo, cat, a\n # script) that merely names an endpoint is a question, not a theft \u2014 ask.\n - network: { ips: [\"169.254.169.254\", \"169.254.170.2\", \"169.254.170.23\", \"fd00:ec2::254\", \"fd00:ec2::23\", \"100.100.100.200\"] }\n reason: \"[deny-rule:network.cloud-metadata-ips-any] This call names a cloud metadata endpoint. Confirm why instance credentials are being addressed before it runs.\"\n - network: { domains: [\"metadata.google.internal\", \"metadata.goog\"] }\n reason: \"[deny-rule:network.cloud-metadata-domains-any] This call names a cloud metadata endpoint. Confirm why instance credentials are being addressed before it runs.\"\n\n # Credential reads: ask (A2 ruling kept; egress combos stay in the prompt layer).\n - command: [cat, head, tail, type, \"get-content\", ls, dir, \"get-childitem\", \"select-string\"]\n args: [\".env\", \".env.*\", \"*.env\", \".npmrc\", \".pypirc\", \".netrc\", \".git-credentials\", \"id_rsa\", \"id_ed25519\", \"id_ecdsa\"]\n reason: \"[deny-rule:secret.read-credential-file] Reading a credential file requires confirmation. Echo only the keys you need via a filtered command.\"\n - command: [cat, head, tail, type, \"get-content\", ls, dir, \"get-childitem\"]\n args: [\"*/.ssh\", \"*/.ssh/*\", \"*/.aws\", \"*/.aws/*\", \"*/.gnupg\", \"*/.gnupg/*\", \"*/.config/gcloud/*\", \"*/.claude/*\", \"*/.codex/*\"]\n reason: \"[deny-rule:secret.read-home-credential-dirs] Browsing ssh/cloud/coding-CLI credential stores requires confirmation.\"\n\n # \u2500\u2500 Credential family ladder (read side) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n # One row per family, restricted to the file-READ tools: decide() pre-queries the\n # rule layer for READ calls, so these rows are what a read hits (shell reads stay\n # under the secret.* rows above, which match first in this section). The settings\n # face rewrites each row as the family's rung: deny - moved to the deny section;\n # ask - stays here; readonly/readwrite - enabled:false (readwrite additionally\n # lists the family in credWriteExemptFamilies for the engine's write clause).\n # Custom credentialPaths have no family and are never write-exempt.\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.ssh\", \"*/.ssh/*\", \"*id_rsa\", \"*id_ed25519\", \"*id_ecdsa\", \"*id_dsa\", \"*authorized_keys\"]\n reason: \"[deny-rule:cred.ssh] Reading SSH keys or authorized_keys needs confirmation (family rung: ask).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.aws\", \"*/.aws/*\", \"*/.config/gcloud\", \"*/.config/gcloud/*\", \"*/.azure\", \"*/.azure/*\", \"*credentials.yaml\", \"*credentials.json\"]\n reason: \"[deny-rule:cred.cloud] Reading cloud-provider credential stores needs confirmation (family rung: ask).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.npmrc\", \"*.npmrc\", \"*/.pypirc\", \"*/.netrc\", \"*_netrc\", \"*/pip.conf\"]\n reason: \"[deny-rule:cred.package] Reading package-registry auth files needs confirmation (family rung: ask).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.git-credentials\", \"*.git-credentials\"]\n reason: \"[deny-rule:cred.gitcreds] Reading the git credential store needs confirmation (family rung: ask).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.env\", \"*/.env.*\", \"*.env\"]\n reason: \"[deny-rule:cred.env] Reading project env files needs confirmation (family rung: ask; readwrite also lets edits, npm-login-style).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.claude\", \"*/.claude/*\", \"*/.codex\", \"*/.codex/*\", \"*/.config/gh\", \"*/.config/gh/*\"]\n reason: \"[deny-rule:cred.cli] Reading coding-CLI credential stores needs confirmation (family rung: ask).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.pgpass\", \"*pgpass\", \"*/.my.cnf\"]\n reason: \"[deny-rule:cred.db] Reading database credential files needs confirmation (family rung: ask).\"\n\n # SSH key variants (cc-safety-net secret.variant.* + the broad *_rsa|dsa|ed25519|ecdsa\n # shape + the generic \"credentials\" basename): keys get copied and renamed \u2014\n # id_rsa.bak, github_deploy_ed25519 and id_rsa-old deserve the same ask the\n # canonical names get. New rows (not a mutation of the seeded originals): the\n # watermark backfill is id-based and a mutated row would never reach existing\n # installs. They sit AFTER the family ladder so canonical shapes keep their\n # family tag (and rung governance); only what the ladder missed falls through.\n # The cred.ssh-variants row is NOT family-governed \u2014 a readonly/readwrite rung\n # on the ssh family does not silence it; revoke it by row if unwanted.\n - command: [cat, head, tail, type, \"get-content\", ls, dir, \"get-childitem\", \"select-string\"]\n args: [\"*id_rsa*\", \"*id_ed25519*\", \"*id_ecdsa*\", \"*id_dsa*\", \"*_rsa\", \"*_dsa\", \"*_ed25519\", \"*_ecdsa\", \"credentials\", \"*/credentials\"]\n reason: \"[deny-rule:secret.ssh-key-variants] This path looks like a private key under a renamed or variant basename. Reading key material needs confirmation.\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*id_rsa*\", \"*id_ed25519*\", \"*id_ecdsa*\", \"*id_dsa*\", \"*_rsa\", \"*_dsa\", \"*_ed25519\", \"*_ecdsa\", \"credentials\", \"*/credentials\"]\n reason: \"[deny-rule:cred.ssh-variants] Reading a private-key variant basename needs confirmation (not family-governed; revoke by row).\"\n\n # Self-protection: editing the gate's own rule sources needs confirmation \u2014\n # revocation must be a human act, not something an agent can slide through.\n # (Settings-namespace edits go through the host UI, not a tool call, and are\n # out of reach of this entry; documented gap.)\n - args: [\"*rules.yml\", \"*rules.yaml\", \"*deny-defaults*\"]\n reason: \"[deny-rule:gate.self-protection] This call touches the permission gate's own rule sources; changes here alter what the gate enforces.\"\n";
54
+ export declare const PRESET_RULES_YAML = "defaultAction: ask\n\ndeny:\n # \u2500\u2500 Git \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n - command: [git]\n argv: { pipeline: [\"git reset --hard*\", \"git reset *--hard*\"] }\n reason: \"[deny-rule:git.reset-hard] Hard reset discards uncommitted changes. Use git reset --soft/--mixed, or git stash first.\"\n - command: [git]\n argv: { pipeline: [\"git reset --merge*\", \"git reset --abort*\"] }\n reason: \"[deny-rule:git.reset-merge] Merge reset discards in-progress merge work. Stash first, then reset --soft/--mixed.\"\n - command: [git]\n argv: { pipeline: [\"git clean *-f*\", \"git clean *--force*\"] }\n reason: \"[deny-rule:git.clean-force] git clean permanently deletes untracked files. Dry-run first: git clean -nd.\"\n - command: [git]\n argv: { pipeline: [\"git push origin *--delete*\", \"git push * --delete *\", \"git push --delete*\"] }\n reason: \"[deny-rule:git.push-delete] Deleting remote refs is visible to collaborators and needs explicit consent.\"\n - command: [git]\n argv: { pipeline: [\"git push --mirror*\", \"git push * --mirror\"] }\n reason: \"[deny-rule:git.push-mirror] Mirror push force-updates and deletes remote refs wholesale.\"\n - command: [git]\n argv: { pipeline: [\"git branch -D*\", \"git branch * -D\", \"git branch *--force-delete*\"] }\n reason: \"[deny-rule:git.branch-force-delete] git branch -D drops unmerged commits. Prefer merged-safe git branch -d.\"\n - command: [git]\n argv: { pipeline: [\"git stash drop*\"] }\n reason: \"[deny-rule:git.stash-drop] Dropping a stash entry is unrecoverable after GC. Verify with git stash list.\"\n - command: [git]\n argv: { pipeline: [\"git stash clear*\"] }\n reason: \"[deny-rule:git.stash-clear] Clearing all stashes destroys every saved worktree state.\"\n - command: [git]\n argv: { pipeline: [\"git tag -d*\", \"git tag --delete*\"] }\n reason: \"[deny-rule:git.tag-delete] Tag deletion removes release anchors.\"\n - command: [git]\n argv: { pipeline: [\"git reflog delete*\", \"git reflog expire*\"] }\n reason: \"[deny-rule:git.reflog-delete] Reflog deletion removes the last recovery path for lost commits.\"\n - command: [git]\n argv: { pipeline: [\"git rebase --abort*\"] }\n reason: \"[deny-rule:git.rebase-abort] Aborting a rebase discards resolution work. Prefer --continue/--skip.\"\n - command: [git]\n argv: { pipeline: [\"git merge --abort*\"] }\n reason: \"[deny-rule:git.merge-abort] Aborting a merge discards conflict resolution.\"\n - command: [git]\n argv: { pipeline: [\"git rm -rf *\", \"git rm *-rf *\", \"git rm * -rf\", \"git rm -fr *\", \"git rm --force *\", \"git rm * --force\", \"git rm -f *\", \"git rm * -f\"] }\n reason: \"[deny-rule:git.rm-force] git rm -f deletes working-tree files even when modified. Stash them first.\"\n - command: [git]\n argv: { pipeline: [\"git checkout --force *\", \"git checkout * --force\", \"git checkout -f *\", \"git checkout * -f\", \"git checkout -f\", \"git checkout * --force *\"] }\n reason: \"[deny-rule:git.checkout-force] Forced checkout overwrites local changes. git stash, then checkout.\"\n - command: [git]\n argv: { pipeline: [\"git checkout -- *\"] }\n reason: \"[deny-rule:git.checkout-double-dash] Path restore from checkout discards local edits. Use git stash push -- <path>.\"\n - command: [git]\n argv: { pipeline: [\"git checkout * -- *\"] }\n reason: \"[deny-rule:git.checkout-ref-path] Checking out a ref with a path overwrites working-tree files. Stash the paths first.\"\n - command: [git]\n argv: { pipeline: [\"git checkout *--pathspec-from-file*\"] }\n reason: \"[deny-rule:git.checkout-pathspec-from-file] Bulk path restore from a file can silently overwrite edits. List the pathspec, stash, then restore.\"\n - command: [git]\n argv: { pipeline: [\"git switch *--discard-changes*\"] }\n reason: \"[deny-rule:git.switch-discard-changes] --discard-changes throws away edits. git stash first.\"\n - command: [git]\n argv: { pipeline: [\"git switch --force *\", \"git switch * --force\", \"git switch -f *\", \"git switch * -f\"] }\n reason: \"[deny-rule:git.switch-force] Forced switch overwrites local changes. git stash first.\"\n - command: [git]\n # git restore <bare path> (the plain unstaged discard) is NOT ported here:\n # any glob broad enough to catch it also catches the harmless\n # git restore --staged <path> (G6) \u2014 only the explicit discard forms are\n # denied, the bare-path case stays in the prompt layer.\n argv: { pipeline: [\"git restore --worktree *\", \"git restore * --worktree *\", \"git restore * --worktree\", \"git restore -W *\"] }\n reason: \"[deny-rule:git.restore-worktree] Worktree restore discards local edits. git stash push -- <path> first.\"\n - command: [git]\n argv: { pipeline: [\"git worktree remove --force *\", \"git worktree remove * --force\", \"git worktree remove -f *\", \"git worktree remove * -f\"] }\n reason: \"[deny-rule:git.worktree-remove-force] Forced worktree removal discards uncommitted work in that tree.\"\n - command: [git]\n args: [\"alias.*\"]\n reason: \"[deny-rule:git.alias-config] Command-line Git aliases run arbitrary shell and cannot be analyzed.\"\n # params matches the RAW command string: the env-assignment word lands as the\n # simple command's lowercased word, so a command:[git] dimension would never\n # see this form \u2014 match on params alone.\n - params: { command: [\"*GIT_SSH_COMMAND=*\", \"*git_ssh_command=*\", \"*GIT_SSH=*\", \"*git_ssh=*\"] }\n reason: \"[deny-rule:git.ssh-env] Git network ops with an SSH env override execute unanalyzable code.\"\n\n # \u2500\u2500 Filesystem \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n - command: [\"rm#recursive\", \"rm#force\"]\n args: [\".git\", \".git/*\", \"*/.git\"]\n reason: \"[deny-rule:rm.git-metadata] Removing Git metadata destroys history and the gate's audit anchors.\"\n - command: [find]\n argv: { pipeline: [\"find .git*\"] }\n reason: \"[deny-rule:find.delete-git-metadata] Selecting .git for deletion destroys repository state.\"\n - command: [find]\n argv: { pipeline: [\"find * -delete\"] }\n reason: \"[deny-rule:find.delete] find -delete removes everything selected. Enumerate with plain find first.\"\n - command: [find]\n argv: { pipeline: [\"find *-exec rm*\", \"find *-delete*\"] }\n reason: \"[deny-rule:find.exec-rm-recursive-force] find -exec rm removes the whole tree per match. Dry-run plain find, delete explicit paths.\"\n - command: [rsync]\n argv: { pipeline: [\"rsync * --delete*\", \"rsync --delete*\"] }\n reason: \"[deny-rule:rsync.delete] rsync --delete erases destination files absent from the source. Dry-run with rsync -n --delete first.\"\n - command: [dd]\n argv: { pipeline: [\"dd * of=/dev/sd*\", \"dd * of=/dev/nvme*\", \"dd * of=/dev/mmcblk*\"] }\n reason: \"[deny-rule:dd.device-write] dd writing to a block device destroys the disk.\"\n - command: [mkfs, mke2fs, newfs, \"mkfs.*\"]\n reason: \"[deny-rule:mkfs.device] Formatting a device erases it.\"\n - command: [diskutil, wipefs, sgdisk, parted]\n reason: \"[deny-rule:disk.erase] Disk erase/partition/wipe operations destroy data.\"\n - command: [shred]\n reason: \"[deny-rule:shred.target] shred irreversibly destroys files (even --help/--version reach it).\"\n - command: [cat, head, tail, dd]\n args: [\"*/dev/sd*\", \"*/dev/nvme*\", \"*/dev/disk*\", \"*/dev/mmcblk*\"]\n reason: \"[deny-rule:redirect.block-device] Redirect target resolving to a disk device path.\"\n\n # \u2500\u2500 Network \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n # Cloud metadata endpoints (cc-safety-net network.cloud-metadata): one request\n # returns the instance's IAM/STS credentials. The known HTTP clients, raw\n # sockets and interpreters are denied outright; anything else that merely\n # names an endpoint escalates to ask (the catch-all rows in the ask section).\n # ips and domains live on separate rows \u2014 the dimension's sub-dimensions are\n # AND, and one target can only ever be one of the two shapes. At the proxy\n # face these rows fire for attributed traffic regardless of the command\n # (command is invisible there); pre-execution the network candidates come\n # from network-extract.ts.\n - command: [curl, wget, http, httpie, nc, ncat, netcat, socat, python, python3, node, deno, ruby, perl, php]\n network: { ips: [\"169.254.169.254\", \"169.254.170.2\", \"169.254.170.23\", \"fd00:ec2::254\", \"fd00:ec2::23\", \"100.100.100.200\"] }\n reason: \"[deny-rule:network.cloud-metadata-ips] A cloud metadata endpoint returns the instance's IAM credentials to whoever asks. Fetch through the platform SDK or IMDSv2 session auth \u2014 never a bare client call.\"\n - command: [curl, wget, http, httpie, nc, ncat, netcat, socat, python, python3, node, deno, ruby, perl, php]\n network: { domains: [\"metadata.google.internal\", \"metadata.goog\"] }\n reason: \"[deny-rule:network.cloud-metadata-domains] A cloud metadata endpoint returns the instance's IAM credentials to whoever asks. Fetch through the platform SDK or IMDSv2 session auth \u2014 never a bare client call.\"\n\n # \u2500\u2500 PowerShell \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n # Command words are lowercased by the decomposer \u2014 command dimensions must\n # carry the lowercased verb (Remove-Item \u2192 remove-item).\n - command: [\"remove-item#recursive\"]\n args: [\".git\", \".git/*\", \"*/.git\"]\n reason: \"[deny-rule:powershell.remove-item-git-metadata] Never target .git.\"\n - command: [powershell, pwsh]\n argv: { pipeline: [\"pwsh *Remove-Item*\", \"powershell *Remove-Item*\", \"pwsh *remove-item*\", \"powershell *remove-item*\"] }\n reason: \"[deny-rule:powershell.nested-recursive-delete-unread] A delete handed to pwsh/powershell in a non-literal form cannot be verified before it runs.\"\n - command: [\"remove-item#recursive\"]\n args: [\".\", \"./\"]\n reason: \"[deny-rule:powershell.remove-item-recursive-force-cwd-self] Deleting the current directory removes the project.\"\n - command: [\"remove-item#recursive\"]\n args: [\"../*\", \"..\\\\*\"]\n reason: \"[deny-rule:powershell.remove-item-recursive-force-outside-cwd] Deleting above the cwd escapes task scope.\"\n\n # \u2500\u2500 Command Prompt \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n # (The cc escaped-quote-collapse rule cannot be expressed faithfully with\n # these globs \u2014 every cmd /c recursion is nested behind a second parser,\n # so its true target is undecidable: it moves to the ask section instead.)\n - command: [cmd, rmdir, del]\n args: [\".git\", \".git/*\", \"*/.git\"]\n reason: \"[deny-rule:cmd.recursive-delete-git-metadata] Never target .git.\"\n - command: [rmdir, del]\n args: [\".\", \"./\"]\n reason: \"[deny-rule:cmd.recursive-delete-cwd-self] Deleting the current directory removes the project.\"\n - command: [rmdir, del]\n args: [\"../*\", \"..\\\\*\"]\n reason: \"[deny-rule:cmd.recursive-delete-outside-cwd] Delete above cwd escapes task scope.\"\n\n # \u2500\u2500 Secret targets (write/delete deny; reads are the ask section below) \u2500\u2500\n - command: [\"rm#recursive\", \"remove-item#recursive\", rmdir, del]\n args: [\"*/.ssh\", \"*/.aws\", \"*/.gnupg\", \".ssh\", \".aws\"]\n reason: \"[deny-rule:secret.delete-credential-path] Deleting credential stores destroys keys you cannot regenerate.\"\n - command: [echo, \"set-content\", \"out-file\"]\n args: [\".env\", \".env.*\"]\n reason: \"[deny-rule:secret.write-overwrite-env] Overwriting .env destroys existing secrets. Edit specific lines.\"\n - command: [\"rm#recursive\", \"remove-item#recursive\", rmdir, del]\n args: [\"*/.git-credentials\", \".git-credentials\"]\n reason: \"[deny-rule:secret.delete-git-credentials] Deleting the git credential store breaks push/pull auth.\"\n\n # \u2500\u2500 Sensitive-file extensions (cc-safety-net secret.ext.* / ext-pattern.*) \u2500\u2500\n # Key material, keystore databases, VPN profiles, disk-encryption volumes and\n # credential-capable configs hide under extensions, not basenames \u2014 a read of\n # vault.kdbx deserves the same question as a read of id_rsa. Deletion is the\n # deny side (the secret ruling: read = ask, write/delete = deny); the two read\n # rows live in the ask section below. .pem may be a plain public certificate \u2014\n # the ask is cheap and each row revokes singly.\n - command: [\"rm#recursive\", \"remove-item#recursive\", rmdir, del]\n args: [\"*.pem\", \"*.pfx\", \"*.p12\", \"*.pkcs12\", \"*.jks\", \"*.kdb\", \"*.kdbx\", \"*.key\", \"*.keypair\", \"*.keystore\", \"*.keyring\", \"*.keychain\", \"*.kwallet\", \"*.ovpn\", \"*.tpm\", \"*.rdp\", \"*.fve\", \"*.bek\", \"*.asc\", \"*.agilekeychain\", \"*.psafe3\", \"*.cscfg\", \"*.pcap\"]\n reason: \"[deny-rule:secret.ext-delete] Deleting a file whose extension names key material, a keystore, a VPN profile or a disk-encryption volume destroys credentials you may not be able to regenerate.\"\n\nask:\n # Force push: ask, not deny (revoked from cc's deny ruling 2026-10-13).\n - command: [git]\n argv: { pipeline: [\"git push *--force*\", \"git push *-f*\"] }\n reason: \"[deny-rule:git.push-force] Force push rewrites shared history. Prefer git push --force-with-lease.\"\n\n # cmd /c recursion hides the real target behind a second parser (and quoting):\n # undecidable \u2192 ask, where cc denied only the drive-root-collapse variant.\n - command: [cmd]\n argv: { pipeline: [\"cmd /c *rmdir /s*\", \"cmd /c *del /s*\"] }\n reason: \"[deny-rule:cmd.recursive-delete-nested] cmd /c recursion nests a second parser; the real target cannot be resolved. Run rmdir/del directly so the gate can see the target.\"\n\n # Dynamic targets: this gate's ruling is \"undecidable \u2192 ask\", not fail-closed deny.\n - command: [\"rm#recursive\", \"remove-item#recursive\"]\n args: [\"$*\"]\n reason: \"[deny-rule:rm.recursive-force-dynamic-target] Recursive delete of a substitution-assembled target \u2014 verify the variable yourself.\"\n # The wrapper word xargs is stripped by the decomposer, so pipeline patterns\n # never see it \u2014 match the raw command string through the params dimension.\n - params: { command: [\"*xargs rm*\", \"*xargs del*\"] }\n reason: \"[deny-rule:xargs.rm-recursive-force-dynamic] xargs-fed removals have unverifiable target sets.\"\n - command: [parallel]\n argv: { pipeline: [\"parallel *rm*\", \"*| parallel*\"] }\n reason: \"[deny-rule:parallel.rm-recursive-force-dynamic] parallel-fed rm has unresolvable targets.\"\n - command: [awk]\n args: [\"*system(*\"]\n reason: \"[deny-rule:awk.system-dynamic] awk program text containing system() cannot be analyzed.\"\n # NOTE: cc's git checkout <ref> <path> ambiguity (G5) is NOT ported \u2014 a glob\n # cannot tell ref candidates from paths, and a broad pattern would prompt on\n # every git checkout -b new-branch. Documented residual gap.\n\n # The catch-all half of the metadata guard: a non-client call (echo, cat, a\n # script) that merely names an endpoint is a question, not a theft \u2014 ask.\n - network: { ips: [\"169.254.169.254\", \"169.254.170.2\", \"169.254.170.23\", \"fd00:ec2::254\", \"fd00:ec2::23\", \"100.100.100.200\"] }\n reason: \"[deny-rule:network.cloud-metadata-ips-any] This call names a cloud metadata endpoint. Confirm why instance credentials are being addressed before it runs.\"\n - network: { domains: [\"metadata.google.internal\", \"metadata.goog\"] }\n reason: \"[deny-rule:network.cloud-metadata-domains-any] This call names a cloud metadata endpoint. Confirm why instance credentials are being addressed before it runs.\"\n\n # Credential reads: ask (A2 ruling kept; egress combos stay in the prompt layer).\n - command: [cat, head, tail, type, \"get-content\", ls, dir, \"get-childitem\", \"select-string\"]\n args: [\".env\", \".env.*\", \"*.env\", \".npmrc\", \".pypirc\", \".netrc\", \".git-credentials\", \"id_rsa\", \"id_ed25519\", \"id_ecdsa\"]\n reason: \"[deny-rule:secret.read-credential-file] Reading a credential file requires confirmation. Echo only the keys you need via a filtered command.\"\n - command: [cat, head, tail, type, \"get-content\", ls, dir, \"get-childitem\"]\n args: [\"*/.ssh\", \"*/.ssh/*\", \"*/.aws\", \"*/.aws/*\", \"*/.gnupg\", \"*/.gnupg/*\", \"*/.config/gcloud/*\", \"*/.claude/*\", \"*/.codex/*\"]\n reason: \"[deny-rule:secret.read-home-credential-dirs] Browsing ssh/cloud/coding-CLI credential stores requires confirmation.\"\n\n # \u2500\u2500 Credential family ladder (read side) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n # One row per family, restricted to the file-READ tools: decide() pre-queries the\n # rule layer for READ calls, so these rows are what a read hits (shell reads stay\n # under the secret.* rows above, which match first in this section). The settings\n # face rewrites each row as the family's rung: deny - moved to the deny section;\n # ask - stays here; readonly/readwrite - enabled:false (readwrite additionally\n # lists the family in credWriteExemptFamilies for the engine's write clause).\n # Custom credentialPaths have no family and are never write-exempt.\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.ssh\", \"*/.ssh/*\", \"*id_rsa\", \"*id_ed25519\", \"*id_ecdsa\", \"*id_dsa\", \"*authorized_keys\"]\n reason: \"[deny-rule:cred.ssh] Reading SSH keys or authorized_keys needs confirmation (family rung: ask).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.aws\", \"*/.aws/*\", \"*/.config/gcloud\", \"*/.config/gcloud/*\", \"*/.azure\", \"*/.azure/*\", \"*credentials.yaml\", \"*credentials.json\"]\n reason: \"[deny-rule:cred.cloud] Reading cloud-provider credential stores needs confirmation (family rung: ask).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.npmrc\", \"*.npmrc\", \"*/.pypirc\", \"*/.netrc\", \"*_netrc\", \"*/pip.conf\"]\n reason: \"[deny-rule:cred.package] Reading package-registry auth files needs confirmation (family rung: ask).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.git-credentials\", \"*.git-credentials\"]\n reason: \"[deny-rule:cred.gitcreds] Reading the git credential store needs confirmation (family rung: ask).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.env\", \"*/.env.*\", \"*.env\"]\n reason: \"[deny-rule:cred.env] Reading project env files needs confirmation (family rung: ask; readwrite also lets edits, npm-login-style).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.claude\", \"*/.claude/*\", \"*/.codex\", \"*/.codex/*\", \"*/.config/gh\", \"*/.config/gh/*\"]\n reason: \"[deny-rule:cred.cli] Reading coding-CLI credential stores needs confirmation (family rung: ask).\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*/.pgpass\", \"*pgpass\", \"*/.my.cnf\"]\n reason: \"[deny-rule:cred.db] Reading database credential files needs confirmation (family rung: ask).\"\n\n # SSH key variants (cc-safety-net secret.variant.* + the broad *_rsa|dsa|ed25519|ecdsa\n # shape + the generic \"credentials\" basename): keys get copied and renamed \u2014\n # id_rsa.bak, github_deploy_ed25519 and id_rsa-old deserve the same ask the\n # canonical names get. New rows (not a mutation of the seeded originals): the\n # watermark backfill is id-based and a mutated row would never reach existing\n # installs. They sit AFTER the family ladder so canonical shapes keep their\n # family tag (and rung governance); only what the ladder missed falls through.\n # The cred.ssh-variants row is NOT family-governed \u2014 a readonly/readwrite rung\n # on the ssh family does not silence it; revoke it by row if unwanted.\n - command: [cat, head, tail, type, \"get-content\", ls, dir, \"get-childitem\", \"select-string\"]\n args: [\"*id_rsa*\", \"*id_ed25519*\", \"*id_ecdsa*\", \"*id_dsa*\", \"*_rsa\", \"*_dsa\", \"*_ed25519\", \"*_ecdsa\", \"credentials\", \"*/credentials\"]\n reason: \"[deny-rule:secret.ssh-key-variants] This path looks like a private key under a renamed or variant basename. Reading key material needs confirmation.\"\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*id_rsa*\", \"*id_ed25519*\", \"*id_ecdsa*\", \"*id_dsa*\", \"*_rsa\", \"*_dsa\", \"*_ed25519\", \"*_ecdsa\", \"credentials\", \"*/credentials\"]\n reason: \"[deny-rule:cred.ssh-variants] Reading a private-key variant basename needs confirmation (not family-governed; revoke by row).\"\n\n # The read half of the extension guard (see the deny-side secret.ext-delete).\n - tools: [read, read_image, grep, glob, ls, lsp]\n args: [\"*.pem\", \"*.pfx\", \"*.p12\", \"*.pkcs12\", \"*.jks\", \"*.kdb\", \"*.kdbx\", \"*.key\", \"*.keypair\", \"*.keystore\", \"*.keyring\", \"*.keychain\", \"*.kwallet\", \"*.ovpn\", \"*.tpm\", \"*.rdp\", \"*.fve\", \"*.bek\", \"*.asc\", \"*.agilekeychain\", \"*.psafe3\", \"*.cscfg\", \"*.pcap\"]\n reason: \"[deny-rule:secret.ext-read] Reading a file whose extension names key material, a keystore, a VPN profile or a disk-encryption volume needs confirmation (revoke by row).\"\n - command: [cat, head, tail, type, \"get-content\", ls, dir, \"get-childitem\", \"select-string\"]\n args: [\"*.pem\", \"*.pfx\", \"*.p12\", \"*.pkcs12\", \"*.jks\", \"*.kdb\", \"*.kdbx\", \"*.key\", \"*.keypair\", \"*.keystore\", \"*.keyring\", \"*.keychain\", \"*.kwallet\", \"*.ovpn\", \"*.tpm\", \"*.rdp\", \"*.fve\", \"*.bek\", \"*.asc\", \"*.agilekeychain\", \"*.psafe3\", \"*.cscfg\", \"*.pcap\"]\n reason: \"[deny-rule:secret.ext-read-shell] Reading a file whose extension names key material, a keystore, a VPN profile or a disk-encryption volume needs confirmation.\"\n\n # Self-protection: editing the gate's own rule sources needs confirmation \u2014\n # revocation must be a human act, not something an agent can slide through.\n # (Settings-namespace edits go through the host UI, not a tool call, and are\n # out of reach of this entry; documented gap.)\n - args: [\"*rules.yml\", \"*rules.yaml\", \"*deny-defaults*\"]\n reason: \"[deny-rule:gate.self-protection] This call touches the permission gate's own rule sources; changes here alter what the gate enforces.\"\n";
54
55
  export declare function parsePresetDoc(): PermissionsDoc;
55
56
  /** Every preset id, in table order. Client view + tests use this as the row key. */
56
57
  export declare function presetRuleIds(): string[];
@@ -37,9 +37,10 @@ import { CRED_FAMILY_IDS } from './cred-families.js';
37
37
  * whenever `PRESET_RULES_YAML` gains entries that existing installs must receive
38
38
  * (v1 added the seven `cred.*` family rows; v2 added the four
39
39
  * `network.cloud-metadata*` rows with the pre-execution extractor; v3 added the
40
- * two ssh-key-variant rows and the dotted-variant shapes to the ssh family).
40
+ * two ssh-key-variant rows and the dotted-variant shapes to the ssh family; v4
41
+ * added the three sensitive-file-extension rows).
41
42
  */
42
- export const PRESET_TABLE_VERSION = 3;
43
+ export const PRESET_TABLE_VERSION = 4;
43
44
  /** Tag prefix carried by every preset entry's reason; locates an entry for revocation. */
44
45
  export const PRESET_RULE_MARKER = '[deny-rule:';
45
46
  /** Extract the `[deny-rule:<id>]` tag from one reason string (undefined when untagged). */
@@ -224,6 +225,17 @@ deny:
224
225
  args: ["*/.git-credentials", ".git-credentials"]
225
226
  reason: "[deny-rule:secret.delete-git-credentials] Deleting the git credential store breaks push/pull auth."
226
227
 
228
+ # ── Sensitive-file extensions (cc-safety-net secret.ext.* / ext-pattern.*) ──
229
+ # Key material, keystore databases, VPN profiles, disk-encryption volumes and
230
+ # credential-capable configs hide under extensions, not basenames — a read of
231
+ # vault.kdbx deserves the same question as a read of id_rsa. Deletion is the
232
+ # deny side (the secret ruling: read = ask, write/delete = deny); the two read
233
+ # rows live in the ask section below. .pem may be a plain public certificate —
234
+ # the ask is cheap and each row revokes singly.
235
+ - command: ["rm#recursive", "remove-item#recursive", rmdir, del]
236
+ args: ["*.pem", "*.pfx", "*.p12", "*.pkcs12", "*.jks", "*.kdb", "*.kdbx", "*.key", "*.keypair", "*.keystore", "*.keyring", "*.keychain", "*.kwallet", "*.ovpn", "*.tpm", "*.rdp", "*.fve", "*.bek", "*.asc", "*.agilekeychain", "*.psafe3", "*.cscfg", "*.pcap"]
237
+ reason: "[deny-rule:secret.ext-delete] Deleting a file whose extension names key material, a keystore, a VPN profile or a disk-encryption volume destroys credentials you may not be able to regenerate."
238
+
227
239
  ask:
228
240
  # Force push: ask, not deny (revoked from cc's deny ruling 2026-10-13).
229
241
  - command: [git]
@@ -315,6 +327,14 @@ ask:
315
327
  args: ["*id_rsa*", "*id_ed25519*", "*id_ecdsa*", "*id_dsa*", "*_rsa", "*_dsa", "*_ed25519", "*_ecdsa", "credentials", "*/credentials"]
316
328
  reason: "[deny-rule:cred.ssh-variants] Reading a private-key variant basename needs confirmation (not family-governed; revoke by row)."
317
329
 
330
+ # The read half of the extension guard (see the deny-side secret.ext-delete).
331
+ - tools: [read, read_image, grep, glob, ls, lsp]
332
+ args: ["*.pem", "*.pfx", "*.p12", "*.pkcs12", "*.jks", "*.kdb", "*.kdbx", "*.key", "*.keypair", "*.keystore", "*.keyring", "*.keychain", "*.kwallet", "*.ovpn", "*.tpm", "*.rdp", "*.fve", "*.bek", "*.asc", "*.agilekeychain", "*.psafe3", "*.cscfg", "*.pcap"]
333
+ reason: "[deny-rule:secret.ext-read] Reading a file whose extension names key material, a keystore, a VPN profile or a disk-encryption volume needs confirmation (revoke by row)."
334
+ - command: [cat, head, tail, type, "get-content", ls, dir, "get-childitem", "select-string"]
335
+ args: ["*.pem", "*.pfx", "*.p12", "*.pkcs12", "*.jks", "*.kdb", "*.kdbx", "*.key", "*.keypair", "*.keystore", "*.keyring", "*.keychain", "*.kwallet", "*.ovpn", "*.tpm", "*.rdp", "*.fve", "*.bek", "*.asc", "*.agilekeychain", "*.psafe3", "*.cscfg", "*.pcap"]
336
+ reason: "[deny-rule:secret.ext-read-shell] Reading a file whose extension names key material, a keystore, a VPN profile or a disk-encryption volume needs confirmation."
337
+
318
338
  # Self-protection: editing the gate's own rule sources needs confirmation —
319
339
  # revocation must be a human act, not something an agent can slide through.
320
340
  # (Settings-namespace edits go through the host UI, not a tool call, and are
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-perm-gate",
3
- "version": "5.5.7",
3
+ "version": "5.5.8",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "tag": "latest"