Resvolution - Components, Runtime & Booting
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
@@ -19,15 +20,17 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
|
||||
public class ClickJackingCheck : HealthCheck
|
||||
{
|
||||
private readonly ILocalizedTextService _textService;
|
||||
private readonly IRuntimeState _runtime;
|
||||
|
||||
private const string SetFrameOptionsHeaderInConfigActiobn = "setFrameOptionsHeaderInConfig";
|
||||
|
||||
private const string XFrameOptionsHeader = "X-Frame-Options";
|
||||
private const string XFrameOptionsValue = "sameorigin"; // Note can't use "deny" as that would prevent Umbraco itself using IFRAMEs
|
||||
|
||||
public ClickJackingCheck(HealthCheckContext healthCheckContext) : base(healthCheckContext)
|
||||
public ClickJackingCheck(ILocalizedTextService textService, IRuntimeState runtime)
|
||||
{
|
||||
_textService = healthCheckContext.ApplicationContext.Services.TextService;
|
||||
_textService = textService;
|
||||
_runtime = runtime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -60,7 +63,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
|
||||
{
|
||||
var message = string.Empty;
|
||||
var success = false;
|
||||
var url = HealthCheckContext.HttpContext.Request.Url;
|
||||
var url = _runtime.ApplicationUrl;
|
||||
|
||||
// Access the site home page and check for the click-jack protection header or meta tag
|
||||
var address = string.Format("http://{0}:{1}", url.Host.ToLower(), url.Port);
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Web.HealthCheck.Checks.Security
|
||||
@@ -15,10 +16,12 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
|
||||
public class ExcessiveHeadersCheck : HealthCheck
|
||||
{
|
||||
private readonly ILocalizedTextService _textService;
|
||||
private readonly IRuntimeState _runtime;
|
||||
|
||||
public ExcessiveHeadersCheck(HealthCheckContext healthCheckContext) : base(healthCheckContext)
|
||||
public ExcessiveHeadersCheck(ILocalizedTextService textService, IRuntimeState runtime)
|
||||
{
|
||||
_textService = healthCheckContext.ApplicationContext.Services.TextService;
|
||||
_textService = textService;
|
||||
_runtime = runtime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -45,7 +48,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
|
||||
{
|
||||
var message = string.Empty;
|
||||
var success = false;
|
||||
var url = HealthCheckContext.HttpContext.Request.Url;
|
||||
var url = _runtime.ApplicationUrl;
|
||||
|
||||
// Access the site home page and check for the headers
|
||||
var address = string.Format("http://{0}:{1}", url.Host.ToLower(), url.Port);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.HealthCheck.Checks.Config;
|
||||
@@ -16,12 +17,14 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
|
||||
public class HttpsCheck : HealthCheck
|
||||
{
|
||||
private readonly ILocalizedTextService _textService;
|
||||
private readonly IRuntimeState _runtime;
|
||||
|
||||
private const string FixHttpsSettingAction = "fixHttpsSetting";
|
||||
|
||||
public HttpsCheck(HealthCheckContext healthCheckContext) : base(healthCheckContext)
|
||||
public HttpsCheck(ILocalizedTextService textService, IRuntimeState runtime)
|
||||
{
|
||||
_textService = healthCheckContext.ApplicationContext.Services.TextService;
|
||||
_textService = textService;
|
||||
_runtime = runtime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -54,9 +57,9 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
|
||||
{
|
||||
var message = string.Empty;
|
||||
var success = false;
|
||||
var url = HealthCheckContext.HttpContext.Request.Url;
|
||||
var url = _runtime.ApplicationUrl;
|
||||
|
||||
// Attempt to access the site over HTTPS to see if it HTTPS is supported
|
||||
// Attempt to access the site over HTTPS to see if it HTTPS is supported
|
||||
// and a valid certificate has been configured
|
||||
var address = string.Format("https://{0}:{1}", url.Host.ToLower(), url.Port);
|
||||
var request = (HttpWebRequest)WebRequest.Create(address);
|
||||
@@ -133,7 +136,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Security
|
||||
new[] {httpsSettingEnabled.ToString(), httpsSettingEnabled ? string.Empty : "not"});
|
||||
resultType = httpsSettingEnabled ? StatusResultType.Success: StatusResultType.Error;
|
||||
}
|
||||
|
||||
|
||||
return
|
||||
new HealthCheckStatus(resultMessage)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user