agentsclimarketplace

Secure coding

Skill sergeyizmailov/Claude-Skills/skills/secure-coding

Open Agent Skills for frontend engineering, secure coding, research, automation, and Meta Ads workflows.

Install
npx -y skills add sergeyizmailov/Claude-Skills --skill secure-coding

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when writing JavaScript, Node.js, HTML, CSS code for websites, landing pages, admin panels, APIs. Reduces common vulnerability classes (XSS, injection, SSRF, etc.) via secure libraries, proper headers, and safe patterns. Includes AI code vulnerability patterns.

SKILL.md

8.6 KB, as published. Nobody here has run it

Secure Coding (JS / Node.js / HTML / CSS)

Apply automatically when writing any web code. Every output should be hardened by default — this skill reduces common vulnerability classes (OWASP Top 10, CWE-79/89/918/22/502 etc.) but does not guarantee absence of bugs. Validate deployment topology (reverse proxy, TLS termination, CDN) before applying defaults like trust proxy, HSTS preload, or cross-origin isolation headers.

Why This Matters (2025-2026 Reality)

  • AI-generated code has 2.74x more vulnerabilities than human-written (Veracode, 100+ LLMs tested)
  • 45% of AI code samples introduce OWASP Top 10 vulnerabilities
  • 86% fail XSS defense, 88% vulnerable to log injection
  • 35 new CVEs from AI-generated code in March 2026 alone
  • Hardcoded secrets in AI-assisted commits: 3.2% rate (vs 1.5% baseline — 2x higher)
  • CVE-2025-55182 (React2Shell): CVSS 10.0 RCE via single HTTP request, near-100% exploit reliability

Workflow

When writing new code

  1. Start with secure defaults: helmet, cors (explicit origins), rate-limit, body size limit
  2. For each endpoint: auth middleware → input validation (zod) → parameterized queries → generic error responses
  3. Before finishing: scan output against the "Never Do" table below — if any anti-pattern slipped in, fix it
  4. Check dependencies before adding (prefer context7 MCP when available; fall back to npm registry / GitHub / GHSA when not):
    • Verify latest stable version (never use known-outdated)
    • Check for open critical/high CVEs and GHSA advisories
    • Confirm maintainer is active (responds to issues, security patches land within reasonable time) — raw commit cadence is a poor signal; mature crypto/security libs like argon2, helmet, jose can sit quiet for months and still be canonical. Disqualify only on: deprecated, archived, unanswered CVE > 90 days, ownership transferred to unknown party
    • Apps: rely on package-lock.json + npm ci. Libraries: use semver ranges in package.json; run audit in CI
    • Prefer packages from Safe Library Stack below

When auditing existing code

  1. Scan project structure: find entry point, routes, middleware chain, static file serving
  2. Check dependencies: npm audit, pinned versions, known compromised packages
  3. Check configs: NODE_ENV, exposed files (.env, .git, source maps), debug endpoints
  4. Walk each route: auth → validation → data handling → error responses
  5. Check infrastructure: headers, CSP, CORS, cookies, open ports
  6. Output findings using the format below

Audit output format

### [CRITICAL/HIGH/MEDIUM/LOW] Finding title
- **Location**: file:line
- **Vulnerability**: CWE-XXX (name)
- **Impact**: what an attacker can do
- **Fix**: specific code change or recommendation

OWASP Top 10:2025 Quick Map

#RiskHow It's ExploitedYour Defense
A01Broken Access ControlIDOR: change /api/user/123 to /api/user/124Auth check on EVERY endpoint, return 404 not 403
A02Security MisconfigurationDefault creds, debug mode, verbose errors, exposed filesHelmet, CSP, no defaults, generic errors, block dotfiles
A03Supply ChainCompromised npm packages (Shai-Hulud: 500+ packages)Pin versions, npm ci --ignore-scripts, audit
A04Cryptographic FailuresWeak hashing, plaintext storage, broken TLSArgon2id, AES-256-GCM, TLS 1.2+ only
A05InjectionSQLi, XSS, SSTI, prototype pollution, prompt injectionParameterized queries, DOMPurify, no eval()
A06Insecure DesignNo rate limit on login, no anti-automationRate limit, CAPTCHA, account lockout
A07Auth FailuresJWT alg:none, weak secrets, no session rotationjose + RS256, strong secrets, regenerate on login
A08Integrity FailuresTampered CDN scripts, unsigned updatesSRI hashes, verify signatures
A09Logging FailuresNo auth logging, secrets in logsLog auth events, NEVER log tokens/passwords
A10Exception MishandlingStack traces + DB errors leaked to clientGeneric 500, detailed to server logs only

Never Do (hacker's wishlist)

Bad CodeAttackImpact
eval(userInput)Code injectionRCE
innerHTML = userInputXSSSession theft, keylogging
db.query(\...${id}`)`SQL injectionFull DB dump
res.send(error.stack)Info leakDB creds, paths, versions
jwt.verify(token, key) without algorithmsalg:none bypassAuth bypass, admin access
require(userInput)Path traversalRCE, file read
fetch(userUrl) without validationSSRFInternal network scan, cloud metadata
JSON.parse + deep merge without checkPrototype pollutionRCE via gadget chain
password = md5(input)Hashcat: 100B/sec on GPUFull account takeover
cors({ origin: '*' })Cross-origin accessData theft from any domain
cookie: { sameSite: 'none' } without reasonCSRFUnauthorized actions
npm install in CISupply chainMalicious postinstall scripts
/^(.+)+$/.test(userInput)ReDoSEvent loop freeze, full DoS
WebSocket without origin checkCSWSHSession hijacking via any website
SELECT ... WHERE then UPDATE without lockRace conditionDouble-spend, duplicate actions

Safe Library Stack (2025-2026)

PurposeUseAvoidWhy
Password hashargon2 / @node-rs/argon2md5, sha256GPU-resistant, OWASP standard
JWTjose (v6+)jsonwebtokenMaintained, universal runtime, no alg:none
HTML sanitizeDOMPurify (v3+)regex sanitizers55% of sanitizers vulnerable to DOM clobbering
HTTP securityhelmet (v8+)manual headersSets 11 headers correctly by default
Rate limitexpress-rate-limit + RedisnothingLogin brute-force takes minutes without it
Validationzod / joimanual if checksType-safe, strips unknown fields
ORMdrizzle-orm / prismastring concatenationParameterized by design
Sessionexpress-session + Rediscookie-onlyServer-side storage, revocable
TemplateHandlebars / Nunjucks (autoescape:true)EJS <%-Auto-escape prevents XSS
Regexre2nested quantifiersLinear time, no catastrophic backtracking

Critical CVEs (2025-2026)

CVETargetCVSSImpact
CVE-2025-55182React Server Components / Next.js10.0Pre-auth RCE via single HTTP request
CVE-2025-59465Node.js HTTP/27.5Server crash via malformed HEADERS
CVE-2026-33660n8n (AlaSQL + prototype pollution)9.4RCE via workflow nodes
CVE-2025-53773GitHub Copilot9.6RCE via prompt injection in source files
CVE-2026-3125OpenNext CloudflareHighSSRF via path normalization bypass
CVE-2025-59145GitHub Copilot (CamoLeak)9.6Secret exfiltration via prompt injection
Shai-Huludnpm ecosystemCriticalSelf-propagating worm, 500+ packages
Axios compromiseaxios 1.14.1 / 0.30.4CriticalRAT in 3-hour window (DPRK attributed)

Decision: When to Read Reference Files

Load only the files that match the concern at hand — each is focused.

ConcernFile
Express baseline, rate limit, Zod validation, error handler, prod misconfigsexpress.md
Password (Argon2id), JWT (jose), sessions, RBAC/ownership, timing-safe, JWT attacksauth.md
Parameterized SQL, race conditions / TOCTOU, row locking, distributed locksdb.md
File upload (multer, MIME, magic bytes), path traversaluploads.md
SSRF (DNS resolve, private-IP block, redirect handling), prototype pollutionssrf.md
ReDoS (event-loop blocking regex), WebSocket / Socket.IO hardening, CSWSHdos.md
GraphQL: introspection, depth/complexity, batching, field-level authgraphql.md
Prompt injection / LLM apps: input filter, delimited prompts, output validation, tool least-privilegellm.md
HTML/CSS/frontend: XSS, DOM clobbering, template injection, postMessage, iframe sandboxfrontend-security.md
HTTP security headers, CSP nonces, cookie flags, CORSheaders-and-csp.md
Dependencies, lockfiles, SRI, npm supply-chain attacks, emergency responsesupply-chain.md
Reviewing AI-generated code, CWE statistics, OpenSSF guidanceai-code-mistakes.md

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.