Repository navigation
Remember MFA verification for users who choose "Keep me signed in" - #13
Open
tombokombo wants to merge 1 commit into
Open
tombokombo wants to merge 1 commit into
tombokombo wants to merge 1 commit into
Conversation
|
Missing required label for changelog. Requires at least 1 of: bug, chore, dependencies, documentation, enhancement, feature, internal, localization, major-bug, regression-fix, security, skip-changelog. Found: . You can add the required label by adding a comment with the following text: |
Author
|
/label feature |
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.
Adds a "remember MFA" capability so users who check Jenkins' Keep me signed
in at login are not challenged for a TOTP code on every new HTTP session.
What changed:
remember-me cookie receive a long-lived
openmfa-remembercookie(stateless, HMAC-SHA256-signed). While it is valid,
MFAFiltermarks thenew session as verified instead of redirecting to the MFA challenge.
user's current TOTP secret — re-enrolling or disabling MFA invalidates all
previously issued cookies. Logout clears the cookie.
Remember MFA for "Keep me signed in" (hours)(default 24,
0disables) and an optionalrememberMfaKeysigning key.The key is auto-generated and persisted on first use; it can be provided
explicitly via JCasC (any secret source) so cookies survive restarts on
ephemeral-
JENKINS_HOMEdeployments (e.g. jenkins-operator).exemptUsers/exemptRolesare now list-valued, matching the shapethe README already documented (the string-only binding used to fail with
ConfiguratorExceptionon the documented example). The UI textarea stilledits one entry per line.
bom-2.568.x:7093.v37de7b_4a_8a_4f)Upgrade note: previously persisted string-form exemptions in an existing
JENKINS_HOMEare dropped on upgrade (field type change) — re-save theglobal configuration once, or let JCasC re-apply it. Per-user data
(
MFAUserProperty) is unchanged, so existing enrollments are unaffected.Testing done
mvn verify, SpotBugs clean, 0 findings).New coverage added in this PR:
RememberMFAServiceTest(9 tests): token validation — expiry, tamperedsignature, tampered expiry, wrong user, changed TOTP secret, malformed
values, separator characters in usernames, enable/disable via
configured hours.
RememberMFAWebTest(8 tests, JenkinsRule + HtmlUnit): cookie issuedonly when remember-me is used, filter accepts a valid cookie in a fresh
session, rejects tampered/absent cookies, feature disabled via
0hours, logout clears the cookie.
MFAGlobalConfigurationCasCTest: binds the documented JCasC yaml(list-valued exemptions,
rememberMfaHours,rememberMfaKey).MFAGlobalConfigurationTest: list persistence, UI text form, defaulthours.
mvn hpi:run, Jenkins 2.568.3): full curl-driven E2E —login with
remember_me, TOTP verify issues the cookie (HttpOnly, correctexpiry), fresh session with the cookie skips MFA, control session without
it is challenged, tampered signature/expiry rejected, logout clears the
cookie, and the cookie stays valid across a full Jenkins restart with the
persisted signing key.
supplied from Vault via JCasC): verified the signing key is stable across
pod restarts (same key hash before/after) and that a valid cookie skips
the MFA challenge after
kubectl delete pod.Submitter checklist