security-and-hardening
Skill1 starsChanged 48 days agoMITView on GitHub
Hardens code against vulnerabilities. Use when handling user input, authentication, data storage, or external integrations. Use when building any feature that accepts untrusted data, manages user sessions, or interacts with third-party services.
- Reads credentials
107 other projects use a version of this, 83 of them edited.
Adopted by
Most recently taken up by
- dzikrisyairozi/agent-skillsedited, first seen Nov 29, 2026
- jaydubya818/MissionControltheir own version, first seen Nov 29, 2026
- aakash1552005/universal-agent-skillsedited, first seen Nov 29, 2026
- karanmrn/karanagentskillsedited, first seen Nov 29, 2026
- karanmrn/kstackedited, first seen Nov 29, 2026
- e-landeros/gauntletedited, first seen Nov 29, 2026
Used with
Projects with it also use accessibility-engineering, observability-and-instrumentation and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
steven123397Skillaccessibility-engineering
Audits existing interfaces for WCAG 2.2 AA conformance and remediates the violations found. Use when auditing a page or component for accessibility, running axe-core or pa11y, triaging a11y violations, or checking screen reader and contrast issues before shipping.
Also in 4 projects that use this
jaydubya818Skillobservability-and-instrumentation
Add or review logs, metrics, traces, and actionable alerts.
Also in 42 projects that use this
MrCipherSmithSkillconstraint-driven-development
Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.
Also in 21 projects that use this
jaydubya818Skilldeprecation-and-migration
Retire APIs or migrate consumers and persistent data across releases.
Also in 46 projects that use this
HK-hubSkillsource-driven-development
Grounds every implementation decision in official documentation. Use when you want authoritative, source-cited code free from outdated patterns. Use when building with any framework or library where correctness matters.
Also in 49 projects that use this
seikaikyoSkilldoubt-driven-development
對非平凡決策啟動新鮮 context 對抗審查(找碴不背書),在修正還便宜的時候抓出錯誤方向。適用:高風險改動(production、資安敏感邏輯、不可逆操作)、不熟的程式碼、要宣稱「這樣是安全的 / 可行的」之前。機械性操作與一行修改不適用。
Also in 45 projects that use this
Other versions107 projects use a version of this.
Word for word · 0
None found.
Edited · 83
- addyosmani/agent-skills★ 121k17% same
- penpot/penpot★ 63k23% same
- ollaya-dev/ollaya★ 1.5k17% same
- shashankswe2020-ux/whoop-mcp★ 18143% same
- enes-alatas/spool★ 4917% same
- jmxt3/gitscape.ai★ 3343% same
- sampleXbro/agentsmesh★ 3143% same
- jaskirat1616/grok-skills★ 2215% same
- ishandutta2007/Awesome-Agent-Skills★ 2123% same
- JPeetz/agent-skills★ 2129% same
73 more not listed
Wrote their own version · 24
- vinvcn/addyosmani-agent-skills-zh★ 46same name
- moberghr/mtk-agent-toolkit★ 8same name
- ddddjaak/ae-skills★ 4same name
- dzevs/zynk★ 4same name
- momentmaker/kaijutsu★ 3same name
- oleg494/coding-kit★ 3same name
- bnalwalid/walidforge-skills★ 2same name
- codexskills/agent-forge★ 2same name
- GuillemRoca/agent-skills-android★ 2same name
- NashEQify/forge★ 2same name
14 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository71 other files it gives its agents.
- add-ai-chatSkill
- add-buildpadSkill
- add-commentsSkill
- add-cronSkill
- add-customer-onboardingSkill
- add-external-oauthSkill
- add-filesSkill
- add-i18nSkill
- add-keyboard-shortcutsSkill
- add-mcp-serverSkill
- add-microappSkill
- add-microfrontendSkill
- add-microfrontend-zonesSkill
- add-mobile-appSkill
- add-multitenancySkill
- add-notificationsSkill
- add-usersSkill
- add-workflowsSkill
- amplify-env-varsSkill
- atomic-writesSkill
- authentication-proxySkill
- buildpad-debugSkill
- buildpad-discoverySkill
- buildpad-implSkill
- buildpad-referenceSkill
- buildpad-reviewSkill
- buildpad-spec-batchSkill
- buildpad-spec-designSkill
- buildpad-spec-initSkill
- buildpad-spec-quickSkill
- buildpad-spec-requirementsSkill
- buildpad-spec-statusSkill
- buildpad-spec-tasksSkill
- buildpad-steering-customSkill
- buildpad-steeringSkill
- buildpad-validate-designSkill
- buildpad-validate-gapSkill
- buildpad-validate-implSkill
- buildpad-verify-completionSkill
- code-simplificationSkill
- context-engineeringSkill
- create-api-routeSkill
- create-collectionSkill
- create-componentSkill
- create-cronSkill
- create-featureSkill
- create-form-builderSkill
- create-migrationSkill
- create-projectSkill
- create-rbacSkill
- create-serviceSkill
- create-testsSkill
- create-workflowSkill
- daas-platformSkill
- debugging-and-error-recoverySkill
- generate-docsSkill
- git-workflow-and-versioningSkill
- grant-module-accessSkill
- hooks-extensionsSkill
- idea-refineSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 1 is common, 1 is distinctive, and 2 are very specific to this project.
1
Common
Most of the 103 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Read .buildpad/project.json at the project root.
- Very specific: line 18
If a folder named supabase at the project root holds a file named config.toml, or holds a folder named migrations that holds a file whose …
- Distinctive: line 273
No rate limiting on authentication endpoints
- Common: line 279
After implementing security-relevant code:
“Common” is measured: kept by at least 6 in 10 of the 103 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Security and Hardening
<!-- backend-gate:begin v1 -->Establish the backend first. A Buildpad project's backend is either the Buildpad Engine or Supabase, and some parts of this file hold for one of them only. Before you act on anything in this file, find the backend with these steps, in order, and stop at the first step that answers:
- Read
.buildpad/project.jsonat the project root. If it is JSON and its fieldbackendis"engine"or"supabase", that is the backend. If.buildpad/backend-answer.jsonnames the other backend, tell the developer the two files disagree, and follow.buildpad/project.json. - Otherwise read
.buildpad/backend-answer.jsonin the same way; if itsbackendis"engine"or"supabase", that is the backend. - If a folder named
supabaseat the project root holds a file namedconfig.toml, or holds a folder namedmigrationsthat holds a file whose name ends in.sql, the backend is Supabase. - Otherwise ask the developer once: "Is this project's backend the Buildpad Engine or
Supabase?" Write the answer to
.buildpad/backend-answer.jsonas{"buildpadBackendAnswer": 1, "backend": "engine"}or{"buildpadBackendAnswer": 1, "backend": "supabase"}, and ask the developer to commit that file. Do not add it to.gitignore. Never write.buildpad/project.json.
To find the backend, do not open an environment file (.env, .env.*) or an MCP configuration
file, and do not call a tool that returns project credentials.
Then follow only the parts for that backend. A part starts at a line that holds only a comment
whose text is buildpad + -backend: engine or buildpad + -backend: supabase, and ends at the
next line that holds only a comment whose text is /buildpad + -backend. A comment that merely
mentions a backend is not a part. A file whose first line, after any front matter, holds only a
comment whose text is buildpad + -backend-file: engine (or supabase) holds for that backend
only, and so does every file in a folder named engine-only or supabase-only. Skip the other
backend's parts and copy no code from them; everything else holds for both. On an Engine project, when this file says that
something is not available, tell the developer so and stop: do not build a substitute.
<!-- backend-gate:end -->Overview
Security-first development practices for web applications. Treat every external input as hostile, every secret as sacred, and every authorization check as mandatory. Security isn't a phase — it's a constraint on every line of code that touches user data, authentication, or external systems.
When to Use
- Building anything that accepts user input
- Implementing authentication or authorization
- Storing or transmitting sensitive data
- Integrating with external APIs or services
- Adding file uploads, webhooks, or callbacks
- Handling payment or PII data
The Three-Tier Boundary System
Always Do (No Exceptions)
- Validate all external input at the system boundary (API routes, form handlers)
<!-- buildpad-backend: supabase -->- Parameterize all database queries — never concatenate user input into SQL
<!-- /buildpad-backend --><!-- buildpad-backend: engine -->- Query through the API, never with SQL — the Engine refuses caller-supplied SQL; pass user input only as values of its API's
filter,sortandsearchparameters - In the mode
customer-tenants, keep customers apart — take no tenant id from user input except the one the switch route receives, which the Engine checks; hold no host credential or host session anywhere; let no request reach two customers with one token, and no server code hold two customers' sessions at once; key no cache in the application (server or browser) without the current customer, and reload the page on a switch
<!-- /buildpad-backend -->- Encode output to prevent XSS (use framework auto-escaping, don't bypass it)
- Use HTTPS for all external communication
<!-- buildpad-backend: supabase -->- Hash passwords with bcrypt/scrypt/argon2 (never store plaintext)
- Set security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options)
- Use httpOnly, secure, sameSite cookies for sessions
- Run
npm audit(orpnpm audit) before every release
Ask First (Requires Human Approval)
- Adding new authentication flows or changing auth logic
<!-- /buildpad-backend --><!-- buildpad-backend: engine -->- Never store or hash passwords in the application — on an Engine project the Engine holds every password; the application signs users in through it
- Set security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options)
- Use httpOnly, secure, sameSite cookies for the application's own session; the Engine itself takes only
Authorization: Bearer <access token>, never a cookie - Run
npm audit(orpnpm audit) before every release
Ask First (Requires Human Approval)
- Changing how the application signs users in (sign-up, magic links, password recovery and OAuth sign-in with any provider other than XAppHub are not available on an Engine project, except, in the mode
customer-tenantswith Self-onboarding on, theadd-customer-onboardingskill's flow: tell the developer so instead of building one; XAppHub sign-in follows theadd-external-oauthskill)
<!-- /buildpad-backend -->- Storing new categories of sensitive data (PII, payment info)
- Adding new external service integrations
- Changing CORS configuration
- Adding file upload handlers
- Modifying rate limiting or throttling
- Granting elevated permissions or roles
Never Do
- Never commit secrets to version control (API keys, passwords, tokens)
- Never log sensitive data (passwords, tokens, full credit card numbers)
- Never trust client-side validation as a security boundary
- Never disable security headers for convenience
- Never use
eval()orinnerHTMLwith user-provided data - Never store sessions in client-accessible storage (localStorage for auth tokens)
- Never expose stack traces or internal error details to users
DaaS-Specific Security
<!-- buildpad-backend: supabase -->Proxy Pattern Enforcement
❌ Browser → DaaS Backend (CORS issues, token exposure)
❌ Browser → supabase.auth.signIn() (cookie issues)
✅ Browser → /api/auth/login → Supabase Auth
✅ Browser → /api/items/* → DaaS BackendEnvironment Variables
# Server-side only (NEVER prefix with NEXT_PUBLIC_)
SUPABASE_SERVICE_ROLE_KEY=...
# Client-safe (only non-sensitive values)
NEXT_PUBLIC_SUPABASE_URL=...
NEXT_PUBLIC_SUPABASE_ANON_KEY=...
NEXT_PUBLIC_BUILDPAD_DAAS_URL=...CORS Configuration
// DaaS CORS must use explicit origins when credentials: 'include' is used
// NEVER use cors_origins: ["*"] with credentials
{
cors_origins: [
"http://localhost:3000",
"https://main.d1234abcde.amplifyapp.com"
],
cors_allow_credentials: true,
cors_max_age: 0 // bust cached preflight during changes
}<!-- /buildpad-backend --><!-- buildpad-backend: engine -->Proxy Pattern Enforcement
✅ Browser → /api/auth/login (the application's own route) → Engine sign-in, naming the tenant with X-Tenant-Id
✅ Browser → /api/items/* (the application's own route) → Engine, with Authorization: Bearer <access token>
✅ Browser → SDK → Engine, with Authorization: Bearer <access token>
❌ Any call to the Engine with cookies
❌ The MCP token, or any administrator token, on the data APIOn an Engine project every data call carries the signed-in user's access token as Authorization: Bearer <access token>, from the application's own server route or from the SDK. The Engine accepts no cookie session on its data API. The token in the project's MCP configuration is accepted only on the MCP endpoint /api/mcp: never send it, or any other administrator token, to the data API.
On an Engine project the Supabase client is kept for sign-in only. Password sign-in, session refresh, reading the signed-in user and sign-out work through it, and its default sign-out ends the user's sessions on every device. An account that holds no role in the project's tenant is refused at password sign-in. XAppHub sign-in also works through it while the project's XAppHub connector is connected: the application's server gives the ID token from XAppHub to signInWithIdToken with the provider my-apps, and ends the session of an account that holds no role yet (the add-external-oauth skill). Not available on an Engine project: sign-up; OAuth sign-in with any provider other than XAppHub; magic link and one-time code; password recovery; changing a password, an email or a profile through the Supabase client; the Supabase client's code exchange; and the Supabase administration API. The Platform's password-less handoff opens the Studio; it is not a way for an application to sign a user in.
On an Engine project with Customer_Tenants each customer of the application is a tenant of its own, and the project's tenant is the Blueprint every customer is copied from. Establish the tenancy mode as the add-multitenancy skill says: from the field tenancy of .buildpad/project.json, else from .buildpad/tenancy-answer.json. In the mode customer-tenants that skill's guide engine-customer-tenants replaces what ES-3, ES-4, ES-5, ES-7 and ES-9 say about the project's tenant; in the mode scope they hold as written.
Environment Variables
On an Engine project the environment is: NEXT_PUBLIC_SUPABASE_URL=<Engine_URL>, NEXT_PUBLIC_BUILDPAD_DAAS_URL=<Engine_URL>, NEXT_PUBLIC_SUPABASE_ANON_KEY=buildpad-engine-public-anon-key (a fixed value that is not a secret; the Engine does not read it, the Supabase client needs one), and NEXT_PUBLIC_BUILDPAD_TENANT_ID=<the project's tenant id>. There is no service-role key on an Engine project: add none.
# Client-safe values only: an Engine project has no server-side Supabase secret
NEXT_PUBLIC_SUPABASE_URL=<Engine_URL>
NEXT_PUBLIC_BUILDPAD_DAAS_URL=<Engine_URL>
NEXT_PUBLIC_SUPABASE_ANON_KEY=buildpad-engine-public-anon-key
NEXT_PUBLIC_BUILDPAD_TENANT_ID=<the project's tenant id>CORS Configuration
On an Engine project the data API accepts requests from any origin and never with cookies, as the project is provisioned. Change no cross-origin setting, and do not add the application's origin anywhere.
<!-- /buildpad-backend -->Input Validation
import { z } from 'zod';
const CreateTaskSchema = z.object({
title: z.string().min(1).max(200).trim(),
description: z.string().max(2000).optional(),
priority: z.enum(['low', 'medium', 'high']).default('medium'),
dueDate: z.string().datetime().optional(),
});
// Validate at the route handler
export async function POST(req: NextRequest) {
const result = CreateTaskSchema.safeParse(await req.json());
if (!result.success) {
return NextResponse.json(
{ error: { code: 'VALIDATION_ERROR', details: result.error.flatten() } },
{ status: 422 }
);
}
// result.data is now typed and validated
}Security Review Checklist
<!-- buildpad-backend: supabase -->Authentication
- Passwords hashed with bcrypt/scrypt/argon2 (salt rounds ≥ 12)
- Session tokens are httpOnly, secure, sameSite
- Login has rate limiting
- Password reset tokens expire
Authorization
- Every endpoint checks user permissions
- Users can only access their own resources
- Admin actions require admin role verification via DaaS RBAC
Input
- All user input validated at the boundary
- SQL queries are parameterized
<!-- /buildpad-backend --><!-- buildpad-backend: engine -->Authentication
- The application stores no password; the Engine holds them, and an administrator resets one in the Studio's Users module
- The application's own session cookies are httpOnly, secure, sameSite; calls to the Engine carry
Authorization: Bearer, never a cookie - Login has rate limiting
- No sign-up, magic link or password-recovery flow, and no OAuth sign-in with a provider other than XAppHub, is offered (not available on an Engine project), except, in the mode
customer-tenantswith Self-onboarding on, theadd-customer-onboardingskill's flow, where:BUILDPAD_ONBOARDING_KEYis read only in one server-only module, never with aNEXT_PUBLIC_prefix and never in a client component- The sign-up route checks the bot-check token before it calls the Engine
- The sign-up page shows the same text for a new and an existing address
Authorization
- Every endpoint forwards the user's own access token, so the Engine applies the user's roles, policies and permissions
- Users can only access their own resources (a permission's row filter, not code in the application)
- Admin actions require admin role verification: forward the user's token to
GET <Engine_URL>/api/permissions/meand readisAdmin
Input
- All user input validated at the boundary
- No SQL is built or sent: the Engine refuses caller-supplied SQL
<!-- /buildpad-backend -->- HTML output is encoded/escaped
Data
- No secrets in code or version control
- Sensitive fields excluded from API responses
- PII encrypted at rest (if applicable)
Infrastructure
- Security headers configured (CSP, HSTS, etc.)
- CORS restricted to known origins
- Dependencies audited for vulnerabilities
- Error messages don't expose internals
Common Rationalizations
| Rationalization | Reality |
| "This is an internal tool, security doesn't matter" | Internal tools get compromised. Attackers target the weakest link. |
| "We'll add security later" | Security retrofitting is 10x harder than building it in. Add it now. |
| "No one would try to exploit this" | Automated scanners will find it. Security by obscurity is not security. |
| "The framework handles security" | Frameworks provide tools, not guarantees. You still need to use them correctly. |
| "It's just a prototype" | Prototypes become production. Security habits from day one. |
Red Flags
- User input passed directly to database queries, shell commands, or HTML rendering
- Secrets in source code or commit history
- API endpoints without authentication or authorization checks
<!-- buildpad-backend: supabase -->- Missing CORS configuration or wildcard (
*) origins with credentials
<!-- /buildpad-backend --><!-- buildpad-backend: engine -->- A call to the Engine sent with cookies, or any change to the Engine's cross-origin setting
- In the mode
customer-tenants: a tenant id taken from user input anywhere but the switch route; a host credential or host session anywhere; one token reaching two customers, or server code holding two customers' sessions at once; a cache in the application keyed without the current customer, or a switch that does not reload the page
<!-- /buildpad-backend -->- No rate limiting on authentication endpoints
- Stack traces or internal errors exposed to users
- Dependencies with known critical vulnerabilities
Verification
After implementing security-relevant code:
pnpm auditshows no critical or high vulnerabilities- No secrets in source code or git history
- All user input validated at system boundaries
- Authentication and authorization checked on every protected endpoint
- Security headers present in response (check with browser DevTools)
- Error responses don't expose internal details
- Rate limiting active on auth endpoints
See Also
For detailed checklists, see references/security-checklist.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

