Repository navigation
feat(auth): implement security hardening and operations #10
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
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| verify: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: piquel_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres -d piquel_test" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 12 | |
| env: | |
| TEST_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/piquel_test | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: '1.97' | |
| components: rustfmt, clippy | |
| - uses: pnpm/action-setup@v6 | |
| with: | |
| version: 11.9.0 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm --filter @piquel/auth-web exec playwright install --with-deps chromium | |
| - run: cargo fmt --all --check | |
| - run: cargo clippy --workspace --all-targets --all-features -- -D warnings | |
| - run: cargo test --workspace | |
| - run: cargo test -p piquel-repository --test identity -- --ignored --test-threads=1 | |
| - run: cargo test -p auth-service --test http_flow -- --ignored --test-threads=1 | |
| - run: cargo test -p auth-service --test rpc_flow -- --ignored --test-threads=1 | |
| - run: pnpm check:web | |
| - run: pnpm test:web | |
| - run: pnpm test:browser | |
| - uses: EmbarkStudios/cargo-deny-action@v2 | |
| with: | |
| command: check advisories | |
| - run: pnpm audit --audit-level=high | |
| - name: Exercise Traefik auth topology | |
| run: | | |
| cleanup() { | |
| docker logs auth-traefik-edge || true | |
| docker rm -f auth-traefik-edge auth-service auth-web || true | |
| docker network rm piquel-auth-edge || true | |
| } | |
| trap cleanup EXIT | |
| docker network create piquel-auth-edge | |
| docker run -d --name auth-service --hostname auth-service \ | |
| --network piquel-auth-edge traefik/whoami:v1.11 --port 8080 | |
| docker run -d --name auth-web --hostname auth-web \ | |
| --network piquel-auth-edge traefik/whoami:v1.11 --port 3000 | |
| docker run -d --name auth-traefik-edge --network piquel-auth-edge \ | |
| -p 127.0.0.1:18443:443 \ | |
| -v "$PWD/infra/traefik:/etc/traefik:ro" \ | |
| traefik:v3.6 --configFile=/etc/traefik/auth-static.yml | |
| sleep 3 | |
| test "$(docker inspect -f '{{.State.Running}}' auth-traefik-edge)" = true | |
| protocol="$(curl --fail --silent --show-error --insecure \ | |
| -H 'Host: auth.piquel.fr' -H 'X-Forwarded-For: 198.51.100.9' \ | |
| https://127.0.0.1:18443/oauth/token)" | |
| printf '%s' "$protocol" | grep --quiet 'Hostname: auth-service' | |
| if printf '%s' "$protocol" | grep --quiet '198.51.100.9'; then exit 1; fi | |
| curl --fail --silent --show-error --insecure -H 'Host: auth.piquel.fr' \ | |
| https://127.0.0.1:18443/.well-known/openid-configuration \ | |
| | grep --quiet 'Hostname: auth-service' | |
| curl --fail --silent --show-error --insecure -H 'Host: auth.piquel.fr' \ | |
| https://127.0.0.1:18443/login/github \ | |
| | grep --quiet 'Hostname: auth-service' | |
| curl --fail --silent --show-error --insecure -H 'Host: auth.piquel.fr' \ | |
| https://127.0.0.1:18443/login \ | |
| | grep --quiet 'Hostname: auth-web' | |
| curl --fail --silent --show-error --insecure -H 'Host: auth.piquel.fr' \ | |
| https://127.0.0.1:18443/_app/test.js \ | |
| | grep --quiet 'Hostname: auth-web' |