Skip to content

iam: --as an org with no acting identity sends no token - #42

Merged
zeekay merged 2 commits into
mainfrom
fix/as-picks-same-name
Nov 6, 2026
Merged

zeekay merged 2 commits into
mainfrom
fix/as-picks-same-name

Conversation

@zeekay

@zeekay zeekay commented Nov 6, 2026

Copy link
Copy Markdown
Member

hanzo --as hanzo <cmd> sent admin/z's (SuperAdmin) token with X-Org-Id: hanzo whenever org hanzo held several identities and none was active: acting() (src/iam/store.rs) falls back to the active identity, and generated commands take their token from it. Only auth show/token went through within() and refused.

active_token_in now refuses the same way within() does when --as names an org that holds identities but none of them is acting. An org that holds no identity still speaks as the active one (as_an_org_speaks_as_its_identity_without_switching).

  • New test as_an_org_with_no_active_identity_sends_no_token: fails without the change, passes with it.
  • make test: 457 passed, 0 failed (fresh HOME, nothing written).

Generated commands took their token from acting(), which falls back to
the active identity when the org holds several and none is active, so
`hanzo --as hanzo` with admin/z active sent admin/z's token with
X-Org-Id hanzo. Refuse there by name, as within() does; an org that
holds no identity still speaks as the active one.
@zeekay
zeekay merged commit b5cfac7 into main Nov 6, 2026
5 checks passed
@zeekay
zeekay deleted the fix/as-picks-same-name branch November 6, 2026 20:15
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