This commit is contained in:
2024-06-04 16:15:09 +01:00
parent e40876aeb2
commit 2f6395485a
123 changed files with 11943 additions and 314 deletions
@@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static Saxonite.Net.Standard.Base.App.Sax.Config.Security;
namespace Saxonite.Net.Core.Web.Base.Middleware
{
@@ -57,10 +58,12 @@ namespace Saxonite.Net.Core.Web.Base.Middleware
{
//if (SaxSystem.DebugMode) Logger.Debug(fn + " Form property " + modelName + ": '" + result.Model.ToString() + ".");
object originalValue = result.Model;
// Exclude properties that retain leading/trailing whitespace.
if (result.Model is string)
// Anything that looks like a password will be left as is.
bool password = modelName.ContainsCI("Password");
// Exclude properties that retain leading/trailing whitespace.
if (result.Model is string)
{
if (!modelName.ContainsCI("Password"))
if (!password)
{
string value = result.Model as string;
@@ -92,10 +95,12 @@ namespace Saxonite.Net.Core.Web.Base.Middleware
}
// Log property details.
if (result.Model != null && SaxSystem.DebugMode &&
// Ignore items that correspond with objects in the model rather than values.
!result.Model.ToString().Equals(result.Model.GetType().FullName) &&
// Ignore form files.
!result.Model.ToString().ContainsCI("Microsoft.AspNetCore.Http.IFormFile"))
// Ignore passwords.
!password &&
// Ignore items that correspond with objects in the model rather than values.
!result.Model.ToString().Equals(result.Model.GetType().FullName) &&
// Ignore form files.
!result.Model.ToString().ContainsCI("Microsoft.AspNetCore.Http.IFormFile"))
SaLogger.Debug(SysUtil.Fn + " Form property " + modelName + ": '" + result.Model.ToString() + "'." + (originalValue != null && !originalValue.Equals(result.Model) ? " Original value: '" + originalValue.ToString() + "'" : ""));
base.SetProperty(bindingContext, modelName, propertyMetadata, result);
}