Skip to content

Commit 6329ad4

Browse files
(GH-90) Document PSAvoidUsingBrokenHashAlgorithms
This change: - documents the new `PSAvoidUsingBrokenHashAlgorithms` rule for **PSScriptAnalyzer** by updating the rule table and adding a document for the rule. - Resolves #90 - Fixes AB#4996
1 parent 13f0ba0 commit 6329ad4

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
description: Cmdlet Verbs
3+
ms.custom: PSSA v1.21.0
4+
ms.date: 05/31/2022
5+
ms.topic: reference
6+
title: AvoidUsingBrokenHashAlgorithms
7+
---
8+
# AvoidUsingBrokenHashAlgorithms
9+
10+
**Severity Level: Warning**
11+
12+
## Description
13+
14+
Avoid using the broken algorithms MD5 or SHA-1.
15+
16+
## How
17+
18+
Replace broken algorithms with secure alternatives. MD5 and SHA-1 should be replaced with SHA256,
19+
SHA384, SHA512, or other safer algorithms when possible, with MD5 and SHA-1 only being utilized by
20+
necessity for backwards compatibility.
21+
22+
## Example 1
23+
24+
### Wrong
25+
26+
```powershell
27+
Get-FileHash foo.txt -Algorithm MD5
28+
```
29+
30+
### Correct
31+
32+
```powershell
33+
Get-FileHash foo.txt -Algorithm SHA256
34+
```
35+
36+
## Example 2
37+
38+
### Wrong
39+
40+
```powershell
41+
Get-FileHash foo.txt -Algorithm SHA1
42+
```
43+
44+
### Correct
45+
46+
```powershell
47+
Get-FileHash foo.txt
48+
```

reference/docs-conceptual/PSScriptAnalyzer/Rules/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The PSScriptAnalyzer contains the following rule definitions.
2626
| [AvoidSemicolonsAsLineTerminators](./AvoidSemicolonsAsLineTerminators.md) | Warning | No | |
2727
| [AvoidShouldContinueWithoutForce](./AvoidShouldContinueWithoutForce.md) | Warning | Yes | |
2828
| [AvoidTrailingWhitespace](./AvoidTrailingWhitespace.md) | Warning | Yes | |
29+
| [AvoidUsingBrokenHashAlgorithms](./AvoidUsingBrokenHashAlgorithms.md) | Warning | Yes | |
2930
| [AvoidUsingCmdletAliases](./AvoidUsingCmdletAliases.md) | Warning | Yes | Yes<sup>2</sup> |
3031
| [AvoidUsingComputerNameHardcoded](./AvoidUsingComputerNameHardcoded.md) | Error | Yes | |
3132
| [AvoidUsingConvertToSecureStringWithPlainText](./AvoidUsingConvertToSecureStringWithPlainText.md) | Error | Yes | |

reference/docs-conceptual/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ items:
7171
href: PSScriptAnalyzer/Rules/AvoidShouldContinueWithoutForce.md
7272
- name: AvoidTrailingWhitespace
7373
href: PSScriptAnalyzer/Rules/AvoidTrailingWhitespace.md
74+
- name: AvoidUsingBrokenHashAlgorithms
75+
href: PSScriptAnalyzer/Rules/AvoidUsingBrokenHashAlgorithms.md
7476
- name: AvoidUsingCmdletAliases
7577
href: PSScriptAnalyzer/Rules/AvoidUsingCmdletAliases.md
7678
- name: AvoidUsingComputerNameHardcoded

0 commit comments

Comments
 (0)