Skip to content

Commit

Permalink
Merge pull request #207 from FastReports/sync_branch_637342092127921799
Browse files Browse the repository at this point in the history
* sync 8/28/2020
  • Loading branch information
KirillKornienko authored Aug 28, 2020
2 parents 0b3a5a3 + faae269 commit fa3a983
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
29 changes: 14 additions & 15 deletions FastReport.Base/Utils/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ internal static void Init()
scriptSecurityProps = new ScriptSecurityProperties();
#endif
}
//RestoreScriptSecurity();
LoadPlugins();

// init TextRenderingHint.SystemDefault
Expand Down Expand Up @@ -479,7 +478,7 @@ private static void RestoreRightToLeft()
/// </summary>
public class ScriptSecurityProperties
{
private readonly string[] defaultBlackList = new[]
private readonly string[] defaultStopList = new[]
{
"GetType",
"typeof",
Expand All @@ -489,7 +488,7 @@ public class ScriptSecurityProperties
"GetProcAddress",
};

private string[] blackList;
private string[] stopList;

/// <summary>
/// Add stubs for the most dangerous classes (in System.IO, System.Reflection etc)
Expand All @@ -499,40 +498,40 @@ public class ScriptSecurityProperties
/// <summary>
/// List of keywords that shouldn't be declared in the report script
/// </summary>
public string[] BlackList
public string[] StopList
{
get { return (string[])blackList.Clone(); }
get { return (string[])stopList.Clone(); }
set
{
if(value != null)
{
OnBlackListChanged?.Invoke(this, null);
blackList = value;
OnStopListChanged?.Invoke(this, null);
stopList = value;
}
}
}

/// <summary>
/// Throws when <see cref="BlackList"/> has changed
/// Throws when <see cref="StopList"/> has changed
/// </summary>
public event EventHandler OnBlackListChanged;
public event EventHandler OnStopListChanged;

internal ScriptSecurityProperties()
{
SetDefaultBlackList();
SetDefaultStopList();
}

internal ScriptSecurityProperties(string[] blackList)
internal ScriptSecurityProperties(string[] stopList)
{
this.blackList = blackList;
this.stopList = stopList;
}

/// <summary>
/// Sets default value for <see cref="BlackList"/>
/// Sets default value for <see cref="StopList"/>
/// </summary>
public void SetDefaultBlackList()
public void SetDefaultStopList()
{
BlackList = defaultBlackList;
StopList = defaultStopList;
}

}
Expand Down
2 changes: 1 addition & 1 deletion FastReport.Web.Base/ScriptSecurity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public bool IsValid(Language lang, string reportScript, string[] references, Rep
return false;
}

foreach (string pattern in Config.ScriptSecurityProps.BlackList)
foreach (string pattern in Config.ScriptSecurityProps.StopList)
{
if (reportScript.IndexOf(pattern) != -1)
return false;
Expand Down

0 comments on commit fa3a983

Please sign in to comment.