Skip to content

Commit

Permalink
(MicrosoftDocsGH-90) Document PSAvoidUsingBrokenHashAlgorithms
Browse files Browse the repository at this point in the history
This change:

- documents the new `PSAvoidUsingBrokenHashAlgorithms` rule for
  **PSScriptAnalyzer** by updating the rule table and adding a document
  for the rule.
- Resolves MicrosoftDocs#90
- Fixes AB#4996
  • Loading branch information
michaeltlombardi committed Aug 11, 2022
1 parent 13f0ba0 commit ebba499
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
description: Cmdlet Verbs
ms.custom: PSSA v1.21.0
ms.date: 05/31/2022
ms.topic: reference
title: AvoidUsingBrokenHashAlgorithms
---
# AvoidUsingBrokenHashAlgorithms

**Severity Level: Warning**

## Description

Avoid using the broken algorithms MD5 or SHA-1.

## How

Replace broken algorithms with secure alternatives. MD5 and SHA-1 should be replaced with SHA256,
SHA384, SHA512, or other safer algorithms when possible, with MD5 and SHA-1 only being utilized by
necessity for backwards compatibility.

## Example 1

### Wrong

```powershell
Get-FileHash foo.txt -Algorithm MD5
```

### Correct

```powershell
Get-FileHash foo.txt -Algorithm SHA256
```

## Example 2

### Wrong

```powershell
Get-FileHash foo.txt -Algorithm SHA1
```

### Correct

```powershell
Get-FileHash foo.txt
```
1 change: 1 addition & 0 deletions reference/docs-conceptual/PSScriptAnalyzer/Rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The PSScriptAnalyzer contains the following rule definitions.
| [AvoidSemicolonsAsLineTerminators](./AvoidSemicolonsAsLineTerminators.md) | Warning | No | |
| [AvoidShouldContinueWithoutForce](./AvoidShouldContinueWithoutForce.md) | Warning | Yes | |
| [AvoidTrailingWhitespace](./AvoidTrailingWhitespace.md) | Warning | Yes | |
| [AvoidUsingBrokenHashAlgorithms](./AvoidUsingBrokenHashAlgorithms.md) | Warning | Yes | |
| [AvoidUsingCmdletAliases](./AvoidUsingCmdletAliases.md) | Warning | Yes | Yes<sup>2</sup> |
| [AvoidUsingComputerNameHardcoded](./AvoidUsingComputerNameHardcoded.md) | Error | Yes | |
| [AvoidUsingConvertToSecureStringWithPlainText](./AvoidUsingConvertToSecureStringWithPlainText.md) | Error | Yes | |
Expand Down

0 comments on commit ebba499

Please sign in to comment.