Przejdź do treści
Biblioteka skilli
Bezpieczeństwo · Przegląd i audyt

security-patterns

/security-patterns

Ustala konwencje uwierzytelniania, walidacji danych wejściowych i sekretów przy pisaniu lub przeglądzie middleware, tras, JWT i CORS.

Licencja
MIT
Ostatnia zmiana repozytorium
23.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 23.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Ustala konwencje uwierzytelniania, walidacji danych wejściowych i sekretów przy pisaniu lub przeglądzie middleware, tras, JWT i CORS.

Oryginalny opis (EN)

Auth, input-validation, and secrets conventions. Use when writing or reviewing authentication, authorization, middleware, routes, JWT, CSRF, or CORS code; for a full audit of pending changes use /security-review.

Jak działa

  1. Input Validation
  2. SQL Injection Prevention
  3. Authentication
  4. JWT / Token Security
  5. CSRF Protection
  6. Authorization
  7. Secrets Management
  8. HTTP Security Headers
  9. Logging
Sekcje z nagłówków SKILL.md, w oryginale · 83 linii, 406 słów
Podgląd SKILL.md
---
name: security-patterns
description: Auth, input-validation, and secrets conventions. Use when writing or reviewing authentication, authorization, middleware, routes, JWT, CSRF, or CORS code; for a full audit of pending changes use /security-review.
---

# Security Patterns

Apply these security practices when writing or reviewing code in auth, middleware, and API layers.

## Input Validation

- **Always validate** at system boundaries (API endpoints, form handlers, message consumers)
- **Never trust** client-side validation alone
- Use allowlists over denylists for input filtering
- Validate types, lengths, ranges, and formats
- Sanitize HTML output to prevent XSS (use framework auto-escaping)

## SQL Injection Prevention

- **Always** use parameterized queries or ORM methods
- **Never** construct SQL with string concatenation or f-strings
- Django: use QuerySet methods, `Q` objects, or `params` argument for raw SQL
- Node.js: use query builders (Knex) or ORM (Prisma, TypeORM) -- never template literals in SQL

```python
# WRONG
User.objects.raw(f"SELECT * FROM users WHERE email = '{email}'")

# CORRECT
User.objects.raw("SELECT * FROM users WHERE email = %s", [email])
User.objects.filter(email=email)
```

## Authentication

- Hash passwords with bcrypt, argon2, or scrypt (never MD5/SHA alone)
- Enforce minimum password complexity at registration
- Rate-limit login attempts (exponential backoff or account lockout)
- Use constant-time comparison for tokens and secrets
- Invalidate sessions on password change

## JWT / Token Security

- Set short expiration times (15min for access tokens, days for refresh)
- Store refresh tokens server-side (database or Redis)
- Never store sensitive data in JWT payload (it's base64, not encrypted)
- Validate `iss`, `aud`, and `exp` claims on every request
- Use `RS256` or `ES256` over `HS256` for multi-service architectures

## CSRF Protection

- Enable framework CSRF middleware (Django: `CsrfViewMiddleware`)
- Use `SameSite=Lax` or `Strict` on session cookies
- For SPAs: use token-based auth or double-submit cookies
- Never disable CSRF protection for convenience

## Authorization

- Check permissions on every request, not just in UI
- Use role-based or attribute-based access control
- Verify object ownership: `if obj.owner != request.user: return 403`
- Log authorization failures for monitoring

## Secrets Management

- Never hardcode secrets, API keys, or passwords in code
- Use environment variables or secret managers (AWS Secrets Manager, Vault)
- Add `.env` and credential files to `.gitignore`
- Rotate secrets on schedule and after any suspected breach

## HTTP Security Headers

Ensure these headers are set in production:

- `Strict-Transport-Security: max-age=31536000; includeSubDomains`
- `Content-Security-Policy: default-src 'self'`
- `X-Content-Type-Options: nosniff`
- `X-Frame-Options: DENY`
- `Referrer-Policy: strict-origin-when-cross-origin`

## Logging

- Log authentication events (login, logout, failed attempts)
- Log authorization failures
- **Never log** passwords, tokens, API keys, or PII
- Include request IDs for traceability

Wersje

RepozytoriumWynikLicencja
Ta strona · edjchapman/claude-code-config100MIT
CrowdStrike/foundry-skills100MIT
cloudai-x/claude-workflow-v2100MIT
yonatangross/orchestkit98MIT
yonatangross/orchestkit98MIT

Migawka bazy z 13.11.2026 · wersja paczki 2085e10b7a65 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100cloudflare-workers-security
    Zabezpiecza API w Cloudflare Workers: uwierzytelnianie, CORS, limity zapytań, walidację danych wejściowych i klucze JWT.
  • 100cors-security-headers
    Konfiguruje CORS i nagłówki bezpieczeństwa HTTP: middleware CORS, żądania preflight, Content-Security-Policy, ochronę CSRF, Helmet.js i bezpieczną konfigurację ciasteczek.
  • 100rust-web-security
    Modeluje zagrożenia i sprawdza bezpieczeństwo usług webowych w Rust: uwierzytelnianie, autoryzację najemców, sesje, JWT, CSRF, CORS i sekrety.
  • 100spring-security
    Konfiguruje, testuje i przegląda Spring Security 6 i 7: łańcuch filtrów, OAuth2 z JWT, logowanie OIDC, CSRF i CORS.
  • 95backend-spring-security
    Przegląda konfigurację Spring Security: łańcuchy filtrów, kodowanie haseł, CSRF i CORS, zabezpieczenia metod, sesje oraz JWT i OAuth2.
  • 95api-review
    Sprawdza endpointy API przed wdrożeniem pod kątem uwierzytelniania, autoryzacji i walidacji danych wejściowych.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.