Skoda Connect TP3: vehicle control (climate/charging/window/lock) #969
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Security & Quality | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| permissions: | |
| contents: read | |
| security-events: write | |
| actions: read | |
| jobs: | |
| codeql: | |
| name: CodeQL Analysis | |
| runs-on: ubuntu-latest | |
| if: github.actor != 'dependabot[bot]' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v4 | |
| with: | |
| languages: javascript-typescript | |
| queries: security-extended | |
| - name: Autobuild | |
| uses: github/codeql-action/autobuild@v4 | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }} | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v4 | |
| audit: | |
| name: Dependency Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm ci | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }} | |
| - name: Run npm audit | |
| run: npm audit --audit-level=high || true | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }} | |
| - name: Check for critical vulnerabilities | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }} | |
| run: | | |
| RESULT=$(npm audit --json 2>/dev/null | node -e " | |
| const data=require('fs').readFileSync('/dev/stdin','utf8'); | |
| try { | |
| const audit=JSON.parse(data); | |
| const critical=(audit.metadata?.vulnerabilities?.critical||0); | |
| console.log(critical); | |
| } catch { console.log('0'); } | |
| ") | |
| echo "High/Critical vulnerabilities: $RESULT" | |
| if [ "$RESULT" -gt 0 ] 2>/dev/null; then | |
| echo "::error::Found $RESULT high/critical vulnerabilities" | |
| exit 1 | |
| fi | |
| eslint-security: | |
| name: ESLint Security | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - name: Install ESLint with security plugin | |
| run: npm install --no-save eslint@8 eslint-plugin-security@1.7.1 | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }} | |
| - name: Create security ESLint config | |
| run: | | |
| cat > .eslintrc.security.json << 'ESLINTEOF' | |
| { | |
| "plugins": ["security"], | |
| "extends": ["plugin:security/recommended"], | |
| "env": { "node": true, "es2022": true }, | |
| "parserOptions": { "ecmaVersion": 2022 }, | |
| "rules": { | |
| "security/detect-eval-with-expression": "error", | |
| "security/detect-non-literal-fs-filename": "warn", | |
| "security/detect-non-literal-require": "warn", | |
| "security/detect-possible-timing-attacks": "warn", | |
| "security/detect-child-process": "warn" | |
| } | |
| } | |
| ESLINTEOF | |
| - name: Run ESLint security scan | |
| run: npx eslint -c .eslintrc.security.json "src/**/*.js" "public/**/*.js" --no-eslintrc --format stylish || true | |
| trivy: | |
| name: Trivy Container Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build Docker image | |
| run: docker build --build-arg NODE_AUTH_TOKEN="$NODE_AUTH_TOKEN" -t gatecontrol:security-scan . | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }} | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| image-ref: 'gatecontrol:security-scan' | |
| format: 'table' | |
| exit-code: '1' | |
| severity: 'CRITICAL,HIGH' | |
| ignore-unfixed: true | |
| trivyignores: '.trivyignore' |