Langsung ke konten
Skillpedia
Keamanan107k Β· #780

security-and-hardening

Fungsinya

Tool ini membantu membuat kode Anda lebih aman dengan melindunginya dari serangan dan kebocoran data. Tool ini memeriksa apakah Anda sudah menangani informasi sensitif dan input pengguna dengan aman.

Kapan dipakai

  • βœ“Saat membangun bagian program yang menerima informasi dari luar.
  • βœ“Saat Anda perlu melindungi password, data pribadi, atau informasi pembayaran.
  • βœ“Saat mengintegrasikan program Anda dengan layanan atau API lain.

Link skill

https://github.com/addyosmani/agent-skills/blob/main/skills/security-and-hardening/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/addyosmani/agent-skills/blob/main/skills/security-and-hardening/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBagaimana cara memastikan input pengguna tidak menimbulkan masalah keamanan di kode saya?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Tool ini menganalisis bagaimana kode Anda menangani data eksternal, seperti informasi pengguna atau data dari sistem lain. Setelah itu, tool menyarankan praktik untuk mencegah data tersebut dipakai untuk menyerang program Anda.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Security and Hardening

Overview

Security-first development practices for web applications. Treat every external input as hostile, every secret as sacred, and every authorization check as mandatory. Security isn't a phase β€” it's a constraint on every line of code that touches user data, authentication, or external systems.

When to Use

  • Building anything that accepts user input
  • Implementing authentication or authorization
  • Storing or transmitting sensitive data
  • Integrating with external APIs or services
  • Adding file uploads, webhooks, or callbacks
  • Handling payment or PII data

Process: Threat Model First

Controls bolted on without a threat model are guesses. Before hardening, spend five minutes thinking like an attacker:

  1. Map the trust boundaries. Where does untrusted data cross into your system? HTTP requests, form fields, file uploads, webhooks, third-party APIs, message queues, and LLM output β€” plus the local values that look internal because the OS handed them to you: another process's command line or environment, filenames on a shared volume, a path in a job payload. Trust follows who wrote a value, not which channel delivered it. Every boundary is attack surface.
  2. Name the assets. What's worth stealing or breaking? Credentials, PII, payment data, admin actions, money movement.
  3. Run STRIDE over each boundary β€” a quick lens, not a ceremony:
Threat Ask Typical mitigation
Spoofing Can someone impersonate a user/service? Authentication, signature verification
Tampering Can data be altered in transit or at rest? Integrity checks, parameterized queries, HTTPS
Repudiation Can an action be denied later? Audit logging of security events
Information disclosure Can data leak? Encryption, field allowlists, generic errors
Denial of service Can it be overwhelmed? Rate limiting, input size caps, timeouts
Elevation of privilege Can a user gain rights they shouldn't? Authorization checks, least privilege
  1. Write abuse cases next to use cases. For each feature, ask "how would I misuse this?" β€” then make that your first test.

If you can't name the trust boundaries for a feature, you're not ready to secure it. This is OWASP A04: Insecure Design β€” most breaches begin in design, not code.

The Three-Tier Boundary System

Always Do (No Exceptions)

  • Validate all external input at the system boundary (API routes, form handlers)
  • Parameterize all database queries β€” never concatenate user input into SQL
  • Encode output to prevent XSS (use framework auto-escaping, don't bypass it)
  • Use HTTPS for all external communication
  • Hash passwords with bcrypt/scrypt/argon2 (never store plaintext)
  • Set security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options)
  • Use httpOnly, secure, sameSite cookies for sessions
  • Run the detected package manager's native audit against the committed lockfile before every release

Ask First (Requires Human Approval)

  • Adding new authentication flows or changing auth logic
  • Storing new categories of sensitive data (PII, payment info)
  • Adding new external service integrations
  • Changing CORS configuration
  • Adding file upload handlers
  • Modifying rate limiting or throttling
  • Granting elevated permissions or roles

Never Do

  • Never commit secrets to version control (API keys, passwords, tokens)
  • Never log sensitive data (passwords, tokens, full credit card numbers)
  • Never trust client-side validation as a security boundary
  • Never disable security headers for convenience
  • Never use eval() or innerHTML with user-provided data
  • Never store sessions in client-accessible storage (localStorage for auth tokens)
  • Never expose stack traces or internal error details to users

Hardening Controls

The rules below are the workflow; a concrete implementation of each lives in references/hardening-patterns.md. Open the section you need when you reach that code, not before.

Injection, XSS, and access control

  • Parameterize every query. Never build SQL, NoSQL, or shell commands from input strings.
  • Encode output through the framework's auto-escaping. If raw HTML is unavoidable, sanitize with an allowlist sanitizer first.

…

Pertanyaan umum

Apa itu 'kerentanan' (vulnerabilities)?

Ini adalah celah dalam kode yang bisa dieksploitasi oleh pihak jahat untuk mengakses informasi, merusak sistem, atau mengambil alih kendali.

Apa maksud 'perlakukan semua input eksternal sebagai ancaman'?

Artinya Anda harus selalu waspada terhadap data yang datang dari luar program (misalnya apa yang diketik pengguna) dan memastikan data itu aman sebelum digunakan.

Kenapa password tidak boleh disimpan dalam bentuk teks biasa?

Jika seseorang berhasil mengakses database Anda, password berbentuk teks biasa akan langsung terbuka. Menyimpan password yang sudah di-hash (diubah menjadi kode acak yang rumit) jauh lebih aman.

Detail

Deskripsi asli dari pembuat

Hardens code against vulnerabilities. Use when auditing an input handler for vulnerabilities, when handling user input, authentication, data storage, or external integrations, or when checking a login flow is safe against the OWASP Top Ten. Use when building any feature that accepts untrusted data, manages user sessions, or interacts with third-party services. Use when auditing dependencies for kn

repo: addyosmani/agent-skills

Popularitas

Bintang GitHub
107k
Peringkat
#780
Lisensi
MIT
Diperbarui
13/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa