Skip to content

[M8.2a] CLI: login, init, status and secrets - #192

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m8.2a-cli
Nov 7, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m8.2a-cli

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

What changed

The first real CLI commands, replacing the M0.1 skeleton:

  • login and logout: save or forget a control plane address and an API token.
  • init: write a validated shipkeep.yml.
  • status: applications, latest deployment and replicas.
  • secrets list, secrets set NAME, secrets unset NAME.

Commands reach an environment with --org, --project and --env, or SHIPKEEP_ORG, SHIPKEEP_PROJECT and SHIPKEEP_ENV. SHIPKEEP_URL and SHIPKEEP_TOKEN replace the saved login for automation.

Why

PLAN M8.2, split into four in the PLAN. Which commands exist is decided by which routes accept a token today: the project and environment catalogs are session-only, so targets are IDs, not slugs.

Assumption

The login file is plain JSON, mode 0600, under the user's config directory, as gh and docker do by default. An OS keychain would be stronger but needs a platform dependency per OS. This is reversible. A file other users can read is refused, and the message says the token must be considered exposed.

How it was tested

go test -race with a local HTTP server, including malicious input:

  • URLs: plain HTTP off loopback, embedded credentials, paths, file://, localhost.evil.example.
  • A redirect to another host never receives the token.
  • IDs and secret names: path traversal, encoded traversal, injection characters, oversized values.
  • init refuses YAML injection through --name and --image, and keeps an existing file.
  • Terminal escape sequences and bidi overrides in server text and command-line arguments never reach the terminal.
  • The token and secret values appear in no output; --token and --value do not exist.

Not run against the real API yet. That comes with M8.2b.

Security considerations

  • No shell, no process execution.
  • Tokens and secret values never come from flags (shell history, process list): from a no-echo prompt or a pipe. Tokens are secret.String.
  • Redirects are not followed, responses are capped at 4 MiB, requests time out after 30 s, and TLS verification cannot be turned off.
  • New dependency: golang.org/x/term (BSD-3-Clause), allowed by the license policy.

Checklist

  • Tests, including malicious input
  • No new shell invocation, no new secret exposure path
  • No server-side state change beyond existing audited routes
  • PLAN updated

@samuelmbabhazi
samuelmbabhazi merged commit 3c8d140 into main Nov 7, 2026
@samuelmbabhazi
samuelmbabhazi deleted the feat/m8.2a-cli branch November 7, 2026 12:54
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