Merge pull request #253 from nickago/MM-1654
MM-1654 Anti-clickjacking measures
Этот коммит содержится в:
@@ -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_REQUEST_ID, c.RequestId)
|
||||||
w.Header().Set(model.HEADER_VERSION_ID, utils.Cfg.ServiceSettings.Version)
|
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 := ""
|
sessionId := ""
|
||||||
|
|
||||||
// attempt to parse the session token from the header
|
// attempt to parse the session token from the header
|
||||||
|
|||||||
@@ -36,6 +36,13 @@
|
|||||||
|
|
||||||
<script type="text/javascript" src="https://cloudfront.loggly.com/js/loggly.tracker.js" async></script>
|
<script type="text/javascript" src="https://cloudfront.loggly.com/js/loggly.tracker.js" async></script>
|
||||||
<script id="config" type="text/javascript" src="/static/config/config.js"></script>
|
<script id="config" type="text/javascript" src="/static/config/config.js"></script>
|
||||||
|
<style id="antiClickjack">body{display:none !important;}</style>
|
||||||
|
<script type="text/javascript">
|
||||||
|
if (self === top) {
|
||||||
|
var blocker = document.getElementById("antiClickjack");
|
||||||
|
blocker.parentNode.removeChild(blocker);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
config = {};
|
config = {};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user