Penerapan Content Security Policy Agar Server Lebih Aman
Content Security Policy atau CSP adalah pengaturan tambahan yang diterapkan melalui respon HTTP Headers. kegunaan dari CSP sendiri adalah untuk mencegah eksploitasi XSS maupun serangan dengan kode injeksi lainnya pada server. Dengan Content Security Policy kita bisa megatur sumber mana saja yang diijinkan untuk diload di server kita sehingga jika attacker mencoba menyisipkan kode exploit dari sumber yang tidak dipercaya makan browser akan memblokir.
Parameter yang Didukung
Ada beberapa petunjuk yang tersedia untuk pemilik website yang ingin menerapkan Content Security Policy. Sebuah server juga dapat mendefinisikan beberapa arahan dalam header keamanan CSP. Berikut beberapa daftar yang disediakan oleh owasp.org:
- default-src : Define loading policy for all resources type in case of a resource type dedicated directive is not defined (fallback),
- script-src : Define which scripts the protected resource can execute,
- object-src : Define from where the protected resource can load plugins,
- style-src : Define which styles (CSS) the user applies to the protected resource,
- img-src : Define from where the protected resource can load images,
- media-src : Define from where the protected resource can load video and audio,
- frame-src : Define from where the protected resource can embed frames,
- frame-ancestors : Specifies valid parents that may embed a page using , ,
Komentar