-
Notifications
You must be signed in to change notification settings - Fork 394
Fix AvoidInternalURLs throw warnings at SDDL #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ff665f3
4f1ca19
178f484
22af2e8
1f523c6
e63edce
a68ed47
1eee6c5
52f882c
eb7c565
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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<DiagnosticRecord> 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 ":" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the mininum format for SDDLs. So if you see a string that has owner/group/discretionary ACLs and security ACLs that it is a SDDL. I believe the ordering is required. O:owner_sid There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we checking if the SDDL formats are correct as well? This check is just to exclude SDDL strings being warned as internal URLS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct No need to validate the SDDL format. |
||
var count = firstPartURL.Count(x => x == ':'); | ||
if (count == 3 || count == 4 ) | ||
{ | ||
isInternalURL = true; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think an SDDL can actually have 4 ":" |
||
} | ||
} | ||
if (isInternalURL) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
$correctPath = "www.bing.com" | ||
$externalSite = "//outside.co/test" | ||
rmdir /s /q ".\Directory" | ||
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)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is file in the current change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I committed the changes earlier to BugFixes by accident so I reverted the changes. This file may be reverted as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok thanks.