diff --git a/api/context.go b/api/context.go index ac9dffcbc9..16da0a6eb4 100644 --- a/api/context.go +++ b/api/context.go @@ -101,6 +101,12 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Header().Set(model.HEADER_REQUEST_ID, c.RequestId) w.Header().Set(model.HEADER_VERSION_ID, utils.Cfg.ServiceSettings.Version) + // Instruct the browser not to display us in an iframe for anti-clickjacking + if !h.isApi { + w.Header().Set("X-Frame-Options", "DENY") + w.Header().Set("Content-Security-Policy", "frame-ancestors none") + } + sessionId := "" // attempt to parse the session token from the header diff --git a/web/templates/head.html b/web/templates/head.html index d143409986..7a7d4fe8e8 100644 --- a/web/templates/head.html +++ b/web/templates/head.html @@ -36,6 +36,13 @@ + +