WebAppSec Secure Coding Practices
Application skill for Mozilla WebAppSec Secure Coding Guidelines + QA checklist ingest (awesome-guidelines). General security baseline: security-and-hardening. Accessibility overlap: wcag-accessibility-practices.
Core Principle
Secure web apps validate all request data, encode at output boundaries, protect sessions on HTTPS, and authorize every action on every object, with generic user errors and QA probes to prove it.
When to Use / NOT
- Web apps, APIs with browser clients, login/session flows, file uploads.
- PR review on auth, forms, templates, cookies, headers, admin surfaces.
NOT when:
- Non-HTTP backend with no web surface,
security-and-hardening primary.
- WCAG conformance audit,
wcag-accessibility-practices (pair for CAPTCHA/error UX).
- Pure static markup,
frontend-markup-practices + this for deployment headers.
Workflow
- Quick wins, HttpOnly+Secure cookies; HTTPS auth pages; validate all user data.
- Auth/session/access, passwords, sessions, IDOR (
webappsec-auth-session.md).
- Input/output, whitelist + encoding + parameterized SQL (
webappsec-input-output.md).
- Cross-domain/transport, CSRF, framing, TLS, CSP (
webappsec-cross-domain-transport.md).
- Uploads/errors/verify, files, errors, QA checklist (
webappsec-uploads-errors-verify.md).
Red Flags
- Cookie missing Secure or HttpOnly
- Login or authenticated assets over HTTP / mixed content
- Username enumeration on login or password reset
- Weak password hashing (md5/sha1) without migration
- Session ID not rotated on login
- Authorization only in UI or only by action type
- Blocklist input validation; client-only validation
- SQL string concatenation with user input
- Unencoded user data in HTML/JS templates
- State-changing POST without CSRF token
- Remote third-party script without update review
- Missing X-Frame-Options on HTML
- Inline JS blocking CSP adoption
- User-controlled upload filename or path
- Wrong Content-Type on user uploads
- Stack traces or SQL errors shown to users
- DEBUG enabled in production
Verification
- Mozilla QA checklist probes on changed endpoints (input, SQLi, XSS, CSRF, X-Frame)
- Cookie and session flag inspection
- HTTPS-only auth flow crawl
- Parameterized query audit on changed data access
- Template/output encoding review
- Upload test cases (extension spoof, archive size)
- Pair with
npm audit/dependency check from security-and-hardening
References
awesome-guidelines/references/webappsec-style-learning-note.md
awesome-guidelines/references/webappsec-auth-session.md
awesome-guidelines/references/webappsec-input-output.md
awesome-guidelines/references/webappsec-cross-domain-transport.md
awesome-guidelines/references/webappsec-uploads-errors-verify.md
Related skills
security-and-hardening, OWASP, secrets, dependencies, headers
wcag-accessibility-practices, accessible error messages and forms
json-api-practices, API contract security adjacent to CSRF/CORS
1---2name: webappsec-coding-practices3description: Use when building or reviewing web apps, Mozilla WebAppSec auth/sessions, whitelist input, output encoding, CSRF/TLS/CSP, safe uploads, generic errors, and QA checklist verification.4---56# WebAppSec Secure Coding Practices78Application skill for Mozilla WebAppSec Secure Coding Guidelines + QA checklist ingest (`awesome-guidelines`). General security baseline: `security-and-hardening`. Accessibility overlap: `wcag-accessibility-practices`.910## Core Principle1112Secure web apps **validate all request data**, **encode at output boundaries**, **protect sessions on HTTPS**, and **authorize every action on every object**, with generic user errors and QA probes to prove it.1314## When to Use / NOT1516- Web apps, APIs with browser clients, login/session flows, file uploads.17- PR review on auth, forms, templates, cookies, headers, admin surfaces.1819**NOT when:**2021- Non-HTTP backend with no web surface, `security-and-hardening` primary.22- WCAG conformance audit, `wcag-accessibility-practices` (pair for CAPTCHA/error UX).23- Pure static markup, `frontend-markup-practices` + this for deployment headers.2425## Workflow26271. **Quick wins**, HttpOnly+Secure cookies; HTTPS auth pages; validate all user data.282. **Auth/session/access**, passwords, sessions, IDOR (`webappsec-auth-session.md`).293. **Input/output**, whitelist + encoding + parameterized SQL (`webappsec-input-output.md`).304. **Cross-domain/transport**, CSRF, framing, TLS, CSP (`webappsec-cross-domain-transport.md`).315. **Uploads/errors/verify**, files, errors, QA checklist (`webappsec-uploads-errors-verify.md`).3233## Red Flags3435- Cookie missing Secure or HttpOnly36- Login or authenticated assets over HTTP / mixed content37- Username enumeration on login or password reset38- Weak password hashing (md5/sha1) without migration39- Session ID not rotated on login40- Authorization only in UI or only by action type41- Blocklist input validation; client-only validation42- SQL string concatenation with user input43- Unencoded user data in HTML/JS templates44- State-changing POST without CSRF token45- Remote third-party script without update review46- Missing X-Frame-Options on HTML47- Inline JS blocking CSP adoption48- User-controlled upload filename or path49- Wrong Content-Type on user uploads50- Stack traces or SQL errors shown to users51- DEBUG enabled in production5253## Verification5455- Mozilla QA checklist probes on changed endpoints (input, SQLi, XSS, CSRF, X-Frame)56- Cookie and session flag inspection57- HTTPS-only auth flow crawl58- Parameterized query audit on changed data access59- Template/output encoding review60- Upload test cases (extension spoof, archive size)61- Pair with `npm audit`/dependency check from `security-and-hardening`626364## References6566- `awesome-guidelines/references/webappsec-style-learning-note.md`67- `awesome-guidelines/references/webappsec-auth-session.md`68- `awesome-guidelines/references/webappsec-input-output.md`69- `awesome-guidelines/references/webappsec-cross-domain-transport.md`70- `awesome-guidelines/references/webappsec-uploads-errors-verify.md`7172## Related skills7374- `security-and-hardening`, OWASP, secrets, dependencies, headers75- `wcag-accessibility-practices`, accessible error messages and forms76- `json-api-practices`, API contract security adjacent to CSRF/CORS