Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display error if twofaSecret cannot be retrieved #14372

Conversation

ashmckenzie
Copy link
Contributor

@ashmckenzie ashmckenzie commented Jan 18, 2021

This PR fixes an issue discussed at #14144 where the twofaSecret cannot be retrieved from the session. Here we capture this scenario, display the error message Failed to get secret. and handle it gracefully instead of returning a 500:

Settings - Gitea: Git with a cup of tea 2021-01-18 13-28-58

@lunny lunny added the topic/ui Change the appearance of the Gitea UI label Jan 18, 2021
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jan 18, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 18, 2021
@zeripath
Copy link
Contributor

I'm confused as to why this is happening in the first place - perhaps there's some race?

@6543 6543 added this to the 1.14.0 milestone Jan 18, 2021
@zeripath
Copy link
Contributor

Ah I wonder if this is a double click/double post scenario?

@codecov-io
Copy link

Codecov Report

Merging #14372 (134d1e1) into master (2686e6b) will increase coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14372      +/-   ##
==========================================
+ Coverage   41.84%   41.85%   +0.01%     
==========================================
  Files         744      744              
  Lines       79741    79746       +5     
==========================================
+ Hits        33364    33379      +15     
+ Misses      40863    40858       -5     
+ Partials     5514     5509       -5     
Impacted Files Coverage Δ
routers/user/setting/security_twofa.go 15.10% <0.00%> (-0.57%) ⬇️
services/pull/pull.go 42.15% <0.00%> (-0.50%) ⬇️
routers/api/v1/repo/pull.go 25.45% <0.00%> (+0.60%) ⬆️
modules/process/manager.go 75.00% <0.00%> (+2.50%) ⬆️
modules/queue/manager.go 65.08% <0.00%> (+2.95%) ⬆️
modules/charset/charset.go 73.03% <0.00%> (+4.49%) ⬆️
modules/util/timer.go 85.71% <0.00%> (+42.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2686e6b...134d1e1. Read the comment docs.

@6543 6543 merged commit 6ff63c8 into go-gitea:master Jan 18, 2021
@ashmckenzie
Copy link
Contributor Author

I'm confused as to why this is happening in the first place - perhaps there's some race?

@zeripath As mentioned over at #14144 (comment), I believe it's the Malwarebytes Firefox addon that's removing the value / messing with it so it's not technically a gitea issue, but at least with this PR we nicely guard against the 500.

@ashmckenzie ashmckenzie deleted the ashmckenzie/catch-error-where-2fa-secret-not-available branch January 19, 2021 00:51
a1012112796 added a commit to a1012112796/gitea that referenced this pull request Jan 19, 2021
* master: (27 commits)
  Use path not filepath in routers/editor (go-gitea#14390)
  Display error if twofaSecret cannot be retrieved (go-gitea#14372)
  Check if label template exist first (go-gitea#14384)
  Allow passcode invalid error to appear (go-gitea#14371)
  exclude authored PRs from Review Requested filter (go-gitea#14368)
  Upgrade blevesearch dependency to v2.0.1 (go-gitea#14346)
  Implement ghost comment mitigation (go-gitea#14349)
  Add edit, delete and reaction support to code review comments on issue page (go-gitea#14339)
  Add review requested filter on pull request overview (go-gitea#13701)
  escape branch names in compare url (go-gitea#14364)
  label and milestone webhooks on issue/pull creation (go-gitea#14363)
  Fix middlewares sequences (go-gitea#14354)
  Sort issue search results by revelance (go-gitea#14353)
  KanBan: be able to set default board (go-gitea#14147)
  ...
@go-gitea go-gitea locked and limited conversation to collaborators Mar 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants