Skip to content

Backend API authentication — all /api/* endpoints are unauthenticated #33

Closed

Description

@scttfrdmn

Problem

All /api/* routes in cmd/ark-backend/main.go are accessible to any client on localhost with no authentication. Any process running locally can read or modify any user's training data, quiz scores, or profile by supplying an arbitrary user_id.

The auth route block at line 203 is commented out:

// r.Route("/auth", func(r chi.Router) { ... })

Impact

  • Any locally-running app can call PUT /api/users/{user_id}/profile to mark arbitrary users as having completed onboarding
  • Any locally-running app can read training progress for any user
  • In a shared/networked deployment, this allows complete data exfiltration

For the current CLI-first, single-user local deployment model this is low immediate risk. Must be fixed before any multi-user or networked deployment.

Proposed fix

Implement bearer token or session cookie authentication middleware that:

  1. Validates the token on all /api/* routes except /api/version and /health
  2. Verifies the authenticated user matches the user_id in the request (or has admin role)

This extends issue #5 (SSO integration) — the auth mechanism should tie into the institutional identity provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions