diff --git a/RuleDocumentation/UseShouldProcessForStateChangingFunctions.md b/RuleDocumentation/UseShouldProcessForStateChangingFunctions.md index d500091d0..4ac36a36b 100644 --- a/RuleDocumentation/UseShouldProcessForStateChangingFunctions.md +++ b/RuleDocumentation/UseShouldProcessForStateChangingFunctions.md @@ -3,7 +3,7 @@ ##Description -Functions that have verbs like New, Start, Stop, Set, Reset that change system state should support 'ShouldProcess' +Functions that have verbs like New, Start, Stop, Set, Reset and Restart that change system state should support 'ShouldProcess' ##How to Fix diff --git a/Rules/AvoidUsingInternalURLs.cs b/Rules/AvoidUsingInternalURLs.cs index c165d7672..1a5db9ef3 100644 --- a/Rules/AvoidUsingInternalURLs.cs +++ b/Rules/AvoidUsingInternalURLs.cs @@ -13,15 +13,10 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Management.Automation.Language; using Microsoft.Windows.Powershell.ScriptAnalyzer.Generic; using System.ComponentModel.Composition; -using System.Resources; using System.Globalization; -using System.Threading; -using System.Reflection; using System.IO; namespace Microsoft.Windows.Powershell.ScriptAnalyzer.BuiltinRules @@ -118,7 +113,12 @@ public IEnumerable AnalyzeScript(Ast ast, string fileName) } if (!firstPartURL.Contains(".")) { - isInternalURL = true; + //Add a check to exclude potential SDDL format. Check if a string have four components separated by ":" + var count = firstPartURL.Count(x => x == ':'); + if (count == 3 || count == 4 ) + { + isInternalURL = true; + } } } if (isInternalURL) diff --git a/Tests/Rules/AvoidUsingInternalURLsNoViolations.ps1 b/Tests/Rules/AvoidUsingInternalURLsNoViolations.ps1 index 73825de70..cdd8b7cc5 100644 --- a/Tests/Rules/AvoidUsingInternalURLsNoViolations.ps1 +++ b/Tests/Rules/AvoidUsingInternalURLsNoViolations.ps1 @@ -1,3 +1,4 @@ $correctPath = "www.bing.com" $externalSite = "//outside.co/test" -rmdir /s /q ".\Directory" \ No newline at end of file +rmdir /s /q ".\Directory" +$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)" \ No newline at end of file