security-and-hardening

Hardens web application code against OWASP vulnerabilities through threat modeling and validation patterns.

1|Updated Sep 4, 2026
One-click install
npx skills add https://github.com/SanHsien/agent-skills --skill security-and-hardening-sanhsien
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: security-and-hardening
Source: https://github.com/SanHsien/agent-skills/tree/main/skills/security-and-hardening
Command: npx skills add https://github.com/SanHsien/agent-skills --skill security-and-hardening-sanhsien

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Web applications that accept user input, manage sessions, or integrate external services are exposed to injection, XSS, SSRF, broken access control, and supply-chain attacks. This Skill gives an AI coding agent a concrete security workflow—threat modeling, boundary validation, dependency triage, and review checklists—so vulnerabilities are prevented at design time instead of patched after a breach. ## Core Features & Use Cases - Threat Modeling with STRIDE: Maps trust boundaries, names assets, and runs a STRIDE pass over each boundary before writing controls, addressing OWASP A04 insecure design. - OWASP Top 10 Prevention Patterns: Provides code-level patterns for parameterized queries, bcrypt password hashing, session cookie flags, CSP headers, output encoding, SSRF allowlisting, and per-resource authorization checks. - Dependency and Supply-Chain Triage: Supplies a severity/reachability decision tree for package-manager audit findings, lockfile integrity rules, and install-script blocking policies. - Privacy and LLM Security: Covers GDPR/CCPA data classification, retention, and deletion paths, plus OWASP LLM Top 10 guidance for prompt injection, output handling, and tool permission scoping. - Use Case: When adding a webhook endpoint that fetches user-supplied URLs, apply the SSRF pattern to allowlist hosts, reject private IPs, and disable redirects before shipping. ## Quick Start Ask the agent to audit your login flow or input handler against the OWASP Top Ten using the security-and-hardening checklist.

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 a Node.js API?

Prevent SQL injection by using parameterized queries instead of string concatenation, such as db.query('SELECT * FROM users WHERE id = $1', [userId]), or an ORM like Prisma with typed inputs. Validate all external input at the route boundary with a schema validator like zod.

How do I protect a server from SSRF when fetching user-supplied URLs?

Protect against SSRF by allowlisting schemes and hosts, resolving all DNS records and rejecting any private or reserved IP range, and disabling redirects. For high-risk surfaces, pin the resolved IP or use a filtering agent, since DNS rebinding creates a TOCTOU gap between validation and connection.

What session cookie settings prevent session hijacking?

Set session cookies with httpOnly, secure, and sameSite flags so they are inaccessible to JavaScript, sent only over HTTPS, and protected against CSRF. Hash passwords with bcrypt, scrypt, or argon2, and apply stricter rate limits to authentication endpoints.

How should I triage npm audit vulnerabilities?

Triage audit findings by severity and reachability: fix reachable critical or high findings immediately, schedule moderate ones for the next release, and track low ones. Never run forced fixes like npm audit fix --force automatically; review changelogs and test each upgrade.

Why is LLM output treated as untrusted input?

LLM output is untrusted because prompts can be hijacked by injected instructions, and model text can contain SQL, scripts, or shell commands. Never pass it to eval, innerHTML, or a query directly; parse it defensively, validate against a schema, and encode it before use.

When should rate limiting use a shared store like Redis?

Use a shared store such as Redis once more than one process serves traffic, because in-memory limiters give each instance its own counter and serverless invocations reset to zero. Tools like rate-limit-redis or @upstash/ratelimit enforce limits consistently across instances.