Repository navigation
Sign-in: one second factor per member; approval links check the team; narrower log reader role - #328
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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_enrollrefuses setting up either kind (app_setup,app_verify,mfa_setup,mfa_verify_setup) while the record has one, including from a held session.mfa_disableon a self-hosted install needs a session that passed a second factor.plugin_pkgs.rs,plugins/install.rs,users.rs):email_approvechecks that the link's approver is on the team now (not an invite) and that their role holdsplugins.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.infra/cfn/coderhelm-log-reader*.yaml,log_reader.rs,log_repo/live.rs,live/permissions.rs): removedlambda:GetFunction,lambda:GetFunctionConfiguration,lambda:ListFunctions(its answer includes environment variables too) and the duplicateecs:DescribeTaskDefinitionfrom the code-finding statement; addedcloudformation:ListStackResources;cloudformation:DescribeStacksis scoped tostack/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:DescribeTaskDefinitionstays 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.sign_in.rs,api_keys.rs, docs):GET /api/sign-inandGET /api/api-keysmark 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 indocs/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).infranpm test: 74 pass.