Repository navigation
Hosted two-factor sign-in: per-team rule, one factor per person on every way in - #332
Merged
Merged
Conversation
…ery way in Team admins on hosted can require two-factor sign-in for their team. The rule is read fresh on every request in that team and fails closed. Hosted Google, GitHub and password sign-ins ask for the person's one second factor whether or not a team requires it. The admin must have a factor before turning the rule on, members without one are emailed, and a reset is logged, ends the person's sessions on every team, emails them, and stays within teams the admin manages.
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
Two-factor sign-in on hosted CoderHelm (app.coderhelm.com), working the way it already does on a self-hosted install:
two_factor_required, through the existing mail path and recorded in Deliveries). Turning it on or off is logged.two_factor_reset);Dashboard and docs: CoderHelm/coderhelm#243
Changes
routes/sign_in.rsRuleandteam_rule: the organization's rule on self-host,pk = <team>,sk = SETTINGS#SIGN_INon hosted.hosted_home_key,home_keyandfactor_home: where a person's factor is kept. On self-host that is still the member record, so nothing moves there.check_sessionnow takes the acting team.my_status, the app setup, verify and disable routes,check_enroll,needed_for,verify_second_step,reset_two_factor,note_factorand the key reviews.person_records,must_keepandend_person_sessionscover a person across teams. A factor stays on while any of their teams requires it, and turning it off ends their other sessions on every team.get_settingsandupdate_settingswork on both deployments. Hosted refuses domains and returnswithout_2faandnotified.notify_required,notify_reset,may_reset_onandteams_beyond_reachare new.middleware/auth.rs: the two-factor check runs on every deployment, for the team the session acts in, still after the member-record check and before the role check.routes/auth.rs:second_step/password_stepbefore making a session;create_session_tokenreplacescreate_token);routes/users.rs: Cognito MFA setup, verify and disable use the one-factor checks on hosted too. Turning it off takes a session that passed it and is refused while a team of theirs requires it.routes/api_keys.rs: key reviews for every deployment.permissions.rs: thesign_incapability's label now describes hosted. Admins only, never in a custom role, as before.common/src/mail: thetwo_factor_requiredandtwo_factor_resettemplates, both essential.self-host/sign-in.mdandself-host/email.mdcover the two new emails.Verification
cargo fmt --checkandcargo clippy --workspace --all-targets -D warnings: clean.cargo test --workspaceafter rebasing on main (Runs that stop to ask: keep the questions, answer from CoderHelm, never ask twice #330): 2443 passed, 16 ignored. New and changed sign-in tests: