fix tests. new product advisories enhancements
This commit is contained in:
@@ -182,8 +182,8 @@ public partial class InjectionTests : SecurityTestBase
|
||||
file class InputSanitizer
|
||||
{
|
||||
private static readonly char[] DangerousSqlChars = ['\'', ';', '-', '/', '*'];
|
||||
private static readonly char[] DangerousCommandChars = [';', '|', '&', '`', '$', '(', ')', '\n', '\r'];
|
||||
private static readonly string[] DangerousNoSqlPatterns = ["$gt", "$lt", "$ne", "$where", "$regex"];
|
||||
private static readonly char[] DangerousCommandChars = [';', '|', '&', '`', '$', '(', ')', '\n', '\r', '#', '%'];
|
||||
private static readonly string[] DangerousNoSqlPatterns = ["$gt", "$lt", "$ne", "$where", "$regex", "; return", "'; return"];
|
||||
private static readonly char[] DangerousFilenameChars = ['/', '\\', ';', '|', '&', '`', '$', '(', ')', '<', '>'];
|
||||
|
||||
public bool IsSafeForSql(string input)
|
||||
|
||||
@@ -192,11 +192,18 @@ file class UrlValidator
|
||||
private readonly bool _allowlistMode;
|
||||
private readonly HashSet<string> _allowlist = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private static readonly string[] BlockedHosts =
|
||||
private static readonly string[] BlockedHosts =
|
||||
[
|
||||
"localhost", "127.0.0.1", "::1", "0.0.0.0", "[::1]",
|
||||
"169.254.169.254", "metadata.google.internal"
|
||||
];
|
||||
|
||||
// Domains that look like they could redirect to internal IPs (DNS rebinding)
|
||||
private static readonly string[] SuspiciousDomains =
|
||||
[
|
||||
"nip.io", "xip.io", "sslip.io", "localtest.me",
|
||||
"burpcollaborator.net", "oastify.com", "interact.sh"
|
||||
];
|
||||
|
||||
private static readonly string[] BlockedSchemes =
|
||||
[
|
||||
@@ -252,6 +259,12 @@ file class UrlValidator
|
||||
return false;
|
||||
}
|
||||
|
||||
// Block suspicious DNS rebinding domains
|
||||
if (SuspiciousDomains.Any(d => uri.Host.EndsWith(d, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// In allowlist mode, only allow explicitly listed hosts
|
||||
if (_allowlistMode)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user