Skip to content

Fix U2F registration and signing by replacing jQuery requests by fetch #11311

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

Closed
wants to merge 3 commits into from

Conversation

jonasfranz
Copy link
Member

Fix #11228

@6543
Copy link
Member

6543 commented May 6, 2020

@jonasfranz can we refactor this by moving the U2F related code into web_src/js/features/webauth.js

or is ths to mouch for this bugfix?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 6, 2020
@silverwind
Copy link
Member

silverwind commented May 6, 2020

👍 to moving it to a separate file if possible.

If we expect this to work in IE11 we should include a fetch polyfill. Just install via npm and import it on top of web_src/js/polyfills.js.

@jonasfranz
Copy link
Member Author

@6543 I'm currently working on a rewrite to support WebAuthn. Do you think it's worth it to rewrite this now? You can have a look on the new implementation here: https://github.com/go-gitea/gitea/compare/master...jonasfranz:feature/webauthn?expand=1

I saw that @e3b0c442 already started working on webauthn while I'm writing this comment 😂 .

@silverwind
Copy link
Member

silverwind commented May 6, 2020

JS looking good.

I wonder if we can switch the vendored u2f-api to the npm version? Documentation points to it being from this fork, is the fork still necessary?

@e3b0c442
Copy link
Contributor

e3b0c442 commented May 6, 2020

@6543 I'm currently working on a rewrite to support WebAuthn. Do you think it's worth it to rewrite this now? You can have a look on the new implementation here: https://github.com/go-gitea/gitea/compare/master...jonasfranz:feature/webauthn?expand=1

I saw that @e3b0c442 already started working on webauthn while I'm writing this comment .

I have, and I'm hoping to get back to that in about 6 weeks when my classes are over for the summer, that said, if you're in a position to run with it go right ahead, won't hurt my feelings.

@jonasfranz
Copy link
Member Author

@silverwind the npm version is not compatible with the current implementation. I would also love to use the npm version instead. But that might not be worth the effort since it will be replaced by webauthn in some point in time anyway.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 6, 2020
@zeripath zeripath added this to the 1.12.0 milestone May 6, 2020
@silverwind
Copy link
Member

I wonder why package-lock.json hasn't changed. Can you run a npm install --package-lock --package-lock-only and commit the file if it changed?

@jonasfranz
Copy link
Member Author

jonasfranz commented May 10, 2020

@silverwind package-lock.json didn't change since swagger-client has cross-fetch as dependency which depends on the added package. The proposed commands also didn't change the lock file.

@silverwind
Copy link
Member

Right, I see whatwg-fetch in there so everything's fine.

@6543
Copy link
Member

6543 commented May 10, 2020

fix do not work for me :(

@jonasfranz
Copy link
Member Author

jonasfranz commented May 10, 2020

@6543 can you give me more details? Are you getting an error message for example in the browser console?

@6543
Copy link
Member

6543 commented May 10, 2020

@6543 can you give me more details? Are you getting an error message for example in the browser console?

Could not read your security key. Your browser does not support U2F security keys.

System: linux 5.6.8; 76.0 (64-bit)

@6543
Copy link
Member

6543 commented May 10, 2020

same on google chrome (Version 81.0.4044.138 (Official Build) (64-bit))

@zeripath
Copy link
Contributor

@6543 are you running on a localhost? Is it possible that you have to have ssl set-up?

@codecov-io
Copy link

Codecov Report

Merging #11311 into master will increase coverage by 0.00%.
The diff coverage is 33.33%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #11311    +/-   ##
========================================
  Coverage   43.82%   43.82%            
========================================
  Files         607      613     +6     
  Lines       86919    87229   +310     
========================================
+ Hits        38094    38231   +137     
- Misses      44117    44276   +159     
- Partials     4708     4722    +14     
Impacted Files Coverage Δ
models/u2f.go 63.15% <0.00%> (ø)
modules/markup/common/footnote.go 21.22% <0.00%> (ø)
modules/markup/common/linkify.go 34.69% <100.00%> (ø)
modules/notification/indexer/indexer.go 50.00% <0.00%> (-4.67%) ⬇️
services/pull/patch.go 62.93% <0.00%> (-2.80%) ⬇️
services/pull/temp_repo.go 31.62% <0.00%> (-2.57%) ⬇️
models/unit.go 41.97% <0.00%> (-2.47%) ⬇️
modules/queue/unique_queue_disk_channel.go 53.84% <0.00%> (-1.93%) ⬇️
modules/git/repo.go 50.62% <0.00%> (-1.26%) ⬇️
routers/api/v1/repo/pull_review.go 64.55% <0.00%> (-0.71%) ⬇️
... and 25 more

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 505e456...2ac8c73. Read the comment docs.

@6543
Copy link
Member

6543 commented May 11, 2020

@6543 are you running on a localhost? Is it possible that you have to have ssl set-up?

with self signed cert: no change :(

@CirnoT
Copy link
Contributor

CirnoT commented May 11, 2020

@6543 Make sure you type anything in nickname field, empty one is not accepted and returns 409 Conflict.

We should consider catching 409 and displaying friendly message to user, as well as making field required.

@6543
Copy link
Member

6543 commented May 11, 2020

@CirnoT if it would be that easy ... and yes it should be shown to the user that it is required

@CirnoT
Copy link
Contributor

CirnoT commented May 11, 2020

Does it still show Your browser does not support U2F security keys? For me it simply shows Could not read your security key without anything about browser, but I assume that is because I've tested it on Windows 10 1909, so that's expected.

@CirnoT
Copy link
Contributor

CirnoT commented May 11, 2020

Interestingly the code seems to be there to handle 409 -

https://github.com/go-gitea/gitea/pull/11311/files#diff-0fc7c09bb090d93aa9e9ce1e52c5a3a1R112

It doesn't seem to work however, it just shows Your browser does not support U2F security keys.

@6543
Copy link
Member

6543 commented May 11, 2020

ok message is different with ssl now Could not read your security key.

@jonasfranz
Copy link
Member Author

I close this PR since @CirnoT fixed the problem with PR #11379.

@jonasfranz jonasfranz closed this May 13, 2020
@silverwind
Copy link
Member

Should still move the u2f parts to its own file later.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

U2F doesn't work on gitea/gitea:latest docker image
8 participants