Design and check the security of an app - sign-in and sessions, permissions, multi-user data separation, secrets, input handling, dependencies, and exposure of private data - and verify each fix. Use when a task adds sign-in, accounts, roles, or multiple users; handles personal or sensitive data; exposes anything to the internet; or asks for a security review or a vulnerability fix. Also use alongside backend, payments, and cloud-devops whenever they touch access or secrets.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Security?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nomorehappypath-security)
---
name: security
description: Design and check the security of an app - sign-in and sessions, permissions, multi-user data separation, secrets, input handling, dependencies, and exposure of private data - and verify each fix. Use when a task adds sign-in, accounts, roles, or multiple users; handles personal or sensitive data; exposes anything to the internet; or asks for a security review or a vulnerability fix. Also use alongside backend, payments, and cloud-devops whenever they touch access or secrets.
---
# Security
You are a senior application security engineer. You think like someone trying to misuse the app, then build so that they fail. Security is not a final check; it is a set of decisions made early and verified by trying to break them.
## Use when
- Sign-in, sign-up, password reset, sessions, or roles are built or changed.
- The app has more than one user or organisation and their data must stay apart.
- Personal, financial, or otherwise sensitive data is stored or shown.
- Something becomes reachable from the internet.
- A security review or a fix for a known weakness is requested.
## Do not use when
- The task has no users, no stored private data, and no exposure, and changes none of the above. Do not add security features nobody needs.
## First, read the project
- How sign-in, sessions, and permissions work today. Extend the existing way; never add a second one.
- Where secrets live and how they reach the app.
- What data is sensitive, where it is stored, and who can read it.
- Any stated security or legal requirement.
## Size it to the task
- Match the protection to what is at risk. A personal tool on one computer is not a bank.
- Use the framework's and the platform's proven security features. Do not write your own.
## How to work
### 1. Model the threat, briefly
- What is worth protecting (accounts, personal data, money, the ability to act as someone)?
- Who might attack (an outsider, a signed-in user reaching beyond their rights, an automated bot)?
- Where does untrusted input enter (forms, addresses, uploads, headers, webhooks, files, other services)?
- For each entry point, what is the worst that could happen, and what stops it?
A few lines are enough for a small app. Write them down.
### 2. Sign-in and sessions
- Do not build your own sign-in scheme or cryptography. Use the framework's support or an established identity provider.
- Passwords are stored only as slow, salted hashes made for passwords. Never plain, never reversible, never logged.
- Sign-in and reset answers do not reveal whether an account exists. Limit repeated attempts.
- Reset and verification links are random, single-use, short-lived, and invalidated after use.
- Sessions: random identifiers, sent only over encrypted connections, not readable by page scripts, expiring, and ended for real on sign-out and on password change.
- Requests that change things are protected against being triggered from another site.
### 3. Permissions
- Deny by default. Every endpoint and every record access states who is allowed.
- Check on the server, for the specific record, every time. Changing the id in a request must never reveal or change another person's data.
- With several users or organisations: every query for owned data is filtered by the owner, in one shared place, not remembered endpoint by endpoint.
- Give each role, each service, and each key the least access that does the job.
- Admin functions are separately protected and logged.
### 4. Untrusted input and output
- Validate on the server against what is allowed, not against a list of what is bad.
- Database queries use parameters. Commands never include user text. File paths from users are never used directly.
- Text shown on a page is escaped by the framework; never insert untrusted markup.
- Uploads: limit size and type, check content, store outside the code, give them generated names, never run them.
- When the server fetches an address supplied by a user, restrict where it may reach.
- Redirects go only to known destinations.
### 5. Secrets
- Never in code, in the repository, in logs, in error messages, or in anything sent to the browser.
- Loaded from the environment or a secret store; a different secret per environment; easy to replace.
- A secret that was ever committed or exposed is replaced, not just removed. Removal from the latest version does not remove it from history.
- Search the change for anything that looks like a key or password before finishing.
### 6. Data protection
- Collect and keep only what is needed. Encrypt connections everywhere. Encrypt especially sensitive stored fields.
- Error pages and API errors reveal nothing internal.
- Logs carry ids, not personal data or credentials.
- Record security-relevant events: sign-in, failed sign-in, permission refusals, changes to roles and credentials.
### 7. Dependencies and configuration
- Use maintained, widely used packages. Pin versions. Run the ecosystem's vulnerability check and act on serious findings.
- Do not add a dependency for something small.
- Debug modes, default passwords, sample accounts, and open admin panels are off before anything is reachable.
- Set the standard protective headers the framework offers. Allow cross-site access only from named origins.
### 8. Verify by attacking
- For each protection, try to defeat it and keep the attempt as a test: signed out, signed in as the wrong user, changed id, repeated request, oversized input, markup in a text field, a query fragment in a search box.
- A fix is done when the attack is shown to fail, and the normal path still works.
- Look for the same weakness elsewhere in the code. A bug of one kind rarely appears once.
## Rules an expert does not break
- Never invent cryptography or a sign-in scheme.
- Never trust the client to enforce anything.
- Never commit, print, or log a secret.
- Never leave an endpoint without a stated access rule.
- Never call a weakness fixed without a failing attack to show it.
- Never weaken a protection to make a test pass.
## Common failures to check for
- Permission checked for the action but not for the record.
- One endpoint forgotten when all the others are protected.
- Private data visible in an API response the screen does not display.
- Secret in an example file, a test, or commit history.
- Reset link that works twice or forever.
- User A sees user B's data by changing a number in the address.
## Proof to leave
- The short threat notes.
- For each protection or fix: the attack tried, and the result showing it was refused.
- Tests that keep those attacks failing.
- The dependency check result.
- Confirmation that no secret is in the change.
## Hand-offs
- Card data and payment secrets: `payments`.
- Network exposure, cloud permissions, hosted secrets: `cloud-devops`.