fix(gateguard): match every .claude/settings*.json variant

The pattern only accepted settings.json and settings.<suffix>.json, so a plain settings-dev.json stayed editable on the subagent paths that only gate sensitive or hard-linked targets. Use settings[^/]*.json and cover the dash-suffixed variants plus a non-settings control.
This commit is contained in:
hpz committed 2026-11-11 09:26:02 +08:00
1 parent 01c2426b2c
commit fc7ec24d56
2 files changed
+19 -1

No files matched your search

+1 -1
View File
@@ -300,7 +300,7 @@ function isSensitiveTarget(classPath) {
// `.claude/settings*.json` holds the switches for GateGuard and the other
// hooks, so it must count as restricted on every edit path — including the
// subagent paths that only deny sensitive or hard-linked targets (#3862).
const CLAUDE_SETTINGS_PATH = /(^|\/)\.claude\/settings(?:\.([^/]+))?\.json$/;
const CLAUDE_SETTINGS_PATH = /(^|\/)\.claude\/settings[^/]*\.json$/;
function isClaudeSettingsPath(classPath) {
return CLAUDE_SETTINGS_PATH.test(String(classPath || '').replace(/\\/g, '/').toLowerCase());