Add AvoidUsingAllowUnencryptedAuthentication#1857
Merged
JamesWTruher merged 8 commits intoPowerShell:masterfrom Feb 13, 2024
Merged
Add AvoidUsingAllowUnencryptedAuthentication#1857JamesWTruher merged 8 commits intoPowerShell:masterfrom
JamesWTruher merged 8 commits intoPowerShell:masterfrom
Conversation
bergmeister
approved these changes
Nov 7, 2022
Collaborator
bergmeister
left a comment
There was a problem hiding this comment.
Thanks, just some minor suggestions but looks good otherwise.
| #if !CORECLR | ||
| [Export(typeof(IScriptRule))] | ||
| #endif | ||
| public class AvoidUsingAllowUnencryptedAuthentication : AvoidParameterGeneric |
Collaborator
There was a problem hiding this comment.
nice, didn't know there was this base class to make implementation so much simpler
Co-authored-by: Christoph Bergmeister <c.bergmeister@gmail.com>
bergmeister
reviewed
Feb 1, 2024
… into authRule # Conflicts: # Rules/Strings.Designer.cs # Rules/Strings.resx
| Describe "AvoidUsingAllowUnencryptedAuthentication" { | ||
| Context "When there are violations" { | ||
| It "detects unencrypted authentication violations" { | ||
| (Invoke-ScriptAnalyzer -ScriptDefinition 'Invoke-WebRequest foo -AllowUnencryptedAuthentication' -Settings $settings).Count | Should -Be 1 |
Contributor
There was a problem hiding this comment.
i'd be happier if these were separate test cases, but this is ok
JamesWTruher
approved these changes
Feb 13, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
This adds a new rule:
AvoidUsingAllowUnencryptedAuthentication.This rule searches for use of the
-AllowUnencryptedAuthenticationswitch. This mainly serves to flag use withInvoke-WebRequestandInvoke-RestMethod, but also works for other cmdlets which may use the same parameter scheme.This parameter is directly warned against in MSDN as it isn't secure. It is risky and should only be used for compatibility with legacy systems. A
Warninghere should be sufficient to dissuade against this.PR Checklist
.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.