Provides application security guidance for design and implementation. Use when reviewing auth, data handling, supply-chain controls, or AppSec architecture.
Use this skill for application-layer security: authentication, authorization, input and output handling, cryptography, supply-chain controls, API security, threat modeling, and security reviews. It is the AppSec decision layer, not general backend or infrastructure hardening.
Every major cloud provider has two surface-similar storage classes: one encrypted-at-rest with no readback, one plaintext-visible in the dashboard. Picking the wrong one is silent — the app still works — and the audit log for who-read-what exists only on the encrypted form. Plaintext reads are invisible.
Provider
Yes Encrypted, never-readable
No Plaintext, dashboard-visible
Cloudflare Workers
wrangler secret put (API type: secret_text)
[vars] in wrangler.toml, Workers > Variables tab
Vercel
Environment Variables marked "Sensitive"
Standard Environment Variables
GitHub Actions
Repository / Organization Secrets
env: in workflow YAML, repository Variables
AWS
Secrets Manager, SSM Parameter Store SecureString
SSM String, plain Lambda env vars
Kubernetes
Secret + KMS envelope (SOPS, Sealed Secrets)
ConfigMap, plain env vars
Rules:
If the provider distinguishes "Secret" from "Variable" (or "Sensitive" from "Standard"), always use the encrypted form for: API keys, OAuth client secrets, JWT signing keys, database passwords, webhook secrets, push certificates.
Identifiers that already appear in client builds (bundle IDs, Team IDs, KV namespace IDs, project IDs) are not secrets and belong in the plaintext config — putting them in the secret store both clutters and signals false risk.
Verify after storing.wrangler secret list returns type: secret_text when encrypted. If you see plain_text or the value appears under [vars], the credential is plaintext — treat as compromised and rotate.
PEM and other multi-line secrets must use CLI redirect, never dashboard paste. Dashboards silently mangle newlines: wrangler secret put APNS_AUTH_KEY --name worker < AuthKey_XXX.p8.
If you suspect a secret was stored as plaintext: treat it as compromised. Revoke at the issuer, generate a new credential, store correctly, then verify. Deleting the visible plaintext copy does not invalidate any cached or scraped value. Rotation is a no-regret action; the cost is one credential refresh, the alternative is undetectable use.
When to Use
Review or design auth, session, token, or authorization flows.
Validate input handling, uploads, rendering, and untrusted-data boundaries.
Secure APIs, webhooks, browser apps, and admin surfaces.
Threat-model a feature or AppSec architecture choice.
Harden dependency, build, artifact, and release paths.
Review agentic or MCP-connected applications from an AppSec angle.
Route Elsewhere
General backend engineering without a security focus: use software-backend.
Infrastructure hardening, IAM, cluster policy, or cloud posture: use ops-devops-platform.
ML pipeline or model-ops governance: use ai-mlops.
Compliance-only interpretation with no implementation choice: route to legal or compliance stakeholders.
Defaults
Use OWASP Top 10:2025 for risk framing (released January 2026, replaces 2021 edition), ASVS for requirements depth, and SSDF for SDLC baselines.
Treat standards, browser behavior, and current exploit trends as volatile until rechecked.
Prefer passkeys where feasible and sessions for browser-first apps.
Model trust boundaries before choosing controls.
Treat tool calls, retrieved content, and long-term memory as untrusted input in agentic systems.
Workflow
Identify the asset, trust boundary, attacker capability, and failure consequence.
Classify the problem: auth, authZ, untrusted input, API, supply chain, agentic flow, or secure-design issue.
Choose the control family from the relevant reference.
Apply the concrete safeguards and define verification depth.
Recheck volatile standards and provider behavior before final recommendations.
ASCII Flow
AppSec task
-> Identify asset, trust boundary, attacker, and consequence
-> Classify auth, authZ, input, API, supply chain, agentic, or design risk
-> Choose control family and verification depth
-> Implement concrete safeguards at the boundary
-> Test exploit paths, regression cases, and logging
-> Recheck volatile standards and document residual risk
Auth Model Selection
Situation
Choose
Avoid
Product with browser users, session state acceptable
Server sessions (cookie + server-side store)
JWTs for sessions — revocation is hard
Mobile/desktop app with device-native biometrics
Passkeys (WebAuthn)
SMS OTP — SIM-swap risk
Third-party sign-in or delegated access
OIDC / OAuth 2.1 + PKCE
Implicit flow (deprecated in OAuth 2.1)
API-to-API, no user context
mTLS or short-lived signed tokens
Long-lived API keys
Intra-service auth in a trusted cluster
Service accounts + mTLS
Shared secrets or user tokens
Input Control Selection
Sink / operation
Required control
SQL query construction
Parameterized query or ORM binding; never string concatenation
Shell / process execution
Allowlist args; avoid shell=True / exec with user input
HTML rendering
Context-aware output encoding; CSP header
File upload destination path
Canonicalize; reject path traversal sequences; store outside webroot
Redirect target
Allowlist known origins; reject open redirect patterns
LDAP / XPath / XML
Library-level escaping or schema validation before query construction
LLM / agent tool call input
Treat as untrusted; validate schema before execution; log intent + scope
Core Decisions
Authentication and Sessions
Default choices:
passkeys when product and recovery flows support them
server sessions for browser apps
OIDC or OAuth 2.1 plus PKCE for delegated or third-party sign-in
short-lived tokens only when true statelessness is required
Choose the simplest safe model that matches the app shape.
Authorization and Input Boundaries
Minimum rules:
deny by default
check authorization on the server
validate at boundaries
parameterize dangerous sinks
treat rich content and file uploads as active content until proven otherwise
Secure Design and Threat Modeling
Threat-model before implementing:
storage of sensitive data
privileged actions
external callbacks
file uploads
rich rendering
agent or tool flows
Retroactive hardening is slower and weaker than secure-by-default design.
Agentic and MCP Security
Model explicitly:
prompt injection
tool misuse
memory poisoning
cross-tenant leakage
over-broad server capabilities
unsafe approval flows
Keep read-only and mutating capabilities separate and log intent, scope, and result.
Metered or costly actions (medium confidence, single-source pattern — see Fact-Checking): for any agent action that consumes a bounded quota, spends money, or is otherwise costly/irreversible, re-check current authorization and quota state immediately before that specific call, not from an earlier cached check. The original task assignment ("do X") is not standing consent to spend a metered resource — treat each metered call as needing its own fresh confirmation. On failure mid-run, resume from saved state rather than restarting, since restarting re-incurs the metered cost.
Supply-Chain and Release Integrity
Use:
lockfiles
trusted publishing or provenance
artifact integrity checks
SBOM where relevant
explicit review of transitive risk
Verification Checklist
Before finalizing any AppSec design or review output:
Trust boundary drawn explicitly — every input crossing it is validated or rejected
Authentication model chosen from Defaults (passkeys → server session → OIDC/PKCE → short-lived token)
Authorization checked server-side; deny-by-default enforced at every privileged endpoint
All sinks parameterized: SQL, shell, LDAP, XPath, XML, HTML rendering, redirect targets
File uploads and rich content treated as active content: type validation, size limit, storage isolation
Secrets stored in encrypted provider form (see Secret-Storage Selection table); verify with provider CLI
Supply-chain controls in place: lockfile, dependency scanning, artifact integrity, SBOM if required
Agentic flows threat-modeled for prompt injection, tool misuse, cross-tenant leakage, and over-broad scopes
Residual risks documented with mitigating controls and owner
Standards and browser-behavior claims verified against current sources before final output
Output Modes
Default to one of these:
Security design brief:
threats, control choices, and verification scope.
Security review:
findings, risks, and implementation priorities.
Auth or API hardening plan:
recommended model, pitfalls, and validation steps.
Agentic AppSec review:
threat model, capability boundaries, and approval controls.
Known Traps
Starting security review after architecture and product flows are already fixed, which turns foundational design issues into expensive compensating controls.
Conflating authentication with authorization and assuming a valid identity token answers the permission question.
Treating file uploads, rich text, markdown, or retrieved tool content as passive data instead of active attacker-controlled input.
Reusing one permission surface for both read-only and mutating tool or MCP actions.
Assuming infrastructure posture or a managed platform compensates for weak application-level control design.
Anti-Patterns
Treating standards status as evergreen without checking.
Using auth mechanisms that are more complex than the app needs.
Trusting unvalidated input deep in the system.
Leaving tool or MCP permissions broad by default.
Bolting security onto a feature after implementation choices are locked.
Conflating infrastructure posture with application security design.
Known bugs, regressions, framework/compiler/runtime footguns, and version-specific crash or workaround guidance must be verified against current primary web sources before being treated as current fact.
Use data/sources.json as the primary source map.
Standards revisions, vendor defaults, and active agentic or MCP security guidance are time-sensitive and should be verified before being presented as current fact.
Mark anything inferred or not rechecked as provisional.
Attribution: the metered/costly-action re-consent pattern under Agentic and MCP Security is adapted from regulatory-threat-model by Ansvar Systems AB, in davila7/claude-code-templates at commit 22d8efa9e9afcf31b98b7e3952ec557694e72c13, licensed CC-BY-4.0. Extracted 2026-08-09. This is a single-source pattern (medium confidence) extracted from one vendor-specific, proprietary-tool-bound skill — treat it as a named pattern to consider, not a widely-corroborated convention.
Learnings Loop
Before applying this skill on a non-trivial task, read learnings.consolidated.md in this directory (and learnings.md if present).
After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.
1---2name: software-security-appsec3description: Provides application security guidance for design and implementation. Use when reviewing auth, data handling, supply-chain controls, or AppSec architecture.4---56# Software Security And AppSec
78Use this skill for application-layer security: authentication, authorization, input and output handling, cryptography, supply-chain controls, API security, threat modeling, and security reviews. It is the AppSec decision layer, not general backend or infrastructure hardening.
910## Quick Reference
1112| Task | Use |
13|------|-----|
14| Auth and authorization choices | [references/authentication-authorization.md](references/authentication-authorization.md), [assets/web-application/template-authentication.md](assets/web-application/template-authentication.md), [assets/web-application/template-authorization.md](assets/web-application/template-authorization.md) |
15| Input handling, uploads, rendering, and common bugs | [references/input-validation.md](references/input-validation.md), [references/common-vulnerabilities.md](references/common-vulnerabilities.md) |
16| Secure design and threat modeling | [references/secure-design-principles.md](references/secure-design-principles.md), [references/threat-modeling-guide.md](references/threat-modeling-guide.md) |
17| API and supply-chain security | [references/api-security-patterns.md](references/api-security-patterns.md), [references/supply-chain-security.md](references/supply-chain-security.md), [assets/api/template-secure-api.md](assets/api/template-secure-api.md) |
18| Crypto and transport choices | [references/cryptography-standards.md](references/cryptography-standards.md) |
19| Secret-storage selection | See "Secret-Storage Selection" below — choosing encrypted vs plaintext at the provider, and how to verify after storing |
20| Incident response and security program framing | [references/incident-response-playbook.md](references/incident-response-playbook.md), [references/security-business-value.md](references/security-business-value.md), [references/operational-playbook.md](references/operational-playbook.md) |
2122## Secret-Storage Selection
2324Every major cloud provider has two surface-similar storage classes: one encrypted-at-rest with no readback, one plaintext-visible in the dashboard. Picking the wrong one is silent — the app still works — and the audit log for *who-read-what* exists only on the encrypted form. Plaintext reads are invisible.
2526| Provider | Yes Encrypted, never-readable | No Plaintext, dashboard-visible |
27|---|---|---|
28| Cloudflare Workers | `wrangler secret put` (API type: `secret_text`) | `[vars]` in `wrangler.toml`, Workers > Variables tab |
29| Vercel | Environment Variables marked "Sensitive" | Standard Environment Variables |
30| GitHub Actions | Repository / Organization Secrets | `env:` in workflow YAML, repository Variables |
31| AWS | Secrets Manager, SSM Parameter Store `SecureString` | SSM `String`, plain Lambda env vars |
32| Kubernetes | `Secret` + KMS envelope (SOPS, Sealed Secrets) | `ConfigMap`, plain env vars |
3334**Rules:**
3536- If the provider distinguishes "Secret" from "Variable" (or "Sensitive" from "Standard"), **always** use the encrypted form for: API keys, OAuth client secrets, JWT signing keys, database passwords, webhook secrets, push certificates.
37- Identifiers that already appear in client builds (bundle IDs, Team IDs, KV namespace IDs, project IDs) are **not** secrets and belong in the plaintext config — putting them in the secret store both clutters and signals false risk.
38- **Verify after storing.** `wrangler secret list` returns `type: secret_text` when encrypted. If you see `plain_text` or the value appears under `[vars]`, the credential is plaintext — treat as compromised and rotate.
39- **PEM and other multi-line secrets must use CLI redirect, never dashboard paste.** Dashboards silently mangle newlines: `wrangler secret put APNS_AUTH_KEY --name worker < AuthKey_XXX.p8`.
4041**If you suspect a secret was stored as plaintext:** treat it as compromised. Revoke at the issuer, generate a new credential, store correctly, then verify. Deleting the visible plaintext copy does not invalidate any cached or scraped value. Rotation is a no-regret action; the cost is one credential refresh, the alternative is undetectable use.
4243## When to Use
4445- Review or design auth, session, token, or authorization flows.
46- Validate input handling, uploads, rendering, and untrusted-data boundaries.
47- Secure APIs, webhooks, browser apps, and admin surfaces.
48- Threat-model a feature or AppSec architecture choice.
49- Harden dependency, build, artifact, and release paths.
50- Review agentic or MCP-connected applications from an AppSec angle.
5152## Route Elsewhere
5354- General backend engineering without a security focus: use [software-backend](../software-backend/SKILL.md).
55- Infrastructure hardening, IAM, cluster policy, or cloud posture: use [ops-devops-platform](../ops-devops-platform/SKILL.md).
56- Smart-contract-specific audits: use [software-crypto-web3](../software-crypto-web3/SKILL.md).
57- ML pipeline or model-ops governance: use [ai-mlops](../ai-mlops/SKILL.md).
58- Compliance-only interpretation with no implementation choice: route to legal or compliance stakeholders.
5960## Defaults
6162- Use OWASP Top 10:2025 for risk framing (released January 2026, replaces 2021 edition), ASVS for requirements depth, and SSDF for SDLC baselines.
63- Treat standards, browser behavior, and current exploit trends as volatile until rechecked.
64- Prefer passkeys where feasible and sessions for browser-first apps.
65- Model trust boundaries before choosing controls.
66- Treat tool calls, retrieved content, and long-term memory as untrusted input in agentic systems.
6768## Workflow
69701. Identify the asset, trust boundary, attacker capability, and failure consequence.
712. Classify the problem: auth, authZ, untrusted input, API, supply chain, agentic flow, or secure-design issue.
723. Choose the control family from the relevant reference.
734. Apply the concrete safeguards and define verification depth.
745. Recheck volatile standards and provider behavior before final recommendations.
7576## ASCII Flow
7778```text
79AppSec task
80 -> Identify asset, trust boundary, attacker, and consequence
81 -> Classify auth, authZ, input, API, supply chain, agentic, or design risk
82 -> Choose control family and verification depth
83 -> Implement concrete safeguards at the boundary
84 -> Test exploit paths, regression cases, and logging
85 -> Recheck volatile standards and document residual risk
86```
8788## Auth Model Selection
8990| Situation | Choose | Avoid |
91|-----------|--------|-------|
92| Product with browser users, session state acceptable | Server sessions (cookie + server-side store) | JWTs for sessions — revocation is hard |
93| Mobile/desktop app with device-native biometrics | Passkeys (WebAuthn) | SMS OTP — SIM-swap risk |
94| Third-party sign-in or delegated access | OIDC / OAuth 2.1 + PKCE | Implicit flow (deprecated in OAuth 2.1) |
95| API-to-API, no user context | mTLS or short-lived signed tokens | Long-lived API keys |
96| Intra-service auth in a trusted cluster | Service accounts + mTLS | Shared secrets or user tokens |
9798## Input Control Selection
99100| Sink / operation | Required control |
101|-----------------|-----------------|
102| SQL query construction | Parameterized query or ORM binding; never string concatenation |
103| Shell / process execution | Allowlist args; avoid shell=True / exec with user input |
104| HTML rendering | Context-aware output encoding; CSP header |
105| File upload destination path | Canonicalize; reject path traversal sequences; store outside webroot |
106| Redirect target | Allowlist known origins; reject open redirect patterns |
107| LDAP / XPath / XML | Library-level escaping or schema validation before query construction |
108| LLM / agent tool call input | Treat as untrusted; validate schema before execution; log intent + scope |
109110## Core Decisions
111112### Authentication and Sessions
113114Default choices:
115- passkeys when product and recovery flows support them
116- server sessions for browser apps
117- OIDC or OAuth 2.1 plus PKCE for delegated or third-party sign-in
118- short-lived tokens only when true statelessness is required
119120Choose the simplest safe model that matches the app shape.
121122### Authorization and Input Boundaries
123124Minimum rules:
125- deny by default
126- check authorization on the server
127- validate at boundaries
128- parameterize dangerous sinks
129- treat rich content and file uploads as active content until proven otherwise
130131### Secure Design and Threat Modeling
132133Threat-model before implementing:
134- storage of sensitive data
135- privileged actions
136- external callbacks
137- file uploads
138- rich rendering
139- agent or tool flows
140141Retroactive hardening is slower and weaker than secure-by-default design.
142143### Agentic and MCP Security
144145Model explicitly:
146- prompt injection
147- tool misuse
148- memory poisoning
149- cross-tenant leakage
150- over-broad server capabilities
151- unsafe approval flows
152153Keep read-only and mutating capabilities separate and log intent, scope, and result.
154155**Metered or costly actions** (medium confidence, single-source pattern — see [Fact-Checking](#fact-checking)): for any agent action that consumes a bounded quota, spends money, or is otherwise costly/irreversible, re-check current authorization and quota state immediately before that specific call, not from an earlier cached check. The original task assignment ("do X") is not standing consent to spend a metered resource — treat each metered call as needing its own fresh confirmation. On failure mid-run, resume from saved state rather than restarting, since restarting re-incurs the metered cost.
156157### Supply-Chain and Release Integrity
158159Use:
160- lockfiles
161- trusted publishing or provenance
162- artifact integrity checks
163- SBOM where relevant
164- explicit review of transitive risk
165166## Verification Checklist
167168Before finalizing any AppSec design or review output:
169170- [ ] Trust boundary drawn explicitly — every input crossing it is validated or rejected
171- [ ] Authentication model chosen from Defaults (passkeys → server session → OIDC/PKCE → short-lived token)
172- [ ] Authorization checked server-side; deny-by-default enforced at every privileged endpoint
173- [ ] All sinks parameterized: SQL, shell, LDAP, XPath, XML, HTML rendering, redirect targets
174- [ ] File uploads and rich content treated as active content: type validation, size limit, storage isolation
175- [ ] Secrets stored in encrypted provider form (see Secret-Storage Selection table); verify with provider CLI
176- [ ] Supply-chain controls in place: lockfile, dependency scanning, artifact integrity, SBOM if required
177- [ ] Agentic flows threat-modeled for prompt injection, tool misuse, cross-tenant leakage, and over-broad scopes
178- [ ] Residual risks documented with mitigating controls and owner
179- [ ] Standards and browser-behavior claims verified against current sources before final output
180181## Output Modes
182183Default to one of these:
184185- Security design brief:
186 threats, control choices, and verification scope.
187- Security review:
188 findings, risks, and implementation priorities.
189- Auth or API hardening plan:
190 recommended model, pitfalls, and validation steps.
191- Agentic AppSec review:
192 threat model, capability boundaries, and approval controls.
193194## Known Traps
195196- Starting security review after architecture and product flows are already fixed, which turns foundational design issues into expensive compensating controls.
197- Conflating authentication with authorization and assuming a valid identity token answers the permission question.
198- Treating file uploads, rich text, markdown, or retrieved tool content as passive data instead of active attacker-controlled input.
199- Reusing one permission surface for both read-only and mutating tool or MCP actions.
200- Assuming infrastructure posture or a managed platform compensates for weak application-level control design.
201202## Anti-Patterns
203204- Treating standards status as evergreen without checking.
205- Using auth mechanisms that are more complex than the app needs.
206- Trusting unvalidated input deep in the system.
207- Leaving tool or MCP permissions broad by default.
208- Bolting security onto a feature after implementation choices are locked.
209- Conflating infrastructure posture with application security design.
210211## Navigation
212213- Core references: [references/owasp-top-10.md](references/owasp-top-10.md), [references/authentication-authorization.md](references/authentication-authorization.md), [references/input-validation.md](references/input-validation.md), [references/cryptography-standards.md](references/cryptography-standards.md), [references/common-vulnerabilities.md](references/common-vulnerabilities.md)
214- SDLC and architecture: [references/secure-design-principles.md](references/secure-design-principles.md), [references/threat-modeling-guide.md](references/threat-modeling-guide.md), [references/supply-chain-security.md](references/supply-chain-security.md), [references/zero-trust-architecture.md](references/zero-trust-architecture.md), [references/api-security-patterns.md](references/api-security-patterns.md)
215- Operational references: [references/incident-response-playbook.md](references/incident-response-playbook.md), [references/security-business-value.md](references/security-business-value.md), [references/operational-playbook.md](references/operational-playbook.md)
216- Templates and adjacent assets: [assets/web-application/template-authentication.md](assets/web-application/template-authentication.md), [assets/web-application/template-authorization.md](assets/web-application/template-authorization.md), [assets/api/template-secure-api.md](assets/api/template-secure-api.md), [data/sources.json](data/sources.json)
217- Game theory (defender design — investment allocation, honeypots, patch decisions): [references/game-theory-applied.md](references/game-theory-applied.md)
218- [references/reliability-theory-applied.md](references/reliability-theory-applied.md) — Reliability primitives (MTBF/MTTR, availability, FMEA, error budgets) applied to application security and resilience.
219- Specialized deep-dives: [references/advanced-xss-techniques.md](references/advanced-xss-techniques.md) — advanced XSS vectors and comprehensive defense; [references/dotnet-efcore-crypto-security.md](references/dotnet-efcore-crypto-security.md) — .NET/EF Core crypto integration security; [references/smart-contract-security-auditing.md](references/smart-contract-security-auditing.md) — smart-contract (web3) security auditing methodology
220221## Fact-Checking
222223- Known bugs, regressions, framework/compiler/runtime footguns, and version-specific crash or workaround guidance must be verified against current primary web sources before being treated as current fact.
224- Use [data/sources.json](data/sources.json) as the primary source map.
225- Standards revisions, vendor defaults, and active agentic or MCP security guidance are time-sensitive and should be verified before being presented as current fact.
226- Mark anything inferred or not rechecked as provisional.
227- **Attribution**: the metered/costly-action re-consent pattern under [Agentic and MCP Security](#agentic-and-mcp-security) is adapted from `regulatory-threat-model` by Ansvar Systems AB, in [davila7/claude-code-templates](https://github.com/davila7/claude-code-templates) at commit `22d8efa9e9afcf31b98b7e3952ec557694e72c13`, licensed CC-BY-4.0. Extracted 2026-08-09. This is a single-source pattern (medium confidence) extracted from one vendor-specific, proprietary-tool-bound skill — treat it as a named pattern to consider, not a widely-corroborated convention.
228229## Learnings Loop
230231Before applying this skill on a non-trivial task, read `learnings.consolidated.md` in this directory (and `learnings.md` if present).
232233After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to `learnings.md` via `agents-skills-feedback-loop/scripts/append_learning.py`. Do not modify `SKILL.md` itself.
234
Run npx skillmds@latest add gabrielmoreira/software-security-appsec in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Provides application security guidance for design and implementation. Use when reviewing auth, data handling, supply-chain controls, or AppSec architecture. It is listed under Security on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: makes network calls, reads secrets. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
gabrielmoreira (@gabrielmoreira) published this skill. Their other Agent Skills are listed on their SkillMD profile.