Skip to content

Commit 14c5aee

Browse files
Merge pull request #2 from tithely/SEC25-121
Adding psalm security scanning to repo
2 parents bf03e93 + e9b684c commit 14c5aee

3 files changed

Lines changed: 61 additions & 1 deletion

File tree

.github/workflows/psalm.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Psalm Security Scan
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ "qa", "main" ]
7+
pull_request:
8+
branches: [ "qa", "main" ]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
php-security:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
security-events: write
19+
actions: read
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up PHP with required extensions
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: 8.4
29+
30+
- name: Setup Composer Access
31+
run: composer config -g github-oauth.github.com ${{ secrets.ACTIONS_ACCESS_TOKEN }}
32+
33+
- name: Install Dependencies
34+
run: composer install
35+
36+
- name: Run Psalm Security Scan
37+
run: vendor/bin/psalm --taint-analysis --output-format=sarif > results.sarif
38+
39+
- name: Upload Security Analysis results to GitHub
40+
uses: github/codeql-action/upload-sarif@v3
41+
with:
42+
sarif_file: results.sarif

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"require-dev": {
2323
"squizlabs/php_codesniffer": "~3.0",
2424
"phpunit/phpunit": "^9.6",
25-
"friendsofphp/php-cs-fixer": "v3.84"
25+
"friendsofphp/php-cs-fixer": "v3.84",
26+
"vimeo/psalm": "^6.14"
2627
},
2728
"autoload": {
2829
"psr-4": {

psalm.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="7"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
findUnusedBaselineEntry="true"
9+
findUnusedCode="true"
10+
>
11+
<projectFiles>
12+
<directory name="src" />
13+
<ignoreFiles>
14+
<directory name="vendor" />
15+
</ignoreFiles>
16+
</projectFiles>
17+
</psalm>

0 commit comments

Comments
 (0)