Skip to content

fix: KEEP-1049 compare CLI version against server floor, stop showing API keys as identities - #84

Merged
suisuss merged 2 commits into
mainfrom
feat/KEEP-1049-cli-version-staleness-check
Aug 2, 2026
Merged

fix: KEEP-1049 compare CLI version against server floor, stop showing API keys as identities#84
suisuss merged 2 commits into
mainfrom
feat/KEEP-1049-cli-version-staleness-check

Conversation

@suisuss

@suisuss suisuss commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes out the remaining scope from KEEP-1049 after #75 fixed the two
headline bugs (kh doctor false-positive auth, kh auth status accepting any
kh_... string). Two things were still open:

1. kh doctor's CLI Version check never compared anything.

The server has advertised a floor via KH-Minimum-CLI-Version since KEEP-1047
(keeperhub#1839), and internal/http/version.go already warned on it for
every request made through the retryable client - but checkCLIVersion
(cmd/doctor/doctor.go) only ever printed the local version string and
unconditionally passed. It now probes /api/health (the same endpoint
checkAPI already hits), reads the header, and reuses the already-exported
khhttp.SemverLessThan to warn with the same remedy text:

warning: your CLI version (0.3.0) is outdated; minimum required is 0.11.1. Run: kh update

2. kh auth status / kh auth login showed the API-key prefix as an identity.

fetchAPIKeyInfo has no real identity for an API key, so it sets Email to a
truncated prefix (kh_EU7Fc1Xi...). Both commands printed that under
"User" / "logged in as", which reads as though the key were the account:

User    kh_EU7Fc1Xi...

Now labeled/worded as a credential for API-key auth; session auth is
unchanged.

Test plan

  • go build ./..., go vet ./..., go test -race ./... (full suite)
  • go generate ./docs/ produces no diff
  • New tests: cmd/doctor/doctor_version_test.go (no header / below floor /
    at floor / dev build), cmd/auth/status_test.go and
    cmd/auth/login_apikey_test.go (API-key vs session wording)

Companion doc fix in keeperhub, documenting the KH_MINIMUM_CLI_VERSION
override this relies on: KeeperHub/keeperhub#1861

suisuss added 2 commits July 31, 2026 09:59
kh doctor's CLI Version check only ever printed the local version and
unconditionally passed - the server now advertises a floor via
KH-Minimum-CLI-Version (KEEP-1047), but nothing compared against it.
checkCLIVersion probes /api/health for the header and reuses
khhttp.SemverLessThan to warn, naming the remedy, when the local build
is behind.
fetchAPIKeyInfo has no real identity for an API key, so it sets Email
to a truncated key prefix (kh_EU7Fc1Xi...). kh auth status and kh auth
login printed that prefix under "User" / "logged in as", which reads
as though the key were the account. Both now name it as a credential
for API-key auth while leaving session auth unchanged.
@suisuss
suisuss merged commit 70c1a13 into main Aug 2, 2026
4 checks passed
@suisuss
suisuss deleted the feat/KEEP-1049-cli-version-staleness-check branch August 2, 2026 22:30
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