Skip to content

[M2.3f1b2] Web: members and roles - #185

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3f1b2-members-bindings
Nov 7, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3f1b2-members-bindings

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

What changed

  • Members page (/orgs/:id/members): list, add an existing account, change a role, remove.
  • Access panel on project and environment pages: effective role and where it comes from, give a role, remove a direct role. Inherited roles offer no removal. On an environment, the panel explains that a role replaces the project role there.
  • ReauthForm: the shared password and code form these commands need. It is reusable and clears credentials. A six-digit value is sent as totp, a 32-hex one as recovery.
  • PagedList: a cursor list that keeps what is shown when extending fails and drops stale answers.

Why

PLAN M2.3f1b2. The membership and binding routes existed (M2.3d4b, M2.3d4c) without screens.

How it was tested

Web tests in access.spec.ts, through the real routes with a stubbed fetch:

  • Add, change role and remove send the expected body and path, and clear the password on success.
  • A malformed code, short password or invalid email sends nothing.
  • A spent code is cleared after a failure, and a refused removal can be retried with a new key after editing.
  • Cancel sends nothing and forgets the typed password.
  • Only direct roles can be removed; the environment routes are used on an environment page.
  • The default role on a new binding is viewer.

Local gate only (CI off). Not exercised in a real browser or against a running API. Integration tests of the underlying routes predate this PR.

Security considerations

No new route. Every command still needs the password and second factor the API already demands; the API remains the authority for permissions, ordered locks and the last-owner rule. Passwords stay in the form only until the request succeeds. MutationRunner keeps retry snapshots in private fields, and the form is destroyed with the component. A self role change rotates credentials through cookies only, which browserRequest reads on each call, so nothing extra is stored.

The UI offers these actions to everyone who can open the page, since the API exposes no effective permissions to it yet. A member without rights gets the API's refusal.

Checklist

  • Tests, including malicious input
  • No new shell invocation, no new secret exposure path
  • Audit events already emitted by the API routes
  • PLAN updated

@samuelmbabhazi
samuelmbabhazi merged commit c43be60 into main Nov 7, 2026
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.3f1b2-members-bindings branch November 7, 2026 11:55
samuelmbabhazi added a commit that referenced this pull request Nov 7, 2026
## What changed

- **Scope picker in the token form.** Until now every token created in
the UI got `profile.read` only, so it could do nothing else. The form
now offers: profile only (default), or an organization, optionally
narrowed to a project and an environment, with permissions ticked one by
one. Nothing is granted until it is ticked, and creating a token with no
permission is refused.
- **Tie to a project.** With a project chosen, a token can be bound to
it.
- **Project token panel** on the project page: tokens tied to the
project, with revocation.
- **Panels hide on refusal.** The access panel (#185) and the new token
panel render nothing when the API answers 403 or 404. Before, a project
viewer saw an error and a form they could not use.
- **Token list** says what each scope reaches.

## Why

PLAN M2.3f1b3, the last part of M2.3f1.

## How it was tested

- `token-scope-picker.spec.ts`: default grant, nothing granted until
ticked, narrowing drops permissions the level no longer offers, binding
only on request and cleared with the project, everything cleared on an
organization change, profile only when organizations cannot load.
- `token-form-store.spec.ts`: the grant and project reach the request,
and an empty grant sends nothing.
- `access.spec.ts`: listing and revoking project tokens, and hiding
panels on 404.

Local gate only (CI off). Not exercised in a real browser or against a
running API, so the API's acceptance of these scope shapes rests on
reading `parseApiScopes`, not on a run.

## Security considerations

- Least privilege by default: no permission is preselected.
- The picker offers only permissions a bearer token can use on a route
today, at a level where they can match: `audit.read` on one project
would grant nothing, so it is not offered. `member.manage` stays out
because those routes are session only.
- **That list is a hand-kept copy of
`docs/generated/route-role-matrix.md`**, and no test ties them together.
A new bearer route needs an entry here. A stale list only hides an
option; it cannot widen access.
- The API still verifies every scope against the owner's live authority
at creation and on each use. The token secret keeps the existing
show-once handling.

## Checklist

- [x] Tests, including refusals
- [x] No new shell invocation, no new secret exposure path
- [x] Audit events already emitted by the API routes
- [x] PLAN updated

Signed-off-by: review <[email protected]>
Co-authored-by: review <[email protected]>
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