a8aa79e75f
Повод: 26.06.2026 параллельная сессия выполнила yc managed-postgresql database delete liderra + recreate на боевом кластере → переналила схему со старыми небезопасными RLS-политиками → вход в портал лёг (см. db/CHANGELOG_schema.md v8.57). - .claude/hooks/prod-db-guard.mjs (PreToolUse Bash|PowerShell): блокирует ТОЛЬКО снос/пересоздание боевой базы/кластера (yc database/cluster delete, DROP DATABASE liderra). Обычную работу (чтение, запросы, тесты на liderra_testing, migrate) НЕ трогает. Override владельца: маркер PROD-DESTROY-OK или env ALLOW_PROD_DB_DESTROY=1. Проверено 7 сценариями + живым запуском (echo с паттерном заблокирован). - .claude/hooks/prod-db-pointer.mjs (SessionStart): инжектит указатель «живая база = кластер c9q2cvtjpq3hgq6l0r96, старая копия на VM не трогать, тесты на liderra_testing» — чтобы сессия не путала актуальную БД со stale-копией и не «пересобирала». - .claude/settings.json: deny-паттерны (yc database/cluster delete) + оба хука. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
69 lines
1.8 KiB
JSON
69 lines
1.8 KiB
JSON
{
|
|
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
"permissions": {
|
|
"allow": [
|
|
"Bash(npm install:*)",
|
|
"Bash(npm run lint:md:*)",
|
|
"Bash(npm run spell:*)",
|
|
"Bash(npm run links:*)",
|
|
"Bash(npm run lint:css:*)",
|
|
"Bash(npm run a11y:*)",
|
|
"Bash(npm run check:docs:*)",
|
|
"Bash(npm run lint:md:fix:*)",
|
|
"Bash(npm run sast:*)",
|
|
"Bash(git status)",
|
|
"Bash(git diff)",
|
|
"Bash(git log:*)",
|
|
"Bash(git add:*)",
|
|
"Bash(node --version)",
|
|
"Bash(npm --version)",
|
|
"Bash(npx --version)",
|
|
"Bash(./bin/gitleaks:*)",
|
|
"Bash(./bin/lychee:*)",
|
|
"PowerShell(Get-ChildItem:*)",
|
|
"PowerShell(Test-Path:*)",
|
|
"PowerShell(Expand-Archive:*)",
|
|
"Read(**)",
|
|
"Glob(**)",
|
|
"Grep(**)"
|
|
],
|
|
"deny": [
|
|
"Bash(rm -rf:*)",
|
|
"Bash(git push --force:*)",
|
|
"Bash(git reset --hard:*)",
|
|
"Bash(npm publish:*)",
|
|
"Bash(yc managed-postgresql database delete:*)",
|
|
"Bash(yc managed-postgresql cluster delete:*)",
|
|
"PowerShell(Remove-Item:*-Recurse*)",
|
|
"PowerShell(Set-ExecutionPolicy:* -Scope LocalMachine*)",
|
|
"PowerShell(yc managed-postgresql database delete:*)",
|
|
"PowerShell(yc managed-postgresql cluster delete:*)"
|
|
]
|
|
},
|
|
"hooks": {
|
|
"SessionStart": [
|
|
{
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node .claude/hooks/prod-db-pointer.mjs",
|
|
"timeout": 10
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"PreToolUse": [
|
|
{
|
|
"matcher": "Bash|PowerShell",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node .claude/hooks/prod-db-guard.mjs",
|
|
"timeout": 10,
|
|
"statusMessage": "prod-db-guard"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
} |