Skip to content

Sign-in: one second factor per member; approval links check the team; narrower log reader role - #328

Merged
nambok merged 2 commits into
mainfrom
fix/second-factor-and-approvals
Oct 27, 2026
Merged

nambok merged 2 commits into
mainfrom
fix/second-factor-and-approvals

Conversation

@nambok

@nambok nambok commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Four sign-in and access fixes: each member has one second factor, asked for on every sign-in path; plugin approval email links check the team at approval time; the log reader role no longer reads function configuration, function code links or stack parameters; with two-factor sign-in required, API keys made before the rule are marked for review.

Changes

  • One second factor per member (sign_in.rs, auth.rs, users.rs): Google, GitHub and password sign-ins all reach the same member record, so the step after each reads the member's factor (enrolled_factor: the app factor, or Cognito TOTP read live; a failed read refuses). App factor: the code screen after Google, GitHub and a password alike (password sign-in answers {"status":"second_step"} with the second-step cookie). Password account's factor: Google or GitHub redirects to ?error=two_factor_use_password. check_enroll refuses setting up either kind (app_setup, app_verify, mfa_setup, mfa_verify_setup) while the record has one, including from a held session. mfa_disable on a self-hosted install needs a session that passed a second factor.
  • Plugin approval links (plugin_pkgs.rs, plugins/install.rs, users.rs): email_approve checks that the link's approver is on the team now (not an invite) and that their role holds plugins.approve, before approving or rejecting. Removing a member takes their email off every plugin's approver list (install::drop_approver, audited); the number of approvals a draft needs is unchanged.
  • Log reader role (infra/cfn/coderhelm-log-reader*.yaml, log_reader.rs, log_repo/live.rs, live/permissions.rs): removed lambda:GetFunction, lambda:GetFunctionConfiguration, lambda:ListFunctions (its answer includes environment variables too) and the duplicate ecs:DescribeTaskDefinition from the code-finding statement; added cloudformation:ListStackResources; cloudformation:DescribeStacks is scoped to stack/CoderHelmLogReaderUpdate-*/* (the update-stack status check). The resolver reads function tags (lambda:ListTags), finds functions with their own log group through the log group's stack resource list, and keeps stack names only. The permission probe and the policy simulator follow. ecs:DescribeTaskDefinition stays in the ECS statement for the log-fix evidence step (start command, storage, cpu, memory); the comments now say its answer includes container environment variables and what CoderHelm keeps. The update stack only adds permissions; its description says so.
  • API keys and the two-factor rule (sign_in.rs, api_keys.rs, docs): GET /api/sign-in and GET /api/api-keys mark each live key made before the rule was turned on, with whether its maker is still on the team and has a second factor now. Documented in docs/self-host/sign-in.md, with the one-factor rule.

Verification

  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, cargo test --workspace (new tests: the step needed for each path and factor, setup refusals, made_before_rule, email approver membership, approver removal, templates without function configuration or stack parameters, DescribeStacks resource scope, resolver function names and ARNs).
  • infra npm test: 74 pass.
  • The dashboard PR covers the screens.

… narrower log reader role

- Every sign-in path (Google, GitHub, password) asks for the member's one
  second factor: the authenticator-app code after a password too, and a
  member whose factor is the password account's code is sent to the
  password sign-in after Google or GitHub. Neither kind can be set up while
  the record has one; turning the password account's code off needs a
  session that passed it.
- Plugin approval email links check, at approval time, that the approver is
  still on the team and their role holds plugins.approve. Removing a member
  takes them off every plugin's approver list.
- The log reader role drops lambda:GetFunction, GetFunctionConfiguration
  and ListFunctions (function tags instead), uses ListStackResources for
  the stack lookup, and scopes DescribeStacks to CoderHelm's own update
  stacks. Comments state what the ECS task definition read returns.
- With two-factor sign-in required, Settings, Sign-in and the API keys page
  mark live keys made before the rule, with whether their maker has a
  second factor now.
@nambok
nambok merged commit 7158e5e into main Oct 27, 2026
8 checks passed
@nambok
nambok deleted the fix/second-factor-and-approvals branch October 27, 2026 13:58
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