Skip to content

Harden hosted-alpha auth: gate behind Cloudflare Access + email allowlist #28

@spaceshipmike

Description

@spaceshipmike

Part of #24.

Problem (from pre-tester assessment): src/knowmarks/core/auth.py:182login_user(email) creates a session for any existing user given only an email. No password, no magic-link proof, no one-time code. If a tester's email is known or guessed, anyone can sign in as them at https://alpha.knowmarks.app.

Recommended fix: put the whole alpha URL behind Cloudflare Access with an email allowlist of invited testers. This neutralizes the email-only-login risk entirely — Cloudflare checks identity (magic link/OTP/Google SSO of tester's choice) before requests reach knowmarks.

Implementation scope:

  • Cloudflare dashboard: add Access application on alpha.knowmarks.app with allowlist identity-provider rules (email list or one-time PIN).
  • Verify session cookie behavior still works behind CF Access (CF_Authorization cookie forwards to origin).
  • Document CF Access setup in docs/alpha-deployment.md.
  • Decide extension auth posture under CF Access (see the extension issue) — likely per-user API key with /api/v1/* routes whitelisted past CF Access via service-token header, or separate subdomain without CF Access.
  • Once CF Access is live, the in-app email-only login becomes defense-in-depth; consider still replacing with magic-link as a follow-up before wider invite rollout.

Acceptance:

  • Anonymous browser load of https://alpha.knowmarks.app hits CF Access challenge.
  • Non-allowlisted email can't get past CF.
  • Allowlisted email reaches the knowmarks login page and can redeem an invite.
  • Extension save still works for an authenticated tester (details in extension issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    alphaAlpha release preparation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions