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

Rebase webauthn / passkey PR onto main #2153

Merged
merged 22 commits into from
Nov 5, 2023
Merged

Conversation

Javex
Copy link
Contributor

@Javex Javex commented Oct 28, 2023

This is a rebase of #1618 in which @dave-atx added webauthn support. All credit to them for doing the hard work of adding this feature. Due to the significant changes since this PR on the main branch, there's quite a few things that have moved around, but it's mostly still recognisably the feature dave-atx implemented.

Notable changes I made from that PR:

  • Added untranslated id_ID for webauthn since that language wasn't there back then
  • Moved from duo-labs module to go-webauthn (already discussed in the original PR)
  • Added support for allowCredentials and excludeCredentials. Note that the webauthn spec documents a slight privacy and security risk for allowCredentials, but I don't think miniflux needs to worry about this narrow case.
  • Fixed a few issues that made the Javascript fail in Firefox
  • Remove rp.icon which is deprecated and makes Firefox fail if it's present. The current spec doesn't include it any more.

The original description & instructions from the PR still apply, which I'll repeat here (with edits) to make it easier:

  • Adds a new WEBAUTHN config option to allow WebAuthn to be used instead of a manual password. The config option defaults to true. When enabled, a new "login with passkey" button shows on the login page and an option to register a passkey appears on the settings page.
  • BASE_URL must be set to http://localhost:8080 (or equivalent) or passkeys will fail.
  • The ability to remove individual passkeys is still missing

I would also appreciate if somebody could help with the go.mod and go.sum files. I'm still new to Go and not entirely sure if those files are purely PR changes or if I accidentally updated unrelated modules. The rebase was a bit complex so I may have messed things up in the process.


Do you follow the guidelines?

@Javex
Copy link
Contributor Author

Javex commented Oct 29, 2023

I've now added the option to manage individual passkeys. It's a bit more involved, because passkeys themselves don't really make it easy so you have to add it yourselves, the protocol doesn't supply user friendly names and being able to delete passkeys based on their random binary data didn't seem super helpful. Would gladly take some tips if you think there's a better structure for the data or if I should organise the code differently.

Copy link
Member

@fguillot fguillot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking the time to do this. I was able to test it and that seems to work.

I added few minor comments. Other than that, it would be nice if you can update the man page with the new config option.

I would also appreciate if somebody could help with the go.mod and go.sum files. I'm still new to Go and not entirely sure if those files are purely PR changes or if I accidentally updated unrelated modules. The rebase was a bit complex so I may have messed things up in the process.

It should be fine if you rebase against latest changes in main, and run go mod tidy.

"page.settings.webauthn.passkey_name": "Passkey Name",
"page.settings.webauthn.added_on": "Added On",
"page.settings.webauthn.last_seen_on": "Last Used",
"page.settings.webauthn.register": "Enregistrer le mot de passe",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The french translation is incorrect: mot de passe is the translation for password. clé d'accès might be more appropriate here.

You can leave the text in English and I will translate later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: ceaec0c

I've removed all the French text and left it in English, wasn't sure if you meant just the one.

Note that for all languages, I didn't do any translation: If it looks translated, it's based on the old PR and where I introduced new strings, I didn't translate them, probably best to get native speakers to do that. I can do the German one if you need help there. I took the easy route here so far and just didn't touch it.

@@ -0,0 +1,49 @@
package model // import "miniflux.app/v2/internal/model"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor detail: The license header is missing in the new files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added: fbf9aaa

I followed the example and only added it for .go files, but not .js or .html, hope that was right.

// attestation_type varchar(255) not null,
// aaguid bytea,
// sign_count bigint,
// clone_warning bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments looks unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed: e4e6f29

// handle storage of webauthn credentials
func (s *Storage) AddWebAuthnCredential(userID int64, handle []byte, credential *webauthn.Credential) error {
query := `
insert into webauthn_credentials
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor detail: it would be nice to have the SQL queries follow the existing naming convention: INSERT INTO webauthn_credentials ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9611ac0 - is this what you had in mind? Looks better like this, I think :)

@@ -0,0 +1,135 @@
{{ define "title"}}{{ t "page.settings.title" }}{{ end }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this file should not be there after the rebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! Totally missed that, thanks! 4c0975c

import (
"database/sql/driver"
"encoding/hex"
jsonenc "encoding/json"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the jsonenc should not be necessary here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh don't even know where that came from, I assume you meant the "alias" wasn't needed? See 774a479

dave-atx and others added 22 commits November 5, 2023 18:16
This was missed in the original rebase and accidentally added in its old
path.
Introduce a list of passkeys and options to remove and rename them.
Because the native library data structure does not have space for this
new metadata, this change introduces a wrapping struct to old on to that
data and hence there are quite a few changes to interfaces.

It is also quite tricky to identify passkeys just based on the
information they give you, so inspired by Github, you are now prompted
to create a name for your passkey. Combined with when they were created
and last used that should make management easier. The field is
intentionally optional if users don't want to enter a name. When
registering one they will now be prompted, but can choose to ignore that
or enter an empty name. Registration has already succeeded at that
point.
@Javex
Copy link
Contributor Author

Javex commented Nov 5, 2023

Thank you for taking the time to do this. I was able to test it and that seems to work.

I added few minor comments. Other than that, it would be nice if you can update the man page with the new config option.

I would also appreciate if somebody could help with the go.mod and go.sum files. I'm still new to Go and not entirely sure if those files are purely PR changes or if I accidentally updated unrelated modules. The rebase was a bit complex so I may have messed things up in the process.

It should be fine if you rebase against latest changes in main, and run go mod tidy.

I hope I did that correctly: 6206738

I've addressed the comments, let me know if this is good or if you'd like me to do something else. Thanks for taking a look.

I also get the feeling we might want to squash this before merging, I messed up quite a bit with the rebases so condensing it down / cleaning it up might make for a nicer history (not sure how important that is to you).

@fguillot fguillot merged commit 62ef8ed into miniflux:main Nov 5, 2023
15 checks passed
@Javex Javex deleted the webauthn branch November 5, 2023 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants