Skip to content

feat(auth): add access control to container routes - #19

Closed
mariuspruvot wants to merge 1 commit into
mainfrom
worktree-feat+access-control
Closed

feat(auth): add access control to container routes#19
mariuspruvot wants to merge 1 commit into
mainfrom
worktree-feat+access-control

Conversation

@mariuspruvot

Copy link
Copy Markdown
Owner

Summary

  • All 6 container endpoints were unprotected (no get_current_user dependency). Any unauthenticated request could create sessions, stream output, send messages, and stop containers. This locks them down.
  • Add verify_installation_access (member-level) and verify_session_access (owner-fast path, member-fallback) authorization functions
  • Wire user_id into session creation (was always null despite the FK existing)
  • Extract _get_user_org_logins helper to deduplicate GitHub org membership checks

Test plan

  • All 6 container endpoints return 401 without auth token (6 new tests)
  • Session creation populates user_id in response (new assertion)
  • verify_installation_access: user-owner passes, non-owner 403, org-member passes, org-non-member 403 (4 new tests)
  • verify_session_access: owner passes without API call, org-member passes, non-member 403 (3 new tests)
  • All existing tests pass (241/241, 2 pre-existing flaky webhook tests excluded)
  • ruff lint + format clean

All 6 container endpoints (create, get, stream, events, message, stop)
were unprotected -- any request without authentication could access
sessions. Add get_current_user dependency + installation/session-level
authorization checks.

- Extract _get_user_org_logins helper from get_installations_for_user
- Add verify_installation_access (member-level) for session creation
- Add verify_session_access (owner-fast, member-fallback) for session ops
- Wire user_id into session creation (was always null)
- Add 401 tests for all container endpoints + authorization unit tests
@helprs-local-mariuspruvot

Copy link
Copy Markdown

helPRs session created for this PR.

Skill: challenge-me | Open session

@mariuspruvot

Copy link
Copy Markdown
Owner Author

Cherry-picked to main as 182fa42

@mariuspruvot
mariuspruvot deleted the worktree-feat+access-control branch April 18, 2026 21:53
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.

1 participant