Lock down public tryout endpoints — require auth #91
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api#91
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
plan-2026-03-08-tryout-prep→ Phase 11 (discovered scope during 11a)Repo
forgejo_admin/basketball-apiUser Story
As an admin
I want all roster/player endpoints to require authentication
So that parent PII (email, phone) is not exposed to unauthenticated visitors now that tryouts are over and all users have Keycloak accounts
Context
During tryout day, the public roster endpoints were intentionally unauthenticated so parents could check the roster before having accounts. Tryouts are over. All 50 users have Keycloak accounts. There is no longer a reason to serve parent PII without auth.
The public tryout endpoints in
routes/tryouts.pycurrently have NO authentication:GET /api/roster/{tenant_slug}— returns full roster with parent name, email, phonePOST /api/roster/{tenant_slug}/check-in/{player_id}— marks player checked inPOST /api/roster/{tenant_slug}/assign-number/{player_id}— assigns tryout numberThe check-in and assign-number endpoints are also obsolete (tryouts are over) but should still be locked down rather than removed, in case they're needed for future tryouts.
The photo upload endpoint (
POST /upload/photo) is also unauthenticated — should require auth too.File Targets
Files to modify:
src/basketball_api/routes/tryouts.py— Addget_current_userdependency to all endpointssrc/basketball_api/routes/upload.py— Addget_current_userdependency to photo uploadtests/— Update any tests that call these endpoints without auth mockingFiles NOT to touch:
src/basketball_api/routes/players.py— Already requires auth (PR #90)src/basketball_api/routes/teams.py— Already requires authsrc/basketball_api/routes/roster.py— Already requires admin/coach rolesrc/basketball_api/auth.py— Auth middleware already worksAcceptance Criteria
GET /api/roster/{tenant_slug}returns 401 without auth tokenGET /api/roster/{tenant_slug}returns roster data with valid auth token (any role)POST /api/roster/{tenant_slug}/check-in/{player_id}returns 401 without authPOST /api/roster/{tenant_slug}/assign-number/{player_id}returns 401 without authPOST /upload/photoreturns 401 without authTest Expectations
cd ~/basketball-api && python -m pytest tests/ -vConstraints
get_current_userfromauth.py(notrequire_role) — any authenticated user can access theseevent.locals.accessToken— verify the frontend passes the tokenChecklist
Related
project-westside-basketball