コード例 #1
0
        public void UaSupportsUpgradeInsecureRequests_UpgradeHeaderNotOk_ReturnsFalse()
        {
            SetRequestUpgradeHeader("yolo");

            var helper = new CspUpgradeInsecureRequestHelper();

            Assert.IsFalse(helper.UaSupportsUpgradeInsecureRequests(_request.Object));
        }
コード例 #2
0
        internal void SetSitewideHeadersFromConfig(HttpContextBase context)
        {
            var nwebsecContext = context.GetNWebsecContext();

            SetHstsHeader(context.Response, context.Request.IsSecureConnection, _cspUpgradeRequestHelper.UaSupportsUpgradeInsecureRequests(context.Request));
            SetHpkpHeader(context.Response, context.Request.IsSecureConnection, false);
            SetHpkpHeader(context.Response, context.Request.IsSecureConnection, true);
            SetXRobotsTagHeader(context.Response, nwebsecContext);
            SetXFrameoptionsHeader(context.Response, nwebsecContext);
            SetXContentTypeOptionsHeader(context.Response, nwebsecContext);
            SetXDownloadOptionsHeader(context.Response, nwebsecContext);
        }
コード例 #3
0
        internal void SetSitewideHeadersFromConfig(HttpContextBase context)
        {
            var nwebsecContext = context.GetNWebsecContext();
            var httpContext    = new HttpContextWrapper(context);

            SetHstsHeader(httpContext, context.Request.IsSecureConnection, _cspUpgradeRequestHelper.UaSupportsUpgradeInsecureRequests(context.Request));
            SetXRobotsTagHeader(httpContext, nwebsecContext);
            SetXFrameoptionsHeader(httpContext, nwebsecContext);
            SetXContentTypeOptionsHeader(httpContext, nwebsecContext);
            SetXDownloadOptionsHeader(httpContext, nwebsecContext);
            SetReferrerPolicyHeader(httpContext, nwebsecContext);
        }
コード例 #4
0
        public void UaSupportsUpgradeInsecureRequests_NotSupported_ReturnsFalse()
        {
            var helper = new CspUpgradeInsecureRequestHelper();

            Assert.IsFalse(helper.UaSupportsUpgradeInsecureRequests(_request.Object));
        }