security-hardening

Implements input validation, authentication, security headers, and dependency auditing for web applications.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/karenrebecag/spec-driven-standards --skill security-hardening-karenrebecag
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: security-hardening
Source: https://github.com/karenrebecag/spec-driven-standards/tree/main/plugins/security/skills/security-hardening
Command: npx skills add https://github.com/karenrebecag/spec-driven-standards --skill security-hardening-karenrebecag

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Web applications are exposed to common attack vectors like SQL injection, XSS, CSRF, and leaked secrets. This Skill provides concrete, code-level guidance to harden an application against these threats before deployment. ## Core Features & Use Cases - Input Validation & Injection Prevention: Schema-based validation with Zod, parameterized SQL queries, and output encoding to stop injection and XSS attacks. - Authentication & Session Security: JWT best practices (short expiry, RS256/HS256, claim validation), CSRF token middleware, and rate limiting for auth endpoints. - Headers, Secrets & Dependencies: CSP and security header configuration, secrets management with gitleaks scanning, and dependency auditing via npm audit, pip-audit, and govulncheck. - Use Case: Before deploying a Node.js API, apply the 10-point checklist to verify inputs are validated, queries are parameterized, headers are set, secrets are externalized, and no critical dependency vulnerabilities remain. ## Quick Start Review my Express API code and apply the security hardening checklist to fix validation, headers, and authentication issues.

Frequently Asked Questions about security-hardening

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent SQL injection in Node.js or Python?

Prevent SQL injection by always using parameterized queries instead of string interpolation. In Node.js use placeholders like db.query("SELECT * FROM users WHERE email = $1", [email]); in Python use cursor.execute with %s parameters. An ORM or query builder handles this automatically.

How do I validate user input in a TypeScript API?

Validate input at the boundary using a schema library like Zod. Define a schema with type, length, format, and range constraints, then call safeParse on the request body and return 400 with field errors on failure. Prefer allowlists over denylists.

What security headers should every web application set?

Set Strict-Transport-Security with a long max-age, X-Content-Type-Options: nosniff, X-Frame-Options: DENY, Referrer-Policy, and a restrictive Content-Security-Policy. Middleware like helmet for Node.js applies these headers on every response.

Is CSRF protection needed for token-based APIs?

CSRF protection is not needed for APIs using Bearer tokens, because browsers do not automatically attach the Authorization header to cross-site requests. CSRF tokens are required only when authentication relies on cookies sent automatically by the browser.

How do I check for leaked secrets in a git repository?

Scan for leaked secrets using gitleaks: run gitleaks detect --source . --verbose to search git history, and gitleaks protect --staged as a pre-commit hook to block new secret commits. Tools like trufflehog and git-secrets serve the same purpose.

What are the limitations of storing data in JWT payloads?

JWT payloads are base64 encoded, not encrypted, so anyone holding the token can read them. Never store sensitive data in the payload, keep access token expiry short (around 15 minutes), and validate iss, aud, exp, and nbf claims on every request.