nextblock-security
БесплатноБез исполняемых скриптовНе проверенNextBlock's security gate. Use before finishing ANY change that touches a migration, RLS policy, GRANT/REVOKE, Postgres function or trigger, the post-apply…
от nextblock-cms★ 20 звёзд на GitHubОб этом скилле
NextBlock security gate
Every item below is a real hole that shipped at least once (2026-10-17 → 10-21). The automated gates catch most of them; the checklist covers what they cannot see. A change is not done until the gates pass and every checklist line that applies has been answered.
1. Run the gates
npm run security:check # service-role boundary, migration lint, grant-pass lockstep (~5 s)
npx vitest run <paths you touched>
For a migration, a policy, a grant, or anything in GRANTS_SQL, also:
npm run db:migrate:check # read-only; the new file must be listed as pending
# replay every migration into a disposable local database, then the posture gate:
SUPABASE_PROJECT_ID=nextblock-ci npx supabase start --workdir libs/db/src -x realtime,storage-api,imgproxy,kong,mailpit,postgrest,postgres-meta,studio,edge-runtime,logflare,vector,supavisor
npm run security:db-posture -- --db-url postgresql://postgres:[email protected]:54322/postgres
npx supabase stop --workdir libs/db/src --no-backup
security:db-posture runs the post-apply grant pass first (every deploy does) and fails on any
FAIL or skipped assertion; it refuses non-local hosts. Never run it, or security-verify.sql,
against production. CI (.github/workflows/security.yml) runs all of this on every push and PR,
but run it before handing work back: CI only reports after the push.
A Stop hook (.Codex/settings.json → tools/scripts/Codex-security-stop-hook.mjs) runs
security:check whenever a turn ends with code changes and sends you back if it fails. Fix the
cause; never weaken a check, add an allowlist entry or a grandfather entry to make it pass
without saying so to the user.
2. Checklist
Server actions and routes
- Every exported function of a
'use server'file is a public POST endpoint, reachable from any route (proxy.tsonly gates/cmsURLs). It authenticates and authorizes itself BEFORE any read:requireCmsAdmin()/requireCmsStaff()(lib/auth/cms-actor.ts),requireEcomAdmin()/requireEcomStaff()(libs/ecommerce/.../require-ecom-role.ts), CortexrequireActorRole. - Never trust an id, price, role, owner or token from the client. Re-derive ownership on the
server (order access tokens:
order-access-token.ts; UCP carts:access_token_hash). - A payment provider's browser callback is attacker-controlled. Verify every id it names with the
provider's API before storing it, and never let it set a product, plan or paid state
(
evaluateFreemiusCheckoutLicense: a guest could attach any license to their order and read its key). A page that reveals a secret (license key) re-checks that it belongs to the order. - A helper that returns the service-role client enforces the enrolled second factor, not just the
role: server actions never pass the CMS layout's 2FA redirect. Use
getCmsActor(); the ecommerce lib uses the gate the app registers (lib/auth/second-factor-gate.ts). - A route handler that mutates with cookies needs the same checks; cron routes check their secret with a timing-safe compare.
Service-role client (bypasses every RLS policy)
- A module that builds, hands out or keys it imports
'server-only'; the key is read only bylib/setup/service-key.ts; import types from server modules withimport type; no secret behindNEXT_PUBLIC_ornext.config.jsenv. Gate:service-role-boundary.test.ts. - Under the service role RLS is not a boundary: the in-code role check IS the authorization.
RLS policies
- Every policy names its roles (
TO authenticated…); one withoutTOalso applies toanon. - No
USING (true)/WITH CHECK (true)foranon/authenticatedon a table holding users, orders, coupons, licenses, tokens, revisions, settings, 2FA, carts or messages. - An authorization column (
profiles.role) is pinned by column grants first (02025), thenWITH CHECKand a trigger. A self-serviceFOR UPDATEpolicy covers every granted column. - ADMIN branches on orders, profiles (other rows), site_settings secret tier and the commerce
tables use
is_admin_mfa()(aal2 when a factor is enrolled, 02023); CMS screens read those rows with the service role after the in-code check, never through the cookie client. - Draft/scheduled/archived rows and their children (media, stock, categories) stay staff-only.
Grants (decide whether a role may touch a table at all; RLS decides which rows)
- New table:
ENABLE ROW LEVEL SECURITY,GRANT SELECT … TO anononly if publicly readable, writes toauthenticated, service_roleonly.anonholds no write grant anywhere (02025). - Any revoke from
anon/authenticatedthat the blanket grants ofGRANTS_SQLhand back goes intoAPI_ROLE_REVOKE_SQLin BOTHapps/nextblock/tools/lib/migrate-core.mjsandapps/nextblock/lib/setup/schema-apply.ts, or the next deploy undoes it (02013 → 02024, 02022 → 02025). Gates:migration-grants.test.ts,migrate-core.test.mjs, the po
Установить nextblock-security в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл nextblock-security?
NextBlock's security gate. Use before finishing ANY change that touches a migration, RLS policy, GRANT/REVOKE, Postgres function or trigger, the post-apply grant pass, auth/2FA/roles, a server action ('use server'), an API route handler, the service-role client, uploads or server-side fetches of user URLs, webhooks, checkout/pricing/coupons/orders, Cortex tools or the MCP server, rendered HTML, or anything a 'use client' component imports. Runs the automated gates and walks the checklist of every vulnerability class found in the 2026-10 red-team.
Как установить скилл nextblock-security?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nextblock-security запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic