forked from KelvinTegelaar/CIPP-API
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (43 loc) · 1.48 KB
/
Copy pathpsscriptanalyzer.yml
File metadata and controls
47 lines (43 loc) · 1.48 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
47
# SAST for PowerShell: PSScriptAnalyzer with SARIF upload to the GitHub Security tab
# ISO 27001:2022 A.8.28/8.29 evidence — CodeQL does not support PowerShell, so
# PSScriptAnalyzer is the SAST tool for CIPP-API.
name: SAST - PSScriptAnalyzer
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
schedule:
- cron: "30 5 * * 1" # Weekly, catches newly added rules against unchanged code
permissions:
contents: read
security-events: write
actions: read
jobs:
psscriptanalyzer:
if: github.repository_owner == 'KelvinTegelaar'
name: Run PSScriptAnalyzer
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Run PSScriptAnalyzer
uses: microsoft/psscriptanalyzer-action@v1.1
with:
path: .\
recurse: true
# Security-focused rules; extend with full default ruleset if desired
includeRule:
'"PSAvoidUsingPlainTextForPassword",
"PSAvoidUsingConvertToSecureStringWithPlainText",
"PSAvoidUsingUsernameAndPasswordParams",
"PSUsePSCredentialType",
"PSAvoidUsingInvokeExpression",
"PSAvoidGlobalVars",
"PSAvoidUsingComputerNameHardcoded",
"PSUseDeclaredVarsMoreThanAssignments"'
output: results.sarif
- name: Upload SARIF to Security tab
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: results.sarif