Skip to content

Commit 9cb7241

Browse files
committed
Merge pull request #46 from PowerShell/issueFi
Fix AvoidInternalURLs throw warnings at SDDL
2 parents 767a438 + eb7c565 commit 9cb7241

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

RuleDocumentation/UseShouldProcessForStateChangingFunctions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
##Description
55

6-
Functions that have verbs like New, Start, Stop, Set, Reset that change system state should support 'ShouldProcess'
6+
Functions that have verbs like New, Start, Stop, Set, Reset and Restart that change system state should support 'ShouldProcess'
77

88
##How to Fix
99

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 || count == 4 )
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)