security-protocol
Skill115 starsChanged 7 days agoMITView on GitHub
Use when writing or changing code that handles user input, uploaded files, authentication, sessions, authorisation, database queries, shell commands, file paths, outbound requests to user-supplied URLs, HTTP responses and headers, secrets or credentials, deserialisation, or new third-party dependencies.
- Reads credentials
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
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
- could be automatic: a setting could enforce it
- Distinctive: line 16
No exceptions. No workarounds.
- Distinctive: line 57
Govern the supply chain: Before adding a dependency or CI action, check maintenance, known vulnerabilities and install scripts.
- Very specific: line 59
Test the abuse cases: Write failing tests first (godmode:test-first) for at least: another user's resource ID, an oversized and a malformed …
- Distinctive: line 81
Put a secret in source code, a committed config file, a container image, a client bundle or a URL query string.
- Very specific: line 86
Add .env and its variants to .gitignore before the first commit, and commit only .env.example with placeholders.
- Distinctive: line 90
Treat a committed secret as compromised: rotate it first, then remove it from history.
- Distinctive: line 129
Commit, log or put in a URL any secret.
- Distinctive: line 137
Run the dependency audit and secret scan, and write the abuse-case tests.
- Distinctive: line 138
Check the change against the current OWASP Top 10 reference.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Security Protocol
Every point where data enters your code from outside is a trust boundary: request bodies, headers, cookies, URLs, files, environment, message queues, third-party API responses, and model output. Data that crosses one is hostile until it has been validated for what it claims to be and encoded for where it is going. Validate on the way in, encode on the way out, authorise every action, and keep secrets out of code.
The Prime Directive
NO EXTERNAL DATA REACHES A SYSTEM CALL, QUERY OR OUTPUT WITHOUT VALIDATIONNo exceptions. No workarounds. No shortcuts.
"System call" includes shell commands, file-system paths, outbound HTTP requests, deserialisers and eval-like functions. "Query" includes SQL, NoSQL, LDAP, XPath and search engines. "Output" includes HTML, JSON sent to browsers, logs, headers and prompts sent to a model.
When to Use
Required:
- Code that reads any request data, uploaded file, webhook, queue message or third-party response.
- Login, sign-up, password reset, sessions, tokens, API keys, roles or permissions.
- Building a query, a shell command, a file path or an outbound URL from anything not hard-coded.
- Rendering user-supplied content, setting response headers or configuring CORS.
- Adding, upgrading or vendoring a dependency, a CI action or a build tool.
- Error handling on any path that touches the above (failing open is a vulnerability).
Skip:
- Code with no external input and no privileged action, such as a pure function over trusted constants. If you are unsure whether data is external, it is.
The Protocol
- Map the boundaries. For the change in front of you, list every input source and every sink it reaches (database, shell, file system, network, browser, log). Write the list in the plan or PR description; it is the scope of the rest of this protocol.
- Validate at the boundary, with an allowlist. Parse input into a typed shape with a schema at the point it enters: type, length, format, range, and an explicit set of allowed values where one exists. Reject what does not fit; do not try to repair it. Validation runs on the server even when the client also validates. Work through the checklist below.
- Use the safe API for each sink.
- Queries: parameterised statements or a query builder, never string concatenation.
- Shell: avoid the shell; call the program with an argument array. If a shell is unavoidable, allowlist every argument.
- Paths: resolve the final path and check it stays inside the intended directory; never pass user input straight to file APIs.
- Outbound requests to user-supplied URLs: allowlist schemes and hosts, resolve the address and block private, loopback and link-local ranges, and do not follow redirects blindly.
- HTML: an auto-escaping template engine or framework; sanitise with a maintained library when rich text is required.
- Deserialisation: data formats only (JSON with a schema), never native object deserialisers on untrusted input.
- Authorise every action on the server. For each endpoint or command, check that this user may perform this action on this specific resource. Deny by default. Never trust a role, user ID or price sent by the client.
- Handle authentication and passwords with established libraries. Never write your own crypto, session or token scheme. Hash passwords with the algorithm the current OWASP guidance recommends (Argon2id first; parameters in the reference file). Session cookies are
HttpOnly,SecureandSameSite; sessions rotate on login and expire. - Keep secrets out of code, logs and URLs. See Secrets Management below.
- Fail closed. Errors in validation, authorisation or an external call must deny the action, release resources and return a generic message. Stack traces, SQL errors and internal paths never reach the user; they go to the server log without secrets.
- Set the security headers for any HTTP response (table below).
- Govern the supply chain. Before adding a dependency or CI action, check maintenance, known vulnerabilities and install scripts; commit lockfiles; pin CI actions to commit SHAs; run the ecosystem's audit (
npm audit,pip-audit,cargo audit,govulncheck ./...) and a secret scanner (for examplegitleaks git) in CI. - Test the abuse cases. Write failing tests first (
godmode:test-first) for at least: another user's resource ID, an oversized and a malformed input, an injection payload for each sink, and an expired or missing token. Record the run as evidence. - Check against the current OWASP Top 10 in references/owasp-top-10.md before you call security work done. The list is revised every few years; confirm the edition is still current (
godmode:grounding).
Input Validation Checklist
For every input field and parameter:
- Type is enforced by parsing, not by casting (a string that should be an integer is parsed and rejected if it fails).
- Length has a minimum and a maximum, including for arrays and nested objects.
- Format is checked with a strict pattern or a dedicated parser (emails, URLs, dates, UUIDs), anchored at both ends.
- Numbers and dates have a range.
- Enumerations are checked against an allowlist.
- Unknown fields are rejected or stripped, so a client cannot set
isAdminby adding it (mass assignment). - Text is normalised (Unicode, case, whitespace) before comparison or uniqueness checks.
- Files: size limit, type checked from content not from the extension or the client's content type, stored outside the web root under a generated name, never executed.
- Output is encoded for its context (HTML body, attribute, URL, JavaScript, CSS, SQL, shell, log line).
- Rate limits exist on authentication, password reset, and any expensive or enumerable endpoint.
Secrets Management
Never:
- Put a secret in source code, a committed config file, a container image, a client bundle or a URL query string.
- Log a secret, token, password, session ID or full card number, including in error messages and debug output.
- Reuse one secret across environments or services.
Always:
- Add
.envand its variants to.gitignorebefore the first commit, and commit only.env.examplewith placeholders. - Load secrets from the environment or a secret manager at start-up, and fail fast if one is missing.
- Give each environment and service its own credential with the least privilege it needs.
- Rotate on a schedule, and immediately when a secret may have leaked.
- Treat a committed secret as compromised: rotate it first, then remove it from history. Deleting the file in a later commit does not remove it.
Security Headers
<!-- Values from the OWASP HTTP Headers Cheat Sheet, fetched 2026-10-25: https://cheatsheetseries.owasp.org/cheatsheets/HTTP_Headers_Cheat_Sheet.html -->| Header | Starting value | Note |
Content-Security-Policy | default-src 'self'; frame-ancestors 'none'; object-src 'none' | Build up from restrictive; avoid unsafe-inline for scripts. frame-ancestors replaces X-Frame-Options in supporting browsers. |
Strict-Transport-Security | max-age=63072000; includeSubDomains; preload | HTTPS-only sites. Read the preload requirements before adding preload. |
X-Content-Type-Options | nosniff | Send correct Content-Type headers too. |
X-Frame-Options | DENY | For older browsers, alongside frame-ancestors. |
Referrer-Policy | strict-origin-when-cross-origin | Set explicitly rather than relying on browser defaults. |
Permissions-Policy | geolocation=(), camera=(), microphone=() | Disable every feature the site does not use. |
Cross-Origin-Opener-Policy | same-origin | Isolates the browsing context. |
X-XSS-Protection | 0, or omit | The old filter can create vulnerabilities; rely on CSP. |
Server, X-Powered-By | remove | They advertise the stack. |
CORS: allow specific origins only; never reflect the request origin or use * together with credentials.
Cognitive Traps
| Rationalisation | Truth |
| "It's an internal tool." | Internal networks get breached and internal users make mistakes. The boundary is the code, not the firewall. |
| "The framework handles it." | Frameworks have escape hatches (raw queries, unescaped output, disabled CSRF). Know which ones this code uses. |
| "The front end validates it." | Anyone can call the API directly. Only server-side checks count. |
| "Nobody would send that." | Attackers send exactly that, automatically, at scale. |
| "We'll add security later." | Later means rewriting the data flow. It is cheapest while the code is being written. |
| "It's only a prototype." | Prototypes ship. A secret committed today stays in history. |
| "This dependency is popular, so it's safe." | Popular packages are the most attractive supply-chain targets. Check it and pin it. |
| "An error here is harmless." | Failing open on an exception skips the check that would have denied the request. |
Guardrails
Never:
- Concatenate external input into a query, command, path, URL, template or
eval. - Ship an endpoint that checks authentication but not authorisation on the specific resource.
- Implement your own cryptography, password hashing or token format.
- Commit, log or put in a URL any secret.
- Catch an exception in a security check and continue as if it passed.
- Disable CSRF protection, certificate verification or output escaping to make something work.
Always:
- Map boundaries and sinks before writing the code.
- Validate with an allowlist schema on the server, and encode for the output context.
- Deny by default and fail closed.
- Run the dependency audit and secret scan, and write the abuse-case tests.
- Check the change against the current OWASP Top 10 reference.
Connections
godmode:system-design: authentication strategy, data flow and trust zones are design decisions; settle them there first.godmode:test-first: abuse cases are written as failing tests before the fix or feature.godmode:quality-gates: dependency audit, secret scanning and static analysis run as machine-enforced gates.godmode:grounding: OWASP guidance, library APIs and header behaviour are verified against current sources.godmode:code-review: reviewers check the boundary map and the sinks list.godmode:completion-gate: security work is done only with the test and scan output in hand.
In this repository33 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-briefingSkill
- codebase-conventionsSkill
- code-reviewSkill
- completion-gateSkill
- cross-model-reviewSkill
- delegated-executionSkill
- doctorSkill
- environment-awarenessSkill
- error-recoverySkill
- fault-diagnosisSkill
- groundingSkill
- inline-executionSkill
- intent-discoverySkill
- knowledge-captureSkill
- merge-protocolSkill
- model-routingSkill
- parallel-executionSkill
- performance-tuningSkill
- project-bootstrapSkill
- quality-gatesSkill
- rationaleSkill
- reference-firstSkill
- review-responseSkill
- system-designSkill
- task-planningSkill
- team-orchestrationSkill
- test-firstSkill
- ui-engineeringSkill
- ui-researchSkill
- using-godmodeSkill
- workspace-isolationSkill
- writing-skillsSkill
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.

