Skip to content

Security: implement or confirm service-to-service auth (X-API-Key) for Rails-called routes #67

Description

@franciszver

Split out from the broken-access-control remediation (#59, PR #66).

_docs/active/API_CONTRACTS.md documents X-API-Key service-to-service auth for POST /practice/assign, /practice/assign/async, /nudges/check, and /overrides/, and shows the Rails backend calling them with that header. No code has ever read or validated X-API-Keysettings.ai_service_api_key (src/config/settings.py) is declared and unused. Those routes were therefore effectively unauthenticated, which is the vulnerability PR #66 closes.

Consequence of #66: any server-to-server caller relying on unauthenticated access to those routes will now receive 401.

Decide one of:

  1. Confirm the Rails caller sends a real (tutor/admin) JWT; update API_CONTRACTS.md to drop the X-API-Key story.
  2. Implement the documented X-API-Key path as a scoped service identity that resolves to a specific authorized actor. A blanket key that bypasses ownership would re-open the exact BOLA fix(sec): remediate broken access control (BOLA/IDOR) across API + parent model (#59) #66 closed, so it must NOT skip assert_can_access_student.

Blocks any production reliance on those routes from Rails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions