Skip to content

Commit 1eee6c5

Browse files
committed
Fix AvoidUsingInternalURLs throw warnings at SDDL
1 parent a68ed47 commit 1eee6c5

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Rules/AvoidUsingInternalURLs.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@
1313
using System;
1414
using System.Collections.Generic;
1515
using System.Linq;
16-
using System.Text;
17-
using System.Threading.Tasks;
1816
using System.Management.Automation.Language;
1917
using Microsoft.Windows.Powershell.ScriptAnalyzer.Generic;
2018
using System.ComponentModel.Composition;
21-
using System.Resources;
2219
using System.Globalization;
23-
using System.Threading;
24-
using System.Reflection;
2520
using System.IO;
2621

2722
namespace Microsoft.Windows.Powershell.ScriptAnalyzer.BuiltinRules
@@ -118,7 +113,12 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
118113
}
119114
if (!firstPartURL.Contains("."))
120115
{
121-
isInternalURL = true;
116+
//Add a check to exclude potential SDDL format. Check if a string have four components separated by ":"
117+
var count = firstPartURL.Count(x => x == ':');
118+
if (count !=3 )
119+
{
120+
isInternalURL = true;
121+
}
122122
}
123123
}
124124
if (isInternalURL)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
$correctPath = "www.bing.com"
22
$externalSite = "//outside.co/test"
3-
rmdir /s /q ".\Directory"
3+
rmdir /s /q ".\Directory"
4+
$sd = "O:BAG:BAD:(A;;0x800;;;WD)(A;;0x120fff;;;SY)(A;;0x120fff;;;LS)(A;;0x120fff;;;NS)(A;;0x120fff;;;BA)(A;;0xee5;;;LU)(A;;LC;;;MU)(A;;0x800;;;AG)"

0 commit comments

Comments
 (0)