security-and-hardening
OWASP Top 10 prevention, auth patterns, secrets management, dependency auditing, three-tier boundary system. Use when handling user input, auth, data storage, or external integrations.
What this skill does
# Security and Hardening ## Overview Apply security best practices systematically across the codebase. Prevent OWASP Top 10 vulnerabilities, manage secrets safely, audit dependencies, and enforce boundary validation at all system edges. ## When to Use - Handling user input or external data - Implementing authentication or authorization - Storing or transmitting sensitive data - Integrating with external services - Before deploying any change to production ## OWASP Top 10 Prevention ### Injection - Use parameterized queries for all database access - Validate and sanitize all user input - Use ORM/query builders that handle escaping - Never concatenate user input into queries, commands, or HTML ### Broken Authentication - Use established auth libraries (do not roll your own) - Implement proper session management - Require strong passwords and multi-factor authentication - Use secure cookie flags (HttpOnly, Secure, SameSite) ### Sensitive Data Exposure - Encrypt data at rest and in transit - Never log sensitive data (passwords, tokens, PII) - Use environment variables for secrets, never hardcode - Minimize data collection to what is needed ### Security Misconfiguration - Disable unnecessary features and services - Keep all dependencies updated - Use secure defaults (deny by default) - Remove default credentials and sample data ### Broken Access Control - Enforce authorization on every protected endpoint - Do not rely on client-side access control - Implement proper CORS policies - Validate resource ownership ## Three-Tier Boundary System ### Tier 1: External Boundary All data from outside the system is untrusted: - HTTP request bodies, headers, and query parameters - File uploads and external API responses - Webhook payloads and email content ### Tier 2: Module Boundary Data crossing module boundaries should be validated: - Function parameters across module lines - Queue message payloads - Database read results when crossing service boundaries ### Tier 3: Internal Boundary Data within a trusted module needs less validation, but: - Validate at state transitions - Assert invariants in critical paths - Use type systems to catch mistakes ## Secrets Management - Never hardcode secrets in source code - Use environment variables or secret managers - Validate required secrets at startup - Rotate any exposed secrets immediately - Add secret patterns to .gitignore ## Process ### Step 1: Identify Trust Boundaries - List all points where data enters or leaves the system - Identify authentication and authorization checkpoints - Map data flows for sensitive information ### Step 2: Apply Boundary Validation - Validate input at every trust boundary - Sanitize output when crossing boundaries - Use allow-lists over deny-lists where possible ### Step 3: Audit Dependencies - Run dependency audit (npm audit, socket security) - Check for known vulnerabilities - Update or replace vulnerable packages ### Step 4: Verify Security Controls - Test authentication flows - Test authorization for each role - Verify CORS and CSP policies - Check that error messages do not leak sensitive data ## Common Rationalizations | Rationalization | Reality | |---|---| | "This is internal, security does not matter" | Internal systems are targets for lateral movement after perimeter breach. | | "We can add security later" | Retrofitting security is more expensive and less effective than building it in. | | "Validation is redundant" | Defense in depth means multiple layers of validation. | ## Verification - [ ] All user input is validated at trust boundaries - [ ] No secrets in source code or logs - [ ] Authentication and authorization tested for each role - [ ] Dependency audit shows no critical vulnerabilities - [ ] Error messages do not leak sensitive information ## Anti-Rationalization Table | Excuse | Counter | |--------|---------| | "This is internal, security doesn't matter" | Internal systems are targets for lateral movement after perimeter breach. | | "We can add security later" | Retrofitting security is more expensive and less effective than building it in. | | "Validation is redundant" | Defense in depth means multiple layers of validation. Each layer catches what others miss. | | "The dependency audit is clean, we're safe" | Dependency audits catch known vulnerabilities. They do not catch logic errors or misconfigurations. | | "HTTPS is enough for data protection" | HTTPS protects data in transit. Data at rest, in logs, and in memory also need protection. |
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.