Skip to content

kit reports which account a CLI is logged in as, but never asserts it — so a wrong-identity tool reads green and its filtered output reads complete #503

Closed

Description

@sandstream

kit check prints which account a CLI is logged in as. Nothing compares it to which account this repo should use — so a tool answering as the wrong identity reads as green, and its output reads as complete when it is a filtered subset.

Same shape as #500's defect 2: kit measures a fact, records it, and never asserts it.

The asymmetry, in kit's own code

kit check's services table reports identity and stops there (src/output.ts:117-121):

✓ vercel   authenticated   <account>

kit context check asserts other things about the same tool — but only ids from repo-local files (src/context-lock.ts:140-149): vercel.team → orgId, vercel.project → projectId, both read from .vercel/project.json. There is no field for who is logged in.

And the pattern already exists for one tool: [context.gcloud].account is an identity, declared and asserted like git.email. vercel, github (the user, as distinct from github.org) and convex have no equivalent — ContextConfig has github?: { org, remote } and vercel?: { team, project } only.

So the mechanism is built, and identity is the one thing left out of it for every tool except gcloud.

What the gap cost

Measured in a project where the CLI was logged in as a personal account with the Developer role in the team, while the repo's git author is an Owner. Developer cannot read the production environment. The failure was not an error — it was a silent subset:

  • vercel env ls listed four variables and looked complete. Invisible: every Production-only variable. The ones that also existed in Preview/Development showed up, which is what made the list credible.
  • vercel env pull --environment=preview worked; --environment=production failed with "Production Project Environment Variable not found" — which reads as "the variable does not exist", not "you may not see it".
  • vercel env add … production was refused with "Additional permissions are required to create production environment variables" — the only message that named permissions at all, and it came last.

Two contradictory conclusions were drawn in a row about whether the production build deploys the backend. The web UI settled it. Nothing in the tool chain said you are the wrong identity for this repo. After the role was raised, the same command showed the key immediately.

kit check was green throughout, and its identity line was the one place that could have said something.

Proposed

  1. Let [context] declare the expected identity per repo, not only org/project: vercel.user, github.user (distinct from github.org), convex.account. Red on mismatch, exactly as git.email behaves today.
  2. Report the resolved ROLE where the API exposes it, not merely that someone is authenticated. authenticated <account> (Developer) would have ended the investigation before it started.
  3. Point at the per-tool profile mechanism instead of global login, where kit already drives the tool:
    • vercel — global-config-stores, -Q <dir> per profile, or --token
    • gh — built in: gh auth login per account, gh auth switch
    • convex — has no profiles: ~/.convex/config.json is global and is overwritten by convex login; the only isolation is CONVEX_DEPLOY_KEY / CONVEX_DEPLOYMENT per repo
    • gcloud — configurations; aws — AWS_PROFILE; stripe — project profiles
  4. The principle: when a command's output depends on the caller's role, kit must not present it as authoritative. Either the identity is asserted, or the output is labelled possibly-partial.

(4) is the part worth arguing about, because it generalises past identity: vercel env ls under a Developer, a scanner running without a token, a registry query offline — all return a subset that looks like a whole. kit's existing answer for the third case is skip with a reason. Identity deserves the same vocabulary.

Not asked for

A permission model. kit does not need to know what Developer may do — only whether the identity in front of it is the one this repo declared.

Related

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions