Skip to content

🔥problem : permission and security #14

@triphopMahithi

Description

@triphopMahithi

😍 Check-list (security)

1.🔒 HTTP Security Headers

  • Content-Security-Policy (CSP) — ป้องกัน XSS
  • X-Content-Type-Options: nosniff — ป้องกัน MIME sniffing
  • X-Frame-Options: DENY หรือ SAMEORIGIN — ป้องกัน Clickjacking
  • Strict-Transport-Security — บังคับใช้ HTTPS
  • Referrer-Policy: no-referrer-when-downgrade หรือปลอดภัยกว่า
  • Permissions-Policy — จำกัด access จาก browser เช่น camera, geolocation

2.🧑‍💻 Frontend Security (JavaScript, HTML, CSS)

  • Escape output ทั้งหมดเมื่อแสดงข้อมูล user (ป้องกัน XSS)
  • ห้ามใช้ innerHTML ถ้าไม่จำเป็น
  • ตรวจสอบ URL ก่อน redirect (ป้องกัน Open Redirect)
  • ไม่เก็บ Token หรือ Credentials ไว้ใน JavaScript หรือ LocalStorage (ใช้ HttpOnly Cookie แทน)

3.🗝 Authentication & Authorization

  • ใช้ hashing ที่ปลอดภัย เช่น bcrypt / Argon2 กับ password
  • ตั้งค่า rate limit หรือ delay login fail (ป้องกัน Brute Force)
  • JWT หรือ Session ต้องมี exp, iss, aud และ validate ทุกครั้ง
  • Token/Session ต้องถูกเข้ารหัสและมี HttpOnly, Secure flag
  1. 💉 Input Validation & Sanitization
  • ตรวจสอบ input ทุกช่อง ทั้ง client-side และ server-side
  • ป้องกัน SQL Injection (ใช้ ORM หรือ parameterized queries)
  • ตรวจสอบ file uploads: จำกัดประเภทไฟล์, ตรวจ MIME, scan virus
  • Block หรือ sanitize HTML input ถ้าเปิดให้ user พิมพ์ข้อความ
  1. 🧰 API Security
  • ใช้ token-based auth (เช่น OAuth2, JWT)
  • Implement rate limiting/throttling
  • ตรวจสอบทุก endpoint ว่าต้องการ auth หรือไม่
  • อย่าเปิดเผย internal error (เช่น stack trace หรือ query string)
  1. 📊 Logging & Monitoring
  • Log การเข้าถึง admin, login, register, failed attempts
  • ตรวจสอบ log เป็นประจำ
  • ตั้ง alert เมื่อพบพฤติกรรมผิดปกติ (เช่น spike traffic, 5xx errors)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions