Skip to content

Add Authentication #7

Description

@FireSquid6

Authentication for fleet should happen in several places:

Both the ship and the bridge should check Authorization: headers.

Outside to Bridge

All communications to the bridge should include a bearer token that identifies itself as a session to a specific user. Store users and sessions in a managed bun:sqlite database (abstract this into a Database class that manages and validates).

Users should either have the role member or admin. Admins can create other users, members cannot.

Additionally, store a version table in the database with one column version with one row storing it as 1 for now. We will use this later if the database needs to be updated.

Note down for future agents that the database should only be for authentication related items and the store should handle everything else.

When testing, you should use an ephemeral memory database.

To prevent lockout, if a fleet bridge is being launched and a user is not detected, it should through stdin ask for a username and password to setup the first user as.

Ship to Bridge

Each ship should have its own FLEET_SHIP_TOKEN that's shared by the bridge and ship. The bridge will always provide the FLEET_SHIP_TOKEN when sending messages to the ship, and the ship will always provide it to the bridge when sending messages to it.

All tokens should be able to be configured with fleet launch

Important: scope it as narrowly as possible for SHIP -> BRIDGE calls. We don't want one compromised ship to compromise the whole bridge.

Web Client

The web client should support signing in and storing the session token.

Client CLI

The CLI should also store the session in ~/.local/state/fleet-client-cli/{url-of-bridge}/... If it doesn't exist, then the cli should prompt in stdin for the username and password to authenticate with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions