fix(ci): narrow Auth.js subject and extend disposable P05 verification
This commit is contained in:
1 parent
42adaba004
commit
c27fe3d323
23 files changed
+415
-45
No files matched your search
@@ -8,6 +8,8 @@ Job responsibilities:
|
||||
2. `login`: pinned pnpm workspace frozen install, proto/client/Login build and upstream unit checks.
|
||||
3. `backend`: install Git before Alpine `checkout`, Docker daemon preflight, disposable local-only P02 ZITADEL Compose, ready/discovery/JWKS smoke and safe cleanup. **Full interactive OIDC login is NOT certified.**
|
||||
|
||||
**P05-CI-02 additions:** Account Portal CI negative route/API smoke, npm/pnpm structured Moderate advisory detail, and disposable Postgres restart persistence plus stronger OIDC issuer/JWKS negative checks. Full authenticated user sign-in/MFA remains deferred; only CI success counts as verified.
|
||||
|
||||
**Run #81 evidence:** backend's first revision failed during checkout because Alpine had no Git. Added a pre-checkout Git installation afterward; the corrected backend job remains **UNVERIFIED** until a separately approved CI rerun. See `docs/P05-CI-01.md`.
|
||||
|
||||
A green job indicates only its executed steps. Full CI acceptance also needs end-to-end OIDC session/callback, real login/MFA, admin console and session controls in a disposable environment, documented separately.
|
||||
|
||||
@@ -32,6 +32,21 @@ jobs:
|
||||
npm run typecheck
|
||||
npm run build
|
||||
echo ZITPLANE_ACCOUNT_BUILD_PASS
|
||||
- name: Negative account API and protected page smoke (no real login)
|
||||
working-directory: users/ui
|
||||
run: |
|
||||
set -eu
|
||||
export AUTH_SECRET="$(node -e "process.stdout.write(require('node:crypto').randomBytes(48).toString('base64url'))")"
|
||||
export AUTH_URL=https://localhost:3001
|
||||
export AUTH_TRUST_HOST=true
|
||||
export ZITADEL_ISSUER=https://zitadel-ci.invalid
|
||||
export ZITADEL_CLIENT_ID=disposable-negative-only
|
||||
export ZITADEL_CLIENT_SECRET=disposable-negative-only
|
||||
npm run start -- -p 3001 > /tmp/zitplane-account-server.log 2>&1 &
|
||||
server_pid=$!
|
||||
trap 'kill "$server_pid" 2>/dev/null || true' EXIT
|
||||
python3 ../../tests/ci/account_negative.py
|
||||
echo ZITPLANE_ACCOUNT_NEGATIVE_ACCESS_PASS
|
||||
|
||||
login:
|
||||
name: Upstream Login V2 frozen workspace build
|
||||
@@ -88,6 +103,10 @@ jobs:
|
||||
set -eu
|
||||
npm audit --omit=dev --audit-level=high
|
||||
echo ZITPLANE_ACCOUNT_ADVISORY_GATE_PASS
|
||||
# Advisory collection is non-mutating; tolerate moderate-only exit 1,
|
||||
# but require valid JSON and preserve the HIGH/CRITICAL gate above.
|
||||
npm audit --omit=dev --json > /tmp/zitplane-npm-audit.json || true
|
||||
python3 ../../tests/ci/advisory_triage.py npm /tmp/zitplane-npm-audit.json
|
||||
- name: Login workspace production dependency advisories (high and critical)
|
||||
working-directory: auth/ui/v2
|
||||
run: |
|
||||
@@ -96,6 +115,8 @@ jobs:
|
||||
corepack prepare pnpm@10.30.3 --activate
|
||||
pnpm audit --prod --audit-level high
|
||||
echo ZITPLANE_LOGIN_ADVISORY_GATE_PASS
|
||||
pnpm audit --prod --json > /tmp/zitplane-pnpm-audit.json || true
|
||||
python3 ../../../tests/ci/advisory_triage.py pnpm /tmp/zitplane-pnpm-audit.json
|
||||
|
||||
backend:
|
||||
name: Disposable ZITADEL Docker and OIDC discovery
|
||||
@@ -124,6 +145,11 @@ jobs:
|
||||
echo '::error::CI local network already exists; refusing to touch another stack'
|
||||
exit 1
|
||||
fi
|
||||
project="zitplane-p05-${GITHUB_RUN_ID:-0}"
|
||||
if docker ps -a --filter "label=com.docker.compose.project=$project" -q | grep -q .; then
|
||||
echo '::error::Disposable CI project already exists; refusing takeover'
|
||||
exit 1
|
||||
fi
|
||||
echo ZITPLANE_DOCKER_PREFLIGHT_PASS
|
||||
- name: Start disposable backend and verify OIDC discovery/JWKS
|
||||
run: |
|
||||
@@ -135,6 +161,20 @@ jobs:
|
||||
touch .p05-ci-started
|
||||
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml up -d --wait
|
||||
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml ps
|
||||
# The disposable Postgres volume must retain independently written data
|
||||
# after a database-container restart; this is NOT a production migration.
|
||||
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml \
|
||||
exec -T postgres psql -U zitadel -d postgres -v ON_ERROR_STOP=1 \
|
||||
-c 'CREATE TABLE IF NOT EXISTS public.zitplane_ci_persist(marker text PRIMARY KEY)'
|
||||
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml \
|
||||
exec -T postgres psql -U zitadel -d postgres -v ON_ERROR_STOP=1 \
|
||||
-c "INSERT INTO public.zitplane_ci_persist(marker) VALUES ('p05-$project') ON CONFLICT DO NOTHING"
|
||||
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml restart postgres
|
||||
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml up -d --wait
|
||||
marker="$(docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml \
|
||||
exec -T postgres psql -U zitadel -d postgres -tAc 'SELECT marker FROM public.zitplane_ci_persist LIMIT 1')"
|
||||
test "$marker" = "p05-$project"
|
||||
echo ZITPLANE_POSTGRES_RESTART_PERSISTENCE_PASS
|
||||
docker run --rm --network zitplane-backend-dev-internal \
|
||||
-e ZITPLANE_CI_PROXY=http://proxy \
|
||||
python:3.12-alpine python -c "$(cat tests/ci/oidc_discovery.py)"
|
||||
@@ -144,9 +184,14 @@ jobs:
|
||||
if: always()
|
||||
run: |
|
||||
set +e
|
||||
cleanup_rc=0
|
||||
if [ -f .p05-ci-started ] && [ -f .env ]; then
|
||||
project="zitplane-p05-${GITHUB_RUN_ID:-0}"
|
||||
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml down -v --remove-orphans
|
||||
docker compose --env-file .env -p "$project" -f deployment/docker/compose.backend.dev.yaml down -v --remove-orphans || cleanup_rc=1
|
||||
fi
|
||||
rm -f .env .p05-ci-started
|
||||
if [ "$cleanup_rc" -ne 0 ]; then
|
||||
echo '::error::Disposable Docker cleanup failed; operator must inspect exact CI-owned resources'
|
||||
exit 1
|
||||
fi
|
||||
echo ZITPLANE_DISPOSABLE_CLEANUP_COMPLETE
|
||||
Reference in new issue
Block a user