- 입력 검증 강화 (로그인/체인 핸들러 전체) - boss raid 비관적 잠금으로 동시성 문제 해결 - SSAFY 사용자명 sanitize + 트랜잭션 처리 - constant-time API 키 비교, 보안 헤더, graceful shutdown - 안전하지 않은 기본값 경고 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
pkg/middleware/security.go
Normal file
13
pkg/middleware/security.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package middleware
|
||||
|
||||
import "github.com/gofiber/fiber/v2"
|
||||
|
||||
// SecurityHeaders sets common HTTP security headers on every response.
|
||||
func SecurityHeaders(c *fiber.Ctx) error {
|
||||
c.Set("X-Content-Type-Options", "nosniff")
|
||||
c.Set("X-Frame-Options", "DENY")
|
||||
c.Set("X-XSS-Protection", "0")
|
||||
c.Set("Referrer-Policy", "strict-origin-when-cross-origin")
|
||||
c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'")
|
||||
return c.Next()
|
||||
}
|
||||
Reference in New Issue
Block a user