Receber por email
← Voltar para o catálogo

appsec-owasp

Use this skill when securing web applications, preventing OWASP Top 10 vulnerabilities, implementing input validation, or designing authentication. Triggers on XSS, SQL injection, CSRF, SSRF, broken authentication, security headers, input validation, output encoding, OWASP, and any task requiring application security hardening.

185estrelas
Atualizado há 4 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add AbsolutelySkilled/AbsolutelySkilled

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/appsec-owasp/svg)](https://www.skillteca.com.br/skills/appsec-owasp)

Skills relacionadas

Ver todas de Segurança →

Alerta por categoria

Receba novas skills de Segurança toda segunda

1 email curto, só com as skills novas de Segurança. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

When this skill is activated, always start your first response with the 🧢 emoji.

AppSec - OWASP Top 10

A practitioner's guide to application security based on the OWASP Top 10 2021. This skill covers the full lifecycle of web application security - from threat modeling to concrete code patterns for preventing injection, authentication failures, XSS, CSRF, SSRF, and misconfiguration. Designed for developers who need security guidance at the code level, not just as policy.

When to use this skill

Trigger this skill when the user:

  • Asks how to prevent XSS, SQL injection, CSRF, or SSRF
  • Implements or reviews authentication / session management
  • Sets security headers (CSP, HSTS, X-Frame-Options, etc.)
  • Validates or sanitizes user input
  • Designs authorization logic or access controls
  • Reviews code for OWASP Top 10 vulnerabilities
  • Asks about output encoding, parameterized queries, or allowlists

Do NOT trigger this skill for:

  • Network-level security (firewalls, VPNs, DDoS mitigation) - use a network

security skill instead

  • Secrets management / key rotation workflows - use a secrets management skill

for those operational concerns

Key principles

  1. Never trust user input - All data from the outside world is untrusted:

HTTP bodies, headers, query params, cookies, uploaded files, and even data read back from your own database that originated from user input.

  1. Defense in depth - Apply multiple independent security controls. If one

layer fails, the next one stops the attack. Never rely on a single control.

  1. Least privilege - Every component (user accounts, DB connections, API

tokens, OS processes) should have only the permissions required and nothing more. Blast radius is limited by privilege scope.

  1. Fail securely - When something goes wrong, default to the most

restrictive outcome. Deny access on error, not grant it. Surface a generic error message to users, log the detail server-side.

  1. Security by default - Secure configuration should be the default state.

Developers should have to explicitly opt out of security controls, not opt in.

Core concepts

OWASP Top 10 2021

| Rank | Category | Root cause | Typical impact | |------|----------|------------|----------------| | A01 | Broken Access Control | Missing server-side checks, IDOR | Data breach, privilege escalation | | A02 | Cryptographic Failures | Weak algorithms, missing TLS, plain-text PII | Data exposure, credential theft | | A03 | Injection (SQL, NoSQL, OS, LDAP) | String-concatenated queries | Data breach, RCE, data destruction | | A04 | Insecure Design | No threat model, missing abuse cases | Business logic bypass | | A05 | Security Misconfiguration | Defaults unchanged, debug on in prod | Information disclosure, RCE | | A06 | Vulnerable and Outdated Components | Unpinned deps, no CVE scanning | Range from XSS to full compromise | | A07 | Identification and Auth Failures | Weak passwords, no MFA, bad session mgmt | Account takeover | | A08 | Software and Data Integrity Failures | Unsigned artifacts, insecure deserialization | Supply chain attack, RCE | | A09 | Security Logging and Monitoring Failures | No audit trail, no alerting | Undetected breach, slow response | | A10 | SSRF | User-controlled URLs fetched server-side | Internal network access, cloud metadata theft |

Threat modeling basics

Before writing security controls, answer four questions:

  1. What are we building? - Draw a data-flow diagram including trust boundaries
  2. What can go wrong? - Use STRIDE (Spoofing, Tampering, Repudiation, Info

Disclosure, Denial of Service, Elevation of Privilege)

  1. What are we going to do about it? - For each threat, decide: mitigate,

accept, transfer, or eliminate

  1. Did we do a good enough job? - Validate controls cover identified threats

Run threat modeling at design time, not after the code is written.

Security headers quick reference

| Header | Recommended value | Defends against | |--------|-------------------|-----------------| | Content-Security-Policy | default-src 'self'; script-src 'self' | XSS via inline scripts and external resources | | Strict-Transport-Security | max-age=63072000; includeSubDomains; preload | Protocol downgrade, cookie hijacking | | X-Content-Type-Options | nosniff | MIME-type confusion attacks | | X-Frame-Options | DENY | Clickjacking | | Referrer-Policy | strict-origin-when-cross-origin | Referrer leakage | | Permissions-Policy | camera=(), microphone=(), geolocation=() | Browser feature misuse |

See references/security-headers.md for full CSP directive reference and frame-ancestors vs X-Frame-Options comparison.

Common tasks

Prevent XSS with output encoding

Never insert untrusted data into HTML without context-aware encoding. The encoding rule depends on where in the HTML the data lands.

import DOMPurify from 'dompurify';
import { escape } from 'html-escaper';

// 1. HTML context - escape <, >, &, ", '
function renderComment(userInput: string): string {
  return escape(userInput); // safe: &lt;script&gt; not executed
}

// 2. When you must allow some HTML (e.g. rich text) - sanitize, don't escape
function renderRichText(userHtml: string): string {
  // DOMPurify strips disallowed tags/attributes; allowlist only what you need
  return DOMPurify.sanitize(userHtml, {
    ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'a', 'p', 'ul', 'li'],
    ALLOWED_ATTR: ['href', 'title'],
  });
}

// 3. JavaScript context - use JSON.stringify, never template-inject
// WRONG:  <script>var name = "<%= userInput %>";</script>
// RIGHT:
function inlineJsonData(data: unknown): string {
  // JSON.stringify encodes <, >, & to unicode escapes automatically
  return `<script>var __DATA__ = ${JSON.stringify(data)};</script>`;
}
Set Content-Security-Policy: default-src 'self'; script-src 'self' so that
even if encoding fails, inline scripts are blocked by the browser.

Prevent SQL injection with parameterized queries

Never concatenate user input into SQL strings. Always use parameterized queries or a safe ORM layer.

import { Pool } from 'pg';

const pool = new Pool();

// WRONG - string interpolation:
// const rows = await pool.query(`SELECT * FROM users WHERE email = '${email}'`);

// RIGHT - parameterized ($1, $2 for pg):
async function findUserByEmail(email: string) {
  const { rows } = await pool.query(
    'SELECT id, name, email FROM users WHERE email = $1',
    [email]
  );
  return rows[0] ?? null;
}

// RIGHT - ORM (Prisma example):
// const user = await prisma.user.findUnique({ where: { email } });

// Dynamic ORDER BY (column names can't be parameterized - use an allowlist):
const ALLOWED_SORT_COLUMNS = new Set(['name', 'created_at', 'email'] as const);

async function listUsers(sortBy: string, order: 'ASC' | 'DESC') {
  if (!ALLOWED_SORT_COLUMNS.has(sortBy as any)) {
    throw new Error(`Invalid sort column: ${sortBy}`);
  }
  const direction = order === 'DESC' ? 'DESC' : 'ASC'; // only two valid values
  const { rows } = await pool.query(
    `SELECT id, name FROM users ORDER BY ${sortBy} ${direction}`
  );
  return rows;
}

Implement CSRF protection

For detailed CSRF token pattern and SameSite cookie implementations, see references/auth-csrf-patterns.md.

Set security headers (CSP, HSTS, X-Frame-Options)

import helmet from 'helmet';
import { Express } from 'express';

function applySecurityHeaders(app: Express): void {
  app.use(
    helmet({
      // HSTS: force HTTPS for 2 years, include subdomains, add to preload list
      hsts: {
        maxAge: 63072000,
        includeSubDomains: true,
        preload: true,
      },

      // CSP: restrict resource loading to same origin; tighten per-app
      contentSecurityPolicy: {
        directives: {
          defaultSrc: ["'self'"],
          scriptSrc: ["'self'"],          // no inline scri
Compartilhar X LinkedIn