Security Development Checklist
Portable development-time security guidance aligned with DiSCOS Security First. Load repository-profile and framework-specific security skills when present.
When to Apply
- Adding new endpoints, pages, jobs, consumers, or controllers.
- Handling user input: forms, query strings, headers, files, API payloads, or deserialization.
- Modifying authentication, authorization, sessions, cookies, MFA, or tenant isolation.
- Constructing raw SQL, database commands, query expressions, or dynamic filters.
- Working with external data sources or outbound network calls.
- Adding package dependencies, CI steps, containers, or deployment configuration.
Input Validation
Server-Side Always
Validate required fields, types, lengths, and allowed values at the server boundary.
Rules
- Never trust client-side validation alone.
- Prefer allowlists over blocklists.
- Validate at the boundary before business logic.
- Use type-safe parsing and framework binders where possible.
- Validate file type, size, storage path, and scanning requirements for uploads.
- Constrain deserialization types and payload size.
CLI Paths And Child Process Arguments
- Trace each changed CLI argument to the file operation or child process that consumes it. Enforce the command's documented directory boundary on resolved destinations before reads or writes, including symlinked parents and existing output files.
- Allow only permitted filename operands. When forwarding them, place them after the child's own
--if supported. A shell-free argument array still permits the child to interpret options. - Check valid inputs alongside parent traversal, external absolute paths, symlinks outside the allowed directory, and filenames beginning with
-. Rejection must prevent unintended file access and must not turn skipped work into a successful exit.
Redirect Destinations
- Trace untrusted destinations through forms, query strings, and stored state to the final server redirect or browser navigation. Earlier validation does not cover a value replaced by a later request.
- For in-app returns, use the framework's local-URL validation and local redirect API. Fall back to a known local route. For permitted external redirects, parse the URL and compare its origin, including scheme and port, against the allowlist.
- Preserve valid local paths and query strings. Check absolute external URLs, scheme-relative URLs, and backslash or encoded forms using the actual framework or browser semantics. For external allowlists, also check lookalike hosts and user-info URLs.
Authentication And Authorization
- Apply authorization at the boundary: route, controller, page, handler, consumer, or job trigger.
- Grant only the permissions needed.
- Keep internal identifiers, persistence models, and framework-only types out of external contracts.
- Do not bypass MFA, tenant, or scope checks unless the repository profile explicitly defines a safe exception path.
- Use secure cookie/session defaults from the framework or repository profile.
Secrets Management
- Never commit secrets to source control.
- Never log secrets, tokens, connection strings, or credentials.
- Use orchestrator secret stores or mounted secrets where available.
- If secrets are injected via environment variables, never commit, echo, or log them.
- Use the repository's configuration abstraction and secret store.
- Rotate secrets on suspected compromise.
- Keep sample values fake and clearly marked.
Raw SQL And Query Construction
- Prefer repository-approved ORMs, query builders, or typed query APIs.
- Use parameterized APIs for raw SQL and database commands.
- Never embed user-controlled values in raw SQL, query expressions, or command strings. Bind values as parameters, including through parameterizing interpolation APIs. Verify the selected overload. See EF Core SQL guidance.
- Allowlist dynamic column names, sort directions, and filter fields before translating them into queries.
- Review framework-specific raw query sinks, such as
FromSql,ExecuteSql, command builders, or direct connection APIs.
Dependency Security
- Check vulnerability and maintenance signals before adding packages.
- Prefer maintained packages with clear provenance.
- Follow the repository pinning policy for NuGet, npm, GitHub Actions, containers, and language-specific package managers.
- Whenever container base images, Docker/Docker Compose services, or package versions are added or updated, verify their content digests against canonical registry manifests or package repository metadata before committing. Require third-party GitHub Actions to use full immutable Git commit SHAs, documenting tag-to-commit verification separately according to the repository profile.
- Review transitive dependencies when adding security-sensitive packages.
- Apply the profile's release rules and documentation triggers, including security and published-artifact impact.
Security Headers And Browser Protections
| Control | Purpose |
|---------|---------|
| CSP | XSS mitigation and script/style control |
| CSRF tokens | State-changing request protection |
| X-Content-Type-Options | MIME sniffing mitigation |
| Frame policy | Clickjacking mitigation |
| Referrer policy | Referrer leakage reduction |
| Permissions policy | Browser feature access control |
Rules:
- Never weaken CSP or CSRF protection without documented justification.
- Never remove security headers for production debugging.
- Test headers with browser DevTools or the repository's integration tests when execution is allowed.
Quick Pre-Commit Checklist
- [ ] All user input is validated server-side.
- [ ] No secrets are in source, logs, docs, or generated artifacts.
- [ ] Authorization is applied at the boundary.
- [ ] State-changing browser requests include CSRF protection.
- [ ] Raw SQL, dynamic filters, and database commands are parameterized or allowlisted.
- [ ] No raw HTML rendering of user-controlled data.
- [ ] New dependencies follow the repository supply-chain policy: container images use verified content digests, and third-party GitHub Actions use full immutable Git commit SHAs with version comments.
- [ ] Security headers and browser controls are not weakened.
Related Skills
- basic-code-review.md - Security review triggers.
- Load framework-specific frontend/CSP guidance from the repository profile when present.