From 2bf75430f36c66349f281e4a063e20e0b76a7d35 Mon Sep 17 00:00:00 2001 From: iron3oxide Date: Mon, 24 Jun 2024 02:07:08 +0200 Subject: [PATCH 1/7] style: Fix typo: Websocked -> Websocket --- cli/agent/actions/vault.go | 2 +- cli/agent/vault/vault.go | 2 +- cli/cmd/vault.go | 2 +- cli/ipc/messages/vault.go | 2 +- gui/src/gui/settings.blp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cli/agent/actions/vault.go b/cli/agent/actions/vault.go index 58b5c70..a52db59 100644 --- a/cli/agent/actions/vault.go +++ b/cli/agent/actions/vault.go @@ -256,7 +256,7 @@ func handleVaultStatus(request messages.IPCMessage, cfg *config.Config, vault *v vaultStatus.NumberOfLogins = len(vault.GetLogins()) vaultStatus.NumberOfNotes = len(vault.GetNotes()) vaultStatus.LastSynced = vault.GetLastSynced() - vaultStatus.WebsockedConnected = vault.IsWebsocketConnected() + vaultStatus.WebsocketConnected = vault.IsWebsocketConnected() vaultStatus.PinSet = cfg.HasPin() vaultStatus.LoggedIn = cfg.IsLoggedIn() response, err = messages.IPCMessageFromPayload(vaultStatus) diff --git a/cli/agent/vault/vault.go b/cli/agent/vault/vault.go index 7958619..22bc9be 100644 --- a/cli/agent/vault/vault.go +++ b/cli/agent/vault/vault.go @@ -20,7 +20,7 @@ type Vault struct { sshKeyNoteIDs []string envCredentials map[string]string lastSynced int64 - websockedConnected bool + websocketConnected bool mu sync.Mutex } diff --git a/cli/cmd/vault.go b/cli/cmd/vault.go index a14d82c..69481f6 100644 --- a/cli/cmd/vault.go +++ b/cli/cmd/vault.go @@ -114,7 +114,7 @@ var statusCmd = &cobra.Command{ response["loginEntries"] = status.NumberOfLogins response["noteEntries"] = status.NumberOfNotes response["lastSynced"] = time.Unix(status.LastSynced, 0).String() - response["websocketConnected"] = status.WebsockedConnected + response["websocketConnected"] = status.WebsocketConnected response["pinSet"] = status.PinSet response["loggedIn"] = status.LoggedIn responseJSON, _ := json.Marshal(response) diff --git a/cli/ipc/messages/vault.go b/cli/ipc/messages/vault.go index 9873518..ce6ca52 100644 --- a/cli/ipc/messages/vault.go +++ b/cli/ipc/messages/vault.go @@ -27,7 +27,7 @@ type VaultStatusResponse struct { NumberOfLogins int NumberOfNotes int LastSynced int64 - WebsockedConnected bool + WebsocketConnected bool } func init() { diff --git a/gui/src/gui/settings.blp b/gui/src/gui/settings.blp index ba2584a..f9a4328 100644 --- a/gui/src/gui/settings.blp +++ b/gui/src/gui/settings.blp @@ -110,7 +110,7 @@ Adw.ApplicationWindow window { icon-name: "emblem-synchronizing-symbolic"; } Adw.ActionRow websocket_connected_row { - title: "Websocked Connected"; + title: "Websocket Connected"; subtitle: "False"; } Adw.ActionRow logins_row { From b1e632588f9b9508c9a86171e5bc87c04803a982 Mon Sep 17 00:00:00 2001 From: iron3oxide Date: Thu, 27 Jun 2024 22:29:27 +0200 Subject: [PATCH 2/7] style: rename more instances of same typo --- cli/agent/vault/vault.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/agent/vault/vault.go b/cli/agent/vault/vault.go index 22bc9be..0db0f38 100644 --- a/cli/agent/vault/vault.go +++ b/cli/agent/vault/vault.go @@ -32,7 +32,7 @@ func NewVault(keyring *crypto.Keyring) *Vault { sshKeyNoteIDs: make([]string, 0), envCredentials: make(map[string]string), lastSynced: 0, - websockedConnected: false, + websocketConnected: false, } } @@ -424,7 +424,7 @@ func (vault *Vault) GetLastSynced() int64 { func (vault *Vault) SetWebsocketConnected(connected bool) { vault.lockMutex() - vault.websockedConnected = connected + vault.websocketConnected = connected vault.unlockMutex() } @@ -432,5 +432,5 @@ func (vault *Vault) IsWebsocketConnected() bool { vault.lockMutex() defer vault.unlockMutex() - return vault.websockedConnected + return vault.websocketConnected } From f80982a24f029cbdf2c4658fd4f0b2620fc3cb29 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:39:07 +0000 Subject: [PATCH 3/7] Bump golang.org/x/crypto from 0.23.0 to 0.24.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.23.0 to 0.24.0. - [Commits](https://github.com/golang/crypto/compare/v0.23.0...v0.24.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 0925e33..01a5dfb 100644 --- a/go.mod +++ b/go.mod @@ -25,9 +25,9 @@ require ( github.com/tink-crypto/tink-go/v2 v2.2.0 github.com/twpayne/go-pinentry v0.3.0 github.com/vmihailenco/msgpack/v5 v5.4.1 - golang.org/x/crypto v0.23.0 + golang.org/x/crypto v0.24.0 golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f - golang.org/x/sys v0.20.0 + golang.org/x/sys v0.21.0 ) require ( diff --git a/go.sum b/go.sum index 2cf9e1c..8ec69db 100644 --- a/go.sum +++ b/go.sum @@ -106,8 +106,8 @@ github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IU github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= @@ -118,10 +118,10 @@ golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= +golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 977f21c4a9c17f38f75b4a6851f787ec39adb6e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:39:15 +0000 Subject: [PATCH 4/7] Bump github.com/gorilla/websocket from 1.5.1 to 1.5.3 Bumps [github.com/gorilla/websocket](https://github.com/gorilla/websocket) from 1.5.1 to 1.5.3. - [Release notes](https://github.com/gorilla/websocket/releases) - [Commits](https://github.com/gorilla/websocket/compare/v1.5.1...v1.5.3) --- updated-dependencies: - dependency-name: github.com/gorilla/websocket dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0925e33..584d38f 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/gen2brain/beeep v0.0.0-20240112042604-c7bb2cd88fea github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 github.com/google/uuid v1.6.0 - github.com/gorilla/websocket v1.5.1 + github.com/gorilla/websocket v1.5.3 github.com/icza/gox v0.0.0-20230924165045-adcb03233bb5 github.com/keybase/client/go v0.0.0-20240424154521-52f30ea26cb1 github.com/lox/go-touchid v0.0.0-20170712105233-619cc8e578d0 diff --git a/go.sum b/go.sum index 2cf9e1c..ddeef8f 100644 --- a/go.sum +++ b/go.sum @@ -32,8 +32,8 @@ github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/icza/gox v0.0.0-20230924165045-adcb03233bb5 h1:K7KEFpKgVcjj98jOu2Z3xMBTtTwfYVT90Zmo3ZuWmbE= From 7ea364b1c349155123734f2301ed37c5bde910b1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:39:19 +0000 Subject: [PATCH 5/7] Bump github.com/spf13/cobra from 1.8.0 to 1.8.1 Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.8.0 to 1.8.1. - [Release notes](https://github.com/spf13/cobra/releases) - [Commits](https://github.com/spf13/cobra/compare/v1.8.0...v1.8.1) --- updated-dependencies: - dependency-name: github.com/spf13/cobra dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 0925e33..9625079 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/mikesmitty/edkey v0.0.0-20170222072505-3356ea4e686a github.com/mitchellh/go-ps v1.0.0 github.com/rymdport/portal v0.2.3 - github.com/spf13/cobra v1.8.0 + github.com/spf13/cobra v1.8.1 github.com/tailscale/peercred v0.0.0-20240214030740-b535050b2aa4 github.com/tink-crypto/tink-go/v2 v2.2.0 github.com/twpayne/go-pinentry v0.3.0 diff --git a/go.sum b/go.sum index 2cf9e1c..5866c65 100644 --- a/go.sum +++ b/go.sum @@ -15,7 +15,7 @@ github.com/awnumar/memcall v0.2.0/go.mod h1:S911igBPR9CThzd/hYQQmTc9SWNu3ZHIlCGa github.com/awnumar/memguard v0.22.5 h1:PH7sbUVERS5DdXh3+mLo8FDcl1eIeVjJVYMnyuYpvuI= github.com/awnumar/memguard v0.22.5/go.mod h1:+APmZGThMBWjnMlKiSM1X7MVpbIVewen2MTkqWkA/zE= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -86,8 +86,8 @@ github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWR github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/rymdport/portal v0.2.3 h1:5RoAuMy5wNzEzITwK+9YpMQLU5m7F7IYfmPwN/aVpUk= github.com/rymdport/portal v0.2.3/go.mod h1:kFF4jslnJ8pD5uCi17brj/ODlfIidOxlgUDTO5ncnC4= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= From 5d1192113a6f57a936ad666df0c6d45672f09614 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Sat, 20 Jul 2024 00:36:07 +0200 Subject: [PATCH 6/7] Implement cipherkey decryption --- cli/agent/bitwarden/models/models.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/cli/agent/bitwarden/models/models.go b/cli/agent/bitwarden/models/models.go index 80fc114..4e5c75f 100644 --- a/cli/agent/bitwarden/models/models.go +++ b/cli/agent/bitwarden/models/models.go @@ -76,6 +76,8 @@ type Cipher struct { Login *LoginCipher `json:",omitempty"` Notes *crypto.EncString `json:",omitempty"` SecureNote *SecureNoteCipher `json:",omitempty"` + + Key *crypto.EncString `json:",omitempty"` } type CipherType int @@ -147,8 +149,26 @@ type SecureNoteCipher struct { } func (cipher Cipher) GetKeyForCipher(keyring crypto.Keyring) (crypto.SymmetricEncryptionKey, error) { + var key1 crypto.SymmetricEncryptionKey = nil + var err error if cipher.OrganizationID != nil { - return keyring.GetSymmetricKeyForOrganization(cipher.OrganizationID.String()) + key1, err = keyring.GetSymmetricKeyForOrganization(cipher.OrganizationID.String()) + } else { + key1, err = keyring.GetAccountKey(), nil + } + + if err != nil { + return nil, err + } + + if cipher.Key == nil { + return key1, nil + } else { + key, err := crypto.DecryptWith(*cipher.Key, key1) + if err != nil { + return nil, err + } else { + return crypto.MemorySymmetricEncryptionKeyFromBytes(key) + } } - return keyring.GetAccountKey(), nil } From bc133ee2c6e9cb3cb835f35b01fd2be7d7ba70bb Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Sat, 20 Jul 2024 00:36:57 +0200 Subject: [PATCH 7/7] Fix auth url by moving it to identity server --- cli/agent/bitwarden/auth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/agent/bitwarden/auth.go b/cli/agent/bitwarden/auth.go index 2a6e466..0e00d75 100644 --- a/cli/agent/bitwarden/auth.go +++ b/cli/agent/bitwarden/auth.go @@ -116,7 +116,7 @@ func LoginWithApiKey(ctx context.Context, email string, cfg *config.Config, vaul func LoginWithMasterpassword(ctx context.Context, email string, cfg *config.Config, vault *vault.Vault) (LoginResponseToken, crypto.MasterKey, string, error) { var preLogin preLoginResponse - if err := authenticatedHTTPPost(ctx, cfg.ConfigFile.ApiUrl+"/accounts/prelogin", &preLogin, preLoginRequest{ + if err := authenticatedHTTPPost(ctx, cfg.ConfigFile.IdentityUrl+"/accounts/prelogin", &preLogin, preLoginRequest{ Email: email, }); err != nil { notify.Notify("Goldwarden", fmt.Sprintf("Could not pre-login: %v", err), "", 0, func() {})