-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (40 loc) · 1.18 KB
/
Copy pathsecurity-scan.yml
File metadata and controls
46 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Security Scan
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
schedule:
- cron: '0 0 * * 0'
jobs:
analyze:
name: PowerShell Security Analysis
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install PowerShell
uses: actions/setup-powershell@v1
- name: Install PSScriptAnalyzer
shell: pwsh
run: Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser
- name: Run PSScriptAnalyzer security rules
shell: pwsh
run: |
$results = Invoke-ScriptAnalyzer -Path . -Recurse -IncludeRule @(
'PossibleInjection',
'UseCmdletCorrectly',
'UseOutputTypeCorrectly',
'AvoidUsingPlainTextForPassword',
'AvoidUsingConvertToSecureStringWithPlainText',
'AvoidUsingUsernameAndPasswordParams'
)
if ($results) {
$results | Format-Table
exit 1
}
Write-Host "No security issues found by PSScriptAnalyzer."