Skip to content

[PM-10394] Add new item type ssh key - #4575

Merged
quexten merged 10 commits into
mainfrom
auth/pm-10394/ssh-keys
Nov 5, 2024
Merged

quexten merged 10 commits into
mainfrom
auth/pm-10394/ssh-keys

Conversation

@quexten

@quexten quexten commented Aug 1, 2024 •

Copy link
Copy Markdown
Contributor

🎟️ Tracking

Server: #4575
Add Item Type: bitwarden/clients#10360
Add SSH Agent: bitwarden/clients#10293
Add Import/Export: bitwarden/clients#10529

Jira: https://bitwarden.atlassian.net/browse/PM-10395

📔 Objective

Add server support for the new ssh key cipher type. This is mostly copy paste from the other cipher types, with the one exception that we are filtering out ssh keys for older clients, using SSHKeyCipherMinimumVersion. We will update this once we know which release ssh keys will be in.

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@codecov

codecov Bot commented Aug 1, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 29.16667% with 34 lines in your changes missing coverage. Please review.

Project coverage is 42.53%. Comparing base (50f7fa0) to head (bc50cf3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/Api/Vault/Models/Request/CipherRequestModel.cs 6.25% 15 Missing ⚠️
src/Api/Vault/Models/CipherSSHKeyModel.cs 40.00% 6 Missing ⚠️
...c/Api/Vault/Models/Response/CipherResponseModel.cs 0.00% 6 Missing ⚠️
src/Core/Vault/Models/Data/CipherSSHKeyData.cs 0.00% 4 Missing ⚠️
src/Api/Vault/Controllers/SyncController.cs 75.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4575      +/-   ##
==========================================
- Coverage   42.54%   42.53%   -0.02%     
==========================================
  Files        1389     1391       +2     
  Lines       64745    64792      +47     
  Branches     5943     5945       +2     
==========================================
+ Hits        27548    27561      +13     
- Misses      35975    36008      +33     
- Partials     1222     1223       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@quexten quexten added the hold Hold this PR or item until later; DO NOT MERGE label Aug 1, 2024
@quexten quexten changed the title [PM-10394] Add ssh key item type [PM-10394] Add new item type ssh key Aug 1, 2024
@github-actions

github-actions Bot commented Aug 1, 2024 •

Copy link
Copy Markdown
Contributor

Logo
Checkmarx One – Scan Summary & Details – 8b17816a-e0c3-4c7a-8707-99a10fd7f974

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 119 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 104 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 111 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 60 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 119 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 111 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 104 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 60 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

Fixed Issues

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 105
MEDIUM CSRF /src/Billing/Controllers/RecoveryController.cs: 38
MEDIUM CSRF /src/Billing/Controllers/StripeController.cs: 164
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 237
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 685
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 263
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 361
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 469
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 344
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 839
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 712
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 147
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 154
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 162
MEDIUM Unpinned Actions Full Length Commit SHA /repository-management.yml: 97
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 147
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 97
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 162
LOW Unpinned Actions Full Length Commit SHA /repository-management.yml: 154

@rawkode

rawkode commented Aug 10, 2024

Copy link
Copy Markdown

Very excited by this! Preparing to ditch 1Password as I type 🙂

@quexten quexten mentioned this pull request Aug 13, 2024
16 of 25 tasks
@quexten

quexten commented Aug 16, 2024

Copy link
Copy Markdown
Contributor Author

Setting this to ready for review, but it will not be merged until all ssh of the ssh key features are ready.

@quexten
quexten marked this pull request as ready for review August 16, 2024 12:25
@quexten
quexten requested a review from a team as a code owner August 16, 2024 12:25
@quexten
quexten requested a review from gbubemismith August 16, 2024 12:25
@quexten quexten removed the hold Hold this PR or item until later; DO NOT MERGE label Aug 21, 2024
gbubemismith
gbubemismith previously approved these changes Aug 29, 2024
@github-actions

github-actions Bot commented Nov 4, 2024 •

Copy link
Copy Markdown
Contributor

LaunchDarkly flag references

🔍 2 flags added or modified

Name Key Aliases found Info
ssh agent ssh-agent
SSH Key Vault Item ssh-key-vault-item

@quexten
quexten requested a review from gbubemismith November 4, 2024 19:21
@quexten
quexten merged commit dae493d into main Nov 5, 2024
@quexten
quexten deleted the auth/pm-10394/ssh-keys branch November 5, 2024 19:25
cyprain-okeke pushed a commit that referenced this pull request Nov 12, 2024
* Add ssh key item type

* Add fingerprint

* Limit ssh key ciphers to new clients

* Fix enc string length for 4096 bit rsa keys

* Remove keyAlgorithm from ssh cipher

* Add featureflag and exclude mobile from sync

* Add ssh-agent flag
@spaced0g

Copy link
Copy Markdown

I tested the feature as a potential replacement for 1Password, but I encountered two issues:

  1. I copied the SSH key to my clipboard and clicked the "Import Key from Clipboard" option after creating a new item. However, nothing happened.
  2. Subsequently, I received an "An error occurred" message when syncing to my iOS devices.

Notably, all other devices and browser extensions worked fine, and the server logs showed the following response:

[INFO] (sync) GET /api/sync?<data..> => 200 OK  

To restore syncing functionality, I had to manually delete the key from the Trash.

@quexten

quexten commented Dec 29, 2024

Copy link
Copy Markdown
Contributor Author

@justspacedog Could you please note: Your desktop version, your iOS version, and are you using a self-hosted server (if so which one at what version).

@spaced0g

spaced0g commented Jan 3, 2025

Copy link
Copy Markdown

macOS: 2024.12.1
iOS: Version: 2024.12.0 (1740)
server: selfhosted vaultwarden latest (I know not official) as docker on a synology

@quexten

quexten commented Jan 4, 2025

Copy link
Copy Markdown
Contributor Author

@justspacedog Might be related to this PR in vaultwarden: dani-garcia/vaultwarden#5339

@stabbach-santex

Copy link
Copy Markdown

🚀 🚀 🚀

@cksapp

cksapp commented Jan 30, 2025

Copy link
Copy Markdown

@quexten don't mean to necro-bump this PR, but I wanted to be sure where the reported issue should be considered under the "client" repos, or likely this "server" repo as I would imagine there is something specific which would be required on the SSH Key item type in the server code.


Currently I see that SSH Key item types hold password history like all other vault items, similarly Hidden type custom fields are included in the item's Password history
2025-01-29_11 51 32-1

Though what I would imagine should be considered another "important secret" would be the private key as an integral portion of the SSH key pair. I understand there has been a specific discussion based around removing the option to regenerate the private key for these items exception upon initial creation.

Removed the "regenerate" button, after this came up as a potential confusing point in a meeting. So ssh keys are now only generated when creating a new item.

So while there is little chance of editing over the existing private key, and consistent backups to an external location are highly critical for end user to perform, the Desktop application does currently provide the ability for an SSH Key type to be overwritten on edit using the Import key from clipboard method.
2025-01-29_21 40 33-1

Which is not currently captured in the item's Password history
2025-01-29_21 41 35-1

So I suppose this could be handled in likely one of the following methods,

  1. Either the SSH Key item type can support password history for Private key field, similarly to Login type supports in Password field
  2. Easy workaround can be simply disable Import key from clipboard option in Desktop app on Editing vault item and only allow on initial creation

@mlec1

mlec1 commented Jan 30, 2025

Copy link
Copy Markdown

@cksapp I guess the best place for this kind of feedback would be to post a comment on the community forum https://community.bitwarden.com/latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants