php-security
/php-security
Pomaga zabezpieczyć aplikacje PHP przed SQL injection, XSS i słabym przechowywaniem haseł, z walidacją danych wejściowych.
- Autor
- HoangNguyen0403 ↗
- Repozytorium
- agent-skills-standard ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 12.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 3
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 12.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Pomaga zabezpieczyć aplikacje PHP przed SQL injection, XSS i słabym przechowywaniem haseł, z walidacją danych wejściowych.
Oryginalny opis (EN)
PHP-only security standards for database access, password handling, and input validation. Use when securing PHP apps against SQL injection, XSS, or weak password storage; defer Laravel middleware and security questions in other languages.
Jak działa
- Priority: P0 (CRITICAL)
- Structure
- Implementation Guidelines
- Anti-Patterns
- References
Podgląd SKILL.md
---
name: php-security
description: PHP-only security standards for database access, password handling, and input validation. Use when securing PHP apps against SQL injection, XSS, or weak password storage; defer Laravel middleware and security questions in other languages.
metadata:
triggers:
files:
- '**/*.php'
keywords:
- pdo
- password_hash
- htmlentities
- filter_var
- php security
- sql injection
- xss php
- prepared statement
- csrf
- sanitize input
- password storage
---
# PHP Security
## **Priority: P0 (CRITICAL)**
## Structure
```text
src/
└── Security/
├── Validators/
└── Auth/
```
## Implementation Guidelines
- **Prepared Statements**: Use PDO with Parameterized Queries: `$stmt = $pdo->prepare('SELECT * FROM users WHERE id = :id'); $stmt->execute([':id' => $id]);`. NEVER concatenate user input into SQL strings.
- **Password Hashing**: ALWAYS use **`password_hash()`** with **`PASSWORD_ARGON2ID`** (PHP 7.4+) or **`PASSWORD_BCRYPT`**.
- **Auth Verification**: Use `password_verify()`. Use `password_needs_rehash()` to upgrade legacy hashes. Implement Rate Limiting and MFA where appropriate.
- **XSS Escaping**: Use `htmlentities($userInput, ENT_QUOTES | ENT_HTML5, 'UTF-8')` or `htmlspecialchars()` on all user output. Prefer Twig or Blade for auto-escaping.
- **CSRF Protection**: Mandate **`CSRF tokens`** for all state-changing requests (`POST`, `PUT`, `PATCH`, `DELETE`).
- **Input Validation**: Use `filter_var($email, FILTER_VALIDATE_EMAIL)` or `filter_var($url, FILTER_VALIDATE_URL)`. Always Whitelist allowed values.
- **File Security**: RESTRICT file uploads by **MIME type** and **extension**. Store uploads **outside public root**.
- **Session Safety**: Configure **`session.cookie_httponly = 1`**, **`session.cookie_secure = 1`**, and **`session.samesite = "Lax"`**.
- **Header Security**: Enforce **`Content-Security-Policy (CSP)`**, **`X-Frame-Options: DENY`**, and **`X-Content-Type-Options: nosniff`**.
## Anti-Patterns
- **No SQL string concatenation**: Use PDO prepared statements only.
- **No MD5/SHA1 for passwords**: Use `password_hash($password, PASSWORD_ARGON2ID)`.
- **No raw `$_GET`/`$_POST`**: Validate all input with `filter_var()` first.
- **No production error display**: Log to file; never show to users.
## References
- [Secure Implementation Patterns](references/implementation.md)
Pliki w paczce (3)
- SKILL.md 2 KB
- evals/evals.json 3 KB
- references/implementation.md 1 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · HoangNguyen0403/agent-skills-standard | 100 | MIT |
| claude-dev-suite/claude-dev-suite | 100 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki f57b2e73ec5d (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
- 81PHP Security Patterns
Pokazuje wzorce bezpieczeństwa PHP: walidację danych, ochronę przed SQL injection i XSS, tokeny CSRF, hasła i sesje. - 100drupal-security-review
Audytuje własne moduły i motywy Drupala 11 pod kątem problemów bezpieczeństwa, takich jak niebezpieczna obsługa danych wejściowych, XSS, SQL injection i luki w kontroli dostępu. - 90security-injection-and-validation
Diagnozuje i naprawia obsługę niezaufanych danych wejściowych i wyjściowych, czyli XSS, wstrzyknięcia, niebezpieczne miejsca wpisu do DOM i szablony. - 100security
Audytuje kod pod kątem OWASP Top 10, XSS i SQL injection oraz skanuje zależności przez pnpm audit i Snyk przed wdrożeniem. - 100security
Audytuje kod pod kątem OWASP Top 10, XSS i SQL injection oraz skanuje zależności przez pnpm audit i Snyk przed wdrożeniem. - 100api-security
Podaje dobre praktyki bezpieczeństwa API i zapobiegania typowym podatnościom: uwierzytelnianie, walidacja wejścia, SQL injection, XSS i OWASP Top 10, przy budowie lub zmianie API.