b3e4976204
- Updated action bar with transparent buttons (colored on hover only) - Repositioned language selector after CV title for better flow - Simplified toggle labels (removed parentheses values) - Changed button styling: transparent by default, green/gray on hover - Updated name format to "Moreno Rubio, Juan Andrés" with right alignment - Added LIVGolf experience (Apr 2024-present) with detailed responsibilities - Updated profile photo to dni.jpeg - Refined summary text focusing on consultant/analyst/developer roles - Added award logos (clicplan.png, drolosoft.png, teseo.png) - Implemented smooth logo animations (fade/scale transitions) - Adjusted toggle dimensions (80px wide, 30px tall) with smaller icons (16x16) - Added breathing room to title and icon with proper padding - Removed italic styling from name per user preference
50 lines
1.6 KiB
Go
50 lines
1.6 KiB
Go
package middleware
|
|
|
|
import (
|
|
"net/http"
|
|
"os"
|
|
)
|
|
|
|
// SecurityHeaders adds production-grade security headers to responses
|
|
func SecurityHeaders(next http.Handler) http.Handler {
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
// Prevent clickjacking
|
|
w.Header().Set("X-Frame-Options", "SAMEORIGIN")
|
|
|
|
// Prevent MIME type sniffing
|
|
w.Header().Set("X-Content-Type-Options", "nosniff")
|
|
|
|
// XSS Protection (legacy but still useful for older browsers)
|
|
w.Header().Set("X-XSS-Protection", "1; mode=block")
|
|
|
|
// Referrer policy - strict privacy
|
|
w.Header().Set("Referrer-Policy", "strict-origin-when-cross-origin")
|
|
|
|
// Permissions Policy - disable unnecessary features
|
|
w.Header().Set("Permissions-Policy",
|
|
"geolocation=(), microphone=(), camera=(), payment=(), usb=(), "+
|
|
"magnetometer=(), gyroscope=(), accelerometer=()")
|
|
|
|
// Content Security Policy (comprehensive)
|
|
csp := "default-src 'self'; " +
|
|
"script-src 'self' 'unsafe-inline' https://unpkg.com https://code.iconify.design; " +
|
|
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; " +
|
|
"font-src 'self' https://fonts.gstatic.com; " +
|
|
"img-src 'self' data: https:; " +
|
|
"connect-src 'self' https://api.iconify.design; " +
|
|
"frame-ancestors 'self'; " +
|
|
"base-uri 'self'; " +
|
|
"form-action 'self'"
|
|
w.Header().Set("Content-Security-Policy", csp)
|
|
|
|
// HSTS - only in production with HTTPS
|
|
if os.Getenv("GO_ENV") == "production" {
|
|
// 1 year max-age, include subdomains
|
|
w.Header().Set("Strict-Transport-Security",
|
|
"max-age=31536000; includeSubDomains; preload")
|
|
}
|
|
|
|
next.ServeHTTP(w, r)
|
|
})
|
|
}
|