Block outbound calls from ci runners to unallowed endpoints #1502
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: DevContainer | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| permissions: | |
| contents: read | |
| jobs: | |
| devcontainer: | |
| name: DevContainer Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)" | |
| uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: >+ | |
| github.com:443 | |
| registry-1.docker.io:443 | |
| auth.docker.io:443 | |
| production.cloudflare.docker.com:443 | |
| registry.npmjs.org:443 | |
| containers.dev:443 | |
| mcr.microsoft.com:443 | |
| *.data.mcr.microsoft.com:443 | |
| _http._tcp.deb.debian.org:443 | |
| deb.debian.org:443 | |
| deb.debian.org:80 | |
| debian.map.fastlydns.net:443 | |
| debian.map.fastlydns.net:80 | |
| index.rubygems.org:443 | |
| rubygems.org:443 | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Cache Docker layers | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: devcontainer-${{ runner.os }}-${{ github.sha }} | |
| restore-keys: | | |
| devcontainer-${{ runner.os }}- | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 | |
| - name: Build DevContainer image | |
| uses: devcontainers/ci@b63b30de439b47a52267f241112c5b453b673db5 # v0.3.1900000449 | |
| with: | |
| runCmd: | | |
| echo "Installing test dependencies..." | |
| pip install -e .[development,docs,casts] | |
| echo "Running pre-commit checks..." | |
| pre-commit run --all-files | |
| echo "Running unit tests..." | |
| python -m pytest tests | |
| echo "Building documentation..." | |
| make -C doc html | |
| make -C doc/landing-page html |