Skip to content

Security Analysis

Security Analysis #5

Workflow file for this run

name: Security Analysis
on:
push:
branches: [ main ]
paths:
- '**.php'
- 'composer.json'
- 'composer.lock'
pull_request:
branches: [ main ]
paths:
- '**.php'
- 'composer.json'
- 'composer.lock'
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday
jobs:
security:
name: Security Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: json, mbstring
tools: composer:v2
- name: Install dependencies
run: composer install --prefer-dist --no-interaction
- name: Security advisories check
uses: symfonycorp/security-checker-action@v5
- name: Run Psalm Security Scan
run: |
vendor/bin/psalm --taint-analysis
vendor/bin/psalm --security-analysis --output-format=github
- name: Run JSON specific security checks
run: |
# Check for potentially unsafe json_decode usage
find src -type f -name "*.php" -exec grep -l "json_decode" {} \; | xargs -I {} php -l {}
# Check for proper JSON error handling
vendor/bin/phpstan analyse src --level=max --configuration=phpstan.neon \
--error-format=github
- name: SARIF Security Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:php"