refactor(mobile): finalize portability boundary #6688
Workflow file for this run
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
| on: | |
| pull_request: | |
| merge_group: | |
| name: Semgrep | |
| permissions: | |
| contents: read | |
| env: | |
| SEMGREP_ENABLE_VERSION_CHECK: 'false' | |
| jobs: | |
| # scans GitHub Actions and other repo-wide config | |
| semgrep: | |
| # This workflow runs org-wide as a required workflow. Private/internal repos | |
| # get the faster Depot runner; public repos stay on GitHub-hosted ubuntu-latest | |
| # (free minutes, and not every public repo has Depot enabled). The repository | |
| # context reflects the target repo, so this resolves per-repo automatically. | |
| runs-on: ${{ github.event.repository.private && 'depot-ubuntu-latest' || 'ubuntu-latest' }} | |
| timeout-minutes: 15 | |
| container: | |
| image: semgrep/semgrep:1.163.0@sha256:7cad2bc2d1e44f87f0bf4be6d1fa23aa90fb72015bebc89fb91385d813987a03 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Checkout .github repo (for custom semgrep rules) | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: PostHog/.github | |
| path: dotgithub-repo | |
| sparse-checkout: | | |
| .semgrep | |
| .github/scripts | |
| - name: Check for .github directory | |
| id: check | |
| run: | | |
| if [ -d ".github/" ]; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Run Semgrep | |
| id: semgrep | |
| if: steps.check.outputs.exists == 'true' | |
| continue-on-error: true | |
| run: | | |
| # These upstream rules reparse every run block as Bash and reject valid GitHub expressions. | |
| # Local generic-parser replacements preserve their coverage. Remove both exclusions and the | |
| # replacements after https://github.com/semgrep/semgrep-rules/issues/3688 is fixed and the | |
| # compatibility fixture passes with p/github-actions under --strict. | |
| semgrep \ | |
| --config "dotgithub-repo/.semgrep/rules/" \ | |
| --config "p/owasp-top-ten" \ | |
| --config "p/security-audit" \ | |
| --config "p/trailofbits" \ | |
| --config "p/github-actions" \ | |
| --exclude-rule trailofbits.generic.curl-unencrypted-url.curl-unencrypted-url \ | |
| --exclude-rule dockerfile.security.no-sudo-in-dockerfile.no-sudo-in-dockerfile \ | |
| --exclude-rule trailofbits.generic.redis-unencrypted-transport.redis-unencrypted-transport \ | |
| --exclude-rule trailofbits.yaml.docker-compose.port-all-interfaces.port-all-interfaces \ | |
| --exclude-rule yaml.github-actions.security.audit.unsafe-add-mask-workflow-command.unsafe-add-mask-workflow-command \ | |
| --exclude-rule yaml.github-actions.security.curl-eval.curl-eval \ | |
| --exclude-rule yaml.github-actions.security.gha-curl-pipe-shell.gha-curl-pipe-shell \ | |
| --error \ | |
| --strict \ | |
| --json-output "$RUNNER_TEMP/semgrep.json" \ | |
| --metrics=off \ | |
| --verbose \ | |
| .github/ | |
| - name: Report Semgrep results | |
| if: always() && steps.semgrep.outcome != 'skipped' | |
| env: | |
| SEMGREP_OUTCOME: ${{ steps.semgrep.outcome }} | |
| run: | | |
| python3 dotgithub-repo/.github/scripts/report-semgrep-results.py "$RUNNER_TEMP/semgrep.json" | |
| if [ "$SEMGREP_OUTCOME" != "success" ]; then | |
| exit 1 | |
| fi |