fix: add csp to assets handler

Merge pull request from GHSA-954h-jrpm-72pm

(cherry picked from commit 73dbf31368)
This commit is contained in:
Livio Spring 2023-10-25 12:15:22 +03:00
parent 2025434b1e
commit 56897926a1
No known key found for this signature in database
GPG Key ID: 26BB1C2FA5952CF0

View File

@ -92,6 +92,8 @@ func NewHandler(commands *command.Commands, verifier *authz.TokenVerifier, authC
verifier.RegisterServer("Assets-API", "assets", AssetsService_AuthMethods)
router := mux.NewRouter()
csp := http_mw.SecurityHeaders(&http_mw.DefaultSCP, nil)
router.Use(callDurationInterceptor, instanceInterceptor, assetCacheInterceptor, accessInterceptor, csp)
router.Use(callDurationInterceptor, instanceInterceptor, assetCacheInterceptor, accessInterceptor)
RegisterRoutes(router, h)
router.PathPrefix("/{owner}").Methods("GET").HandlerFunc(DownloadHandleFunc(h, h.GetFile()))