2FA for Bitbucket Server supports LFS, however if the repository requires a "secured in browser through 2FA" and the 2FA session length is short enough to expire during the LFS operation this may cause issues. This is reported in - TWOFA-58Getting issue details... STATUS
Potential Workarounds
- Add in a "whitelist' rule of "Path containing" git/info/lfs . This will exclude the LFS operations from participating in the LFS operations.
- For the Repositories that have LFS enabled, don't enable the "Secured in browser through 2FA".
Manual testing steps
Pre-requisites
- Clone dw-lfs-handler branch.
- Open server.soy file inside and add 1 min as an option (<option value="1">1 minute</option>) and save the file.
- Execute atlas-debug -Dmaven.test.skip=true --jvmargs "-Xmx4028m -Xms2048m" --version 5.0.1 --data-version 5.0.1 -u 6.3.0-fef7990 from the terminal.
- After Bitbucket is up and running, open the browser and enter in the license info. if needed.
- When configuring 2FA:
- 2FA Timeout value = 1 min
- Restrict GIT repository activities = Yes
- Select Yes for the rest of the setting as well ().
- Set your up 2fa session and have an active session.
Running the test
- Copy the attached GITLFSTest in two-factor-authentication/testing/src/test/java folder.
- Open the terminal and navigate to two-factor-authentication/testing folder.
- Run mvn -Dtest=GITLFSTest test (make sure you are on an active session. If you are on a fast machine and your test is getting executed before 1min., run the test after 30 seconds are elapsed since you last entered the 2fa token.)