Needs work
Project:
Two-factor Authentication (TFA)
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Jul 2021 at 18:47 UTC
Updated:
16 Jul 2025 at 09:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
simeonkesmev commentedFix the order conditions, so the warning is presented when necessary.
Comment #4
simeonkesmev commentedHere is a fixed patch.
Comment #5
simeonkesmev commentedAvoid forcing for the user/logout.
Comment #6
jcnventuraComment #7
simeonkesmev commentedAdded exclusion for password and user edit page, so that after one-time login the user is able to change the password even if all TFA skips are used.
Comment #8
askibinski commentedHopefully fixed the patch not applying + interdiff of Simeon's changes in #7.
Comment #9
askibinski commentedOn second thought, it doesn't make sense to bypass the one-time-login.
Related: #2930355: Password reset bypasses TFA
Comment #10
jcnventuraMoving all open issues to the 2.x branch.
Comment #11
maico de jongRerolled the latest patch against 2.x-dev:
Maybe it's a good idea to move extra functionalities like configurable whitelist or remaining skips integration (needs new messages) to new tickets and focus on the basics first.
Comment #12
maico de jongComment #14
maico de jongFixed patch
Comment #15
maico de jongComment #16
maico de jongExcluded user edit routes for password reset support
Comment #17
Madhu Kumar M E commentedTrying to applying latest patch not applying. Added screenshot for reference.
Comment #18
maico de jong@Madhu Kumar M E
Patch should work, tests also passed. Please make sure you are applying the patch correctly: through composer-patches or manually at the tfa module root using the 2.x-dev branch. Looking at your screenshot the patch was not applied to the tfa module directory.
Comment #19
Madhu Kumar M E commented@Maico de Jong
I made a mistake, i didn't checked my directory properly.
Verified the patch #16 and tested it on Drupal version 10.1.x. The patch works fine also and I have added the screenshots for reference.
Thanks for reminding me.
Comment #20
Madhu Kumar M E commentedComment #21
malks commentedI was just testing this and noticed that when "Force TFA setup" is selected the text box for "Skip Validation" is hidden. Is this as designed?
Comment #22
cmlaraThis can be VERY heavy latency. While the built in plugins can get this with just a few database queries, on a test(non performance tuend) laptop redirect() this ends up being ~10% of the request time (22ms) for the front page to load.
With other authentication plugins isReady() could trigger a network query which will add even more latency and network dependency, see https://git.drupalcode.org/project/tfa_vault_totp/-/blob/0.x/src/Plugin/... for an example.
I've been experimenting with using the request_session and parameter bags, perhaps similar may be a good fit here?.
I'm debating if we should we include system.403 and system.404 and system.4xx in here as well? I hit #3339277: Inform admin that role does not have permission to setup own tfa and ended up in an endless redirect loop. Ideally this shouldn't ever happen when redirecting to the TFA setup page, and fixing that issue would solve this concern here, however I can't help wondering if there might be other hidden problems and that exempting these paths might be wise.
#3108099: Redirect to validation setup after login without tfa would appear to be a related request.
Comment #23
yeniatencio commentedRerolling #16 as patch is not applying clean anymore.
Comment #24
yeniatencio commentedMissed the EventSubscriber and functional test on #23.
Adding patch again.
Comment #25
yeniatencio commentedAdded patch for version 8.x-1.x
Comment #26
yeniatencio commentedRe-rolling #25 as failing to applied on 8.x-1.2
Comment #27
yeniatencio commentedRe-rolling patch for version 8.x-1.x
Comment #28
yeniatencio commentedMissed the service and the unit test on last patch. Re-rolling patch for version 8.x-1.x
Comment #29
cmlaraFollowing up on my comments from #22
In #3339277: Inform admin that role does not have permission to setup own tfa we did not actually prevent an access denied error as the action to require TFA is different from being permitted to setup TFA, as such at the system.403 should be exempted (at least for the TFA setup page) to prevent a loop.
Comment #30
yovinceThe patch prevents generating CSS and JS aggregation in Drupal 10.1.x. fixed by excluding the CSS and JS asset routes from the list.
Comment #31
itsbakiya commented@yovince I used your patch its fine working Drupal 10.1.x
Comment #32
dpiLinking a dupe #2962542: Implement a configurable setting that allows site admins to force users to setup TFA
Comment #33
neslee canil pintoRerolled patch for latest 2.x verison
Comment #34
narendragupta commentedPatch is not getting applied for 8.x-1.5 tfa module version along with 10.2.2 drupal version.
Comment #35
narendragupta commentedRerolled patch for latest 8.x-1.x verison, working fine with Drupal 10.2.2
Comment #36
alexgreyhead commentedHello all,
Apologies Narendra :) I've spotted four issues with the patch in #35:
- Hunk in tfa.schema.yml doesn't apply because indentation of two subsequent lines is missing a space
- Indentation is 4 spaces instead of two
- Hiding the Allowed Validation plugins field when "force redirection" is enabled seems like a bad idea to me; when hidden, the administrator can't change which validation plugins are selected, and because this field is below the "force" checkbox, users working from top to bottom down the form might never see the allowed validation plugins field.
- A typo; "FTA"
Attaching a patch which:
- Fixes broken indentation - bad:
Good (i.e. the last two lines):
- Fixes indents - bad:
Good:
- Removes the behaviour to hide allowed validation plugins - i.e. this chunk:
- Fixes the typo "FTA":
... to:
Comment #37
alexgreyhead commentedFound another incorrect indent - updated patch attached.
Comment #38
alexgreyhead commentedPlaying whack-a-mole with indentation... [facepalm.gif]
Comment #39
cmlaraGenerally development should occur on the latest branch first (2.x) and be backported to older branches once complete. This helps prevent a feature or bugfix being lost in newer versions. Addtionaly it reduces overall effort of maintaining multiple branches at once.
Leaving issue as needs-work per #22 and #29 comments.
Note: As part of the DrupalCi deprecation process the TFA project has already been migrated to only use GitLabCI for testing of the D8+ development branches. Due to this change we need contributors to utilize the MR workflow going forward as patches are no longer testable in the TFA project.
Contributors will likely encounter this with other projects as the patch workflow as DrupalCi has already been significantly limited as of Febuary 2024 and will be fully disabled for all D.O. hosted projects on July 1st. See https://www.drupal.org/about/core/blog/drupalci-and-all-patch-testing-wi... for more information.
Comment #40
alexgreyhead commentedHi @cmlara, apologies - I provided the patch in #38 in good faith to fix the broken patch in #35. I'm not working with the 2.x branch due to SA-CONTRIB-2024-003, so wasn't able to provide a patch against that branch.
Hopefully the patch at #38 will help those still on 8.x-1.x ¯\_(ツ)_/¯
/A
Comment #41
marcellinostroosnijder commentedHi all!
I tried to update the patch from #30 the the new rerolled patch added in #38. I noticed a major difference (2 lines hehe), and thats in the $ignored_routes array. As both css and JS are not ignored, your assest will not be loaded in. Basicly #30 comment got reversed. Please reroll the patch of #38, but with the systems routes added in :)
Comment #42
alexgreyhead commentedHi MarcellinoStroosnijder,
> Please reroll the patch of #38, but with the systems routes added in :)
I'm away from that project now so won't be able to do this, but feel free to do the re-roll yourself :)
/Alex
Comment #45
jkdev commentedDear friends,
I have created a merge request 89 (MR) incorporating the various patches. You can review the MR and apply it as a patch. It is based on the 2.x branch.
This is the initial commit, so I would appreciate your feedback on whether it makes sense and if everything looks correct.
Please let us know if any parts are missing or if there are additional tasks that need to be addressed.
Thank you.
Comment #46
cmlaraProvided feedback in the MR. Leaving as NW for concerns.
Comment #47
jkdev commentedCan you please read through the logic, let me know if I missed something: