security-and-hardening

Hardens web application code against OWASP Top 10 vulnerabilities and supply-chain risks.

1|Updated Mar 2, 2025
One-click install
npx skills add https://github.com/marjorg/setup --skill security-and-hardening-marjorg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: security-and-hardening
Source: https://github.com/marjorg/setup/tree/main/home/.agents/skills/security-and-hardening
Command: npx skills add https://github.com/marjorg/setup --skill security-and-hardening-marjorg

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Web applications that accept user input, manage sessions, or integrate third-party services are exposed to injection, XSS, SSRF, broken access control, and supply-chain attacks. This Skill provides a threat-model-first process and concrete prevention patterns so security is built into every feature rather than bolted on later. ## Core Features & Use Cases - Threat Modeling with STRIDE: Map trust boundaries, name assets, and write abuse cases before writing code, covering OWASP A04 insecure design. - OWASP Top 10 Prevention Patterns: Ready-to-use TypeScript examples for parameterized queries, bcrypt password hashing, session cookie flags, CSP headers, CORS restriction, SSRF URL allowlisting, and Zod schema validation. - Dependency & Supply-Chain Triage: A decision tree for package-manager audit findings by severity and reachability, plus lockfile integrity, install-script blocking, and typosquat detection. - AI/LLM and Privacy Coverage: Guidance for treating LLM output as untrusted input (OWASP LLM Top 10) and for GDPR/CCPA data classification, retention, and deletion workflows. - Use Case: Before shipping a login flow, run the security review checklist to verify password hashing, rate limiting with a shared store, httpOnly cookies, and authorization checks on every endpoint. ## Quick Start Audit my Express login endpoint for OWASP Top 10 vulnerabilities and tell me what to fix before release.

Frequently Asked Questions about security-and-hardening

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

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

Prevent SQL injection by using parameterized queries instead of string concatenation, such as db.query('SELECT * FROM users WHERE id = $1', [userId]). ORMs like Prisma also parameterize inputs automatically when you pass values through their query APIs.

How do I secure Express session cookies against XSS and CSRF?

Configure session cookies with httpOnly to block JavaScript access, secure to require HTTPS, and sameSite set to lax or strict for CSRF protection. Hash passwords with bcrypt at 12 or more salt rounds and never store auth tokens in localStorage.

How do I prevent SSRF when my server fetches user-supplied URLs?

Allowlist the URL scheme and hostname, resolve all DNS records, and reject any address that is not public unicast, which blocks loopback and the 169.254.169.254 cloud metadata endpoint. Disable redirects and be aware of DNS-rebinding TOCTOU gaps on high-risk surfaces.

How should I triage npm audit vulnerabilities by severity?

Fix critical and high findings immediately when the vulnerable code is reachable in runtime, build, or deployment paths; otherwise schedule them. Moderate issues go into the next release cycle, and low-severity items are handled during regular dependency updates with documented deferral reasons.

Why is LLM output dangerous to pass into SQL or the DOM?

LLM output is untrusted input that can contain SQL statements, script tags, or shell commands, enabling injection or stored XSS. Parse it defensively with a schema like Zod, run only allowlisted actions, and render it as text content rather than HTML.

Does express-rate-limit work behind a load balancer?

No, express-rate-limit keeps counters in process memory by default, so each instance maintains its own count and the effective limit multiplies by instance count. Use a shared store such as Redis via rate-limit-redis or an HTTP-based limiter like @upstash/ratelimit.