Skip to content

Fix project_protection tests (missing auth header → 403) — unblocks CI image build - #203

Open
vsilent wants to merge 1 commit into
devfrom
fix/project-protection-tests
Open

Fix project_protection tests (missing auth header → 403) — unblocks CI image build#203
vsilent wants to merge 1 commit into
devfrom
fix/project-protection-tests

Conversation

@vsilent

@vsilent vsilent commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Problem

The 9 tests/project_protection.rs integration tests fail (all 403 vs 200), including basic POST /project. They send no Authorization header, so every request is anonymous → casbin denies → 403. They never passed.

Because docker.yml gates the image build on cargo test, this froze trydirect/stacker:latest — which is why the audit feature (/api/audit/*) can't be deployed to production (it 404s) and why the agent-gateway PR #202 CI is red.

Fix

Add Authorization: Bearer USER_A_TOKEN before .send() on every request (16 of 17; the IDOR test already had one). The single-user mock returns test_user_id/group_user for any token — matching the create_test_project owner and the existing casbin grants (incl. PATCH /project/:id/protection from 20260727130000_casbin_project_protection_rule). Mirrors the passing IDOR test.

Effect

Compiles clean (cargo test --test project_protection --no-run). Runtime verification is via CI (needs Postgres + the test harness).

🤖 Generated with Claude Code

The 9 project_protection integration tests sent no Authorization header, so
every request was anonymous -> casbin denied -> 403 (even POST /project). They
never passed, which froze the Docker CICD image build (docker.yml gates on
cargo test) and blocked deploying the audit feature to production.

Add `Authorization: Bearer USER_A_TOKEN` before .send() on every request (the
single-user mock returns test_user_id / group_user for any token, matching the
create_test_project owner), mirroring the passing IDOR test. The casbin grant
for PATCH /project/:id/protection already exists
(20260727130000_casbin_project_protection_rule).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants