Application Security Fundamentals
Overview
While the OWASP Top 10 describes what goes wrong, the OWASP Top 10 Proactive Controls describe what to build to prevent it. This skill summarizes the proactive controls and the foundational defenses (input validation, output/context-aware encoding, secure defaults) that every feature should apply by default. Read this at the start of building a feature, not after a vulnerability is found. For deep, topic-specific guidance, follow the linked OWASP Cheat Sheets.
Official sources
Core concepts
The OWASP Top 10 Proactive Controls (2024) are the security techniques to include in every project:
- C1 Implement Access Control — enforce authorization server-side, deny by default.
- C2 Use Cryptography to Protect Data — protect data at rest and in transit with vetted algorithms and managed keys.
- C3 Validate all Input & Handle Exceptions — treat all input as untrusted; fail safely on errors.
- C4 Address Security from the Start — threat-model and design controls early (secure design).
- C5 Secure By Default Configurations — ship hardened defaults rather than relying on later hardening.
- C6 Keep your Components Secure — track and patch third-party dependencies.
- C7 Secure Digital Identities — robust authentication, session, and credential handling.
- C8 Leverage Browser Security Features — use headers/policies (CSP, cookie attributes) the browser enforces.
- C9 Implement Security Logging and Monitoring — log security events and enable detection.
- C10 Stop Server Side Request Forgery — validate and restrict outbound requests built from user input.
Two cross-cutting defenses underpin several controls:
- Input validation — prefer allow-list (positive) validation of type, length, format, and range; validation is defense-in-depth, not a substitute for safe APIs.
- Output / context-aware encoding — encode untrusted data for the exact sink it lands in (HTML body, HTML attribute, JavaScript, URL, SQL) to neutralize injection.
Best practices
- Use parameterized queries and safe APIs to stop injection at the boundary; treat input validation as an additional layer, not the primary defense.
- Apply output encoding based on the output context, since the correct escaping differs between HTML, attributes, JavaScript, and URLs.
- Adopt secure-by-default configuration (C5): least privilege, disabled debug endpoints, and minimal exposed surface from day one.
- Consult the relevant OWASP Cheat Sheet for any non-trivial control rather than improvising (the series is the canonical implementation reference).
Common pitfalls
- Relying on input validation alone to prevent injection → combine validation with parameterized queries and context-aware encoding.
- Using a single "escape" function everywhere → encoding is context-specific; HTML-encoding a value placed into a JavaScript string is still unsafe.
- Bolting on security after the build (skipping C4) → design controls in from the start; retrofitting access control and crypto is error-prone.
Examples
# Context-aware output encoding (concept):
HTML body -> HTML entity encode ( < becomes < )
HTML attribute -> attribute encode + quote the attribute
JavaScript -> JS string encode / avoid building JS from input
URL parameter -> URL/percent encode
Further reading
Related skills
- ../owasp-top-10 — the risks these controls prevent
- ../owasp-asvs — testable requirements aligned to these controls
- ../secure-auth-sessions — implementation detail for C7
1---2name: appsec-fundamentals3description: Application security fundamentals — OWASP Proactive Controls, input validation, output encoding, and secure-by-default design; consult when building any feature.4domain: engineering5category: security6tags: [appsec, proactive-controls, input-validation, output-encoding, owasp]7official_sources:8 - https://top10proactive.owasp.org/9 - https://cheatsheetseries.owasp.org/10verified: 2026-06-1611metadata:12 source: https://skillmd.com/skills/gabriel7silva/appsec-fundamentals13---1415# Application Security Fundamentals1617## Overview18While the OWASP Top 10 describes what goes wrong, the OWASP Top 10 Proactive Controls describe what to build to prevent it. This skill summarizes the proactive controls and the foundational defenses (input validation, output/context-aware encoding, secure defaults) that every feature should apply by default. Read this at the start of building a feature, not after a vulnerability is found. For deep, topic-specific guidance, follow the linked OWASP Cheat Sheets.1920## Official sources21- Proactive Controls (2024): https://top10proactive.owasp.org/22- Proactive Controls repo: https://github.com/OWASP/www-project-proactive-controls/23- Cheat Sheet Series (130+ topic guides): https://cheatsheetseries.owasp.org/24- Cheat Sheet repo: https://github.com/OWASP/CheatSheetSeries25- License: Creative Commons Attribution-ShareAlike 4.0 (CC BY-SA 4.0)2627## Core concepts28The OWASP Top 10 Proactive Controls (2024) are the security techniques to include in every project:2930- **C1 Implement Access Control** — enforce authorization server-side, deny by default.31- **C2 Use Cryptography to Protect Data** — protect data at rest and in transit with vetted algorithms and managed keys.32- **C3 Validate all Input & Handle Exceptions** — treat all input as untrusted; fail safely on errors.33- **C4 Address Security from the Start** — threat-model and design controls early (secure design).34- **C5 Secure By Default Configurations** — ship hardened defaults rather than relying on later hardening.35- **C6 Keep your Components Secure** — track and patch third-party dependencies.36- **C7 Secure Digital Identities** — robust authentication, session, and credential handling.37- **C8 Leverage Browser Security Features** — use headers/policies (CSP, cookie attributes) the browser enforces.38- **C9 Implement Security Logging and Monitoring** — log security events and enable detection.39- **C10 Stop Server Side Request Forgery** — validate and restrict outbound requests built from user input.4041Two cross-cutting defenses underpin several controls:42- **Input validation** — prefer allow-list (positive) validation of type, length, format, and range; validation is defense-in-depth, not a substitute for safe APIs.43- **Output / context-aware encoding** — encode untrusted data for the exact sink it lands in (HTML body, HTML attribute, JavaScript, URL, SQL) to neutralize injection.4445## Best practices46- Use parameterized queries and safe APIs to stop injection at the boundary; treat input validation as an additional layer, not the primary defense.47- Apply output encoding based on the output context, since the correct escaping differs between HTML, attributes, JavaScript, and URLs.48- Adopt secure-by-default configuration (C5): least privilege, disabled debug endpoints, and minimal exposed surface from day one.49- Consult the relevant OWASP Cheat Sheet for any non-trivial control rather than improvising (the series is the canonical implementation reference).5051## Common pitfalls52- Relying on input validation alone to prevent injection → combine validation with parameterized queries and context-aware encoding.53- Using a single "escape" function everywhere → encoding is context-specific; HTML-encoding a value placed into a JavaScript string is still unsafe.54- Bolting on security after the build (skipping C4) → design controls in from the start; retrofitting access control and crypto is error-prone.5556## Examples57```text58# Context-aware output encoding (concept):59HTML body -> HTML entity encode ( < becomes < )60HTML attribute -> attribute encode + quote the attribute61JavaScript -> JS string encode / avoid building JS from input62URL parameter -> URL/percent encode63```6465## Further reading66- Input Validation Cheat Sheet, Cross Site Scripting Prevention Cheat Sheet, Injection Prevention Cheat Sheet — https://cheatsheetseries.owasp.org/67- Proactive Controls detailed pages — https://top10proactive.owasp.org/6869## Related skills70- ../owasp-top-10 — the risks these controls prevent71- ../owasp-asvs — testable requirements aligned to these controls72- ../secure-auth-sessions — implementation detail for C7