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

PM-10393 SSH keys #10825

Merged
merged 15 commits into from
Nov 8, 2024
Merged

PM-10393 SSH keys #10825

merged 15 commits into from
Nov 8, 2024

Conversation

quexten
Copy link
Contributor

@quexten quexten commented Aug 30, 2024

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-10393

QA ticket:
https://bitwarden.atlassian.net/browse/PM-12729

(Server PR):
bitwarden/server#4575

📔 Objective

This PR merges the feature branch for SSH keys to main.
All individual commits (aside from rebases) have been previously reviewed and approved in their PR's; but they have not been QA tested. This PR will be QA tested

Creation of SSH keys is gated behind a feature flag; use of them is not.

Included are:

SSH key item type:

Import export:

SSH Agent:

Note

Ssh key generation UI support will come in a follow-up PR tracked here: #11232

📸 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

* Implement ssh-key cipher type

* Fix linting

* Fix edit and view components for ssh-keys on desktop

* Fix tests

* Remove ssh key type references

* Remove add ssh key option

* Fix typo

* Add tests
* Add ssh key import export for bitwarden json

* Remove key type from ssh key export
@quexten quexten changed the title [] SSH keys PM-10393 SSH keys Aug 30, 2024
Copy link
Contributor

github-actions bot commented Aug 30, 2024

Logo
Checkmarx One – Scan Summary & Details8b78c654-7621-4e82-b366-fbf7221eb224

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 484 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 457 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/platform/components/approve-ssh-request.html: 6 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/vault/individual-vault/view.component.ts: 101 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/vault/individual-vault/view.component.ts: 101 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/vault/individual-vault/view.component.ts: 101 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/vault/individual-vault/view.component.ts: 101 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/vault/individual-vault/view.component.ts: 76 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/vault/individual-vault/view.component.ts: 76 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/vault/individual-vault/view.component.ts: 76 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/vault/individual-vault/view.component.ts: 76 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/access-intelligence/password-health-members.component.html: 105 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/access-intelligence/password-health-members.component.html: 105 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/access-intelligence/password-health-members.component.html: 110 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/access-intelligence/password-health-members.component.html: 100 Attack Vector
MEDIUM Unpinned Actions Full Length Commit SHA /version-bump.yml: 514 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 /build-desktop.yml: 1338 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 /publish-cli.yml: 103 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 /release-web.yml: 40 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 /release-desktop-beta.yml: 667

More results are available on AST platform

quexten and others added 3 commits September 26, 2024 19:22
…and view co… (#11046)

* Add privatekey publickey and fingerprint to both add-edit and view components

* Remove wrong a11y title

* Fix testid
* Add ssh agent, generator & import

* Move ssh agent code to bitwarden-russh crate

* Remove generator component

* Cleanup

* Cleanup

* Remove left over sshGenerator reference

* Cleanup

* Add documentation to sshkeyimportstatus

* Fix outdated variable name

* Update apps/desktop/src/platform/preload.ts

Co-authored-by: Andreas Coroiu <[email protected]>

* Rename renderersshagent

* Rename MainSshAgentService

* Improve clarity of 'id' variables being used

* Improve clarity of 'id' variables being used

* Update apps/desktop/src/vault/app/vault/add-edit.component.html

Co-authored-by: Andreas Coroiu <[email protected]>

* Fix outdated cipher/messageid names

* Rename SSH to Ssh

* Make agent syncing more reactive

* Move constants to top of class

* Make sshkey cipher filtering clearer

* Add stricter equality check on ssh key unlock

* Fix build and messages

* Fix incorrect featureflag name

* Replace anonymous async function with switchmap pipe

* Fix build

* Update apps/desktop/desktop_native/napi/src/lib.rs

Co-authored-by: Andreas Coroiu <[email protected]>

* Revert incorrectly renamed 'Ssh' usages to SSH

* Run cargo fmt

* Clean up ssh agent sock path logic

* Cleanup and split to platform specific files

* Small cleanup

* Pull out generator and importer into core

* Rename renderersshagentservice to sshagentservice

* Rename cipheruuid to cipher_id

* Drop ssh dependencies from napi crate

* Clean up windows build

* Small cleanup

* Small cleanup

* Cleanup

* Add rxjs pipeline for agent services

* [PM-12555] Pkcs8 sshkey import & general ssh key import tests (#11048)

* Add pkcs8 import and tests

* Add key type unsupported error

* Remove unsupported formats

* Remove code for unsupported formats

* Fix encrypted pkcs8 import

* Add ed25519 pkcs8 unencrypted test file

* SSH agent rxjs tweaks (#11148)

* feat: rewrite sshagent.signrequest as purely observable

* feat: fail the request when unlock times out

* chore: clean up, add some clarifying comments

* chore: remove unused dependency

* fix: result `undefined` crashing in NAPI -> Rust

* Allow concurrent SSH requests in rust

* Remove unwraps

* Cleanup and add init service init call

* Fix windows

* Fix timeout behavior on locked vault

---------

Co-authored-by: Andreas Coroiu <[email protected]>
Copy link

codecov bot commented Sep 27, 2024

Codecov Report

Attention: Patch coverage is 16.23037% with 320 lines in your changes missing coverage. Please review.

Project coverage is 33.54%. Comparing base (f5e6fc8) to head (b52f19c).
Report is 25 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...desktop/src/platform/services/ssh-agent.service.ts 0.00% 73 Missing ⚠️
...esktop/src/platform/main/main-ssh-agent.service.ts 0.00% 47 Missing ⚠️
.../desktop/src/vault/app/vault/add-edit.component.ts 0.00% 29 Missing ⚠️
libs/common/src/models/export/ssh-key.export.ts 0.00% 25 Missing ⚠️
...top/src/platform/components/approve-ssh-request.ts 0.00% 15 Missing ⚠️
apps/desktop/src/platform/preload.ts 0.00% 15 Missing ⚠️
...angular/src/vault/components/add-edit.component.ts 0.00% 9 Missing ⚠️
libs/common/src/vault/models/view/ssh-key.view.ts 47.05% 9 Missing ⚠️
...ponents/sshkey-section/sshkey-section.component.ts 50.00% 7 Missing and 2 partials ⚠️
libs/common/src/vault/models/domain/cipher.ts 11.11% 8 Missing ⚠️
... and 23 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10825      +/-   ##
==========================================
- Coverage   33.62%   33.54%   -0.08%     
==========================================
  Files        2825     2835      +10     
  Lines       88200    88578     +378     
  Branches    16800    16854      +54     
==========================================
+ Hits        29655    29713      +58     
- Misses      56223    56537     +314     
- Partials     2322     2328       +6     

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

@quexten quexten marked this pull request as ready for review October 1, 2024 16:43
@quexten quexten requested review from a team as code owners October 1, 2024 16:43
@quexten quexten requested review from coroiu, Jingo88 and gbubemismith and removed request for Jingo88 October 1, 2024 16:43
djsmith85
djsmith85 previously approved these changes Oct 1, 2024
Copy link
Contributor

@djsmith85 djsmith85 left a comment

Choose a reason for hiding this comment

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

Tools changes are looking good

coroiu
coroiu previously approved these changes Oct 2, 2024
Copy link
Contributor

@coroiu coroiu left a comment

Choose a reason for hiding this comment

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

Approving without review since I'm assuming the changes have already been reviewed in the sub-PRs

gbubemismith
gbubemismith previously approved these changes Oct 2, 2024
@quexten
Copy link
Contributor Author

quexten commented Oct 20, 2024

Resolved merge conflicts.

djsmith85
djsmith85 previously approved these changes Oct 21, 2024
coroiu
coroiu previously approved these changes Oct 22, 2024
Copy link
Contributor

@coroiu coroiu left a comment

Choose a reason for hiding this comment

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

Approving without review

gbubemismith
gbubemismith previously approved these changes Oct 22, 2024
@quexten quexten dismissed stale reviews from gbubemismith, coroiu, and djsmith85 via 1d34ef4 November 4, 2024 12:10
@quexten quexten marked this pull request as draft November 4, 2024 12:11
@quexten
Copy link
Contributor Author

quexten commented Nov 4, 2024

Moving to draft until QA passed and merge conflicts are resolved, as to keep re-reviews low.

* Move ssh agent behind feature flag

* Add separate flag for ssh agent
* Fix error message for import of unsupported ssh keys

* Use triple equals in add-edit component for ssh keys
@quexten quexten marked this pull request as ready for review November 7, 2024 11:58
@quexten
Copy link
Contributor Author

quexten commented Nov 7, 2024

Since the last approval, a bug found by QA was fixed and a feature flag added (the agent is now entirely feature flagged), and the PR's for this were reviewed and approved seperately.

@quexten quexten merged commit 081fe83 into main Nov 8, 2024
66 of 67 checks passed
@quexten quexten deleted the feature/ssh-keys branch November 8, 2024 10:01
@@ -106,6 +106,9 @@ export class VaultItemsComponent extends BaseVaultItemsComponent implements OnIn
case CipherType.SecureNote:
this.groupingTitle = this.i18nService.t("secureNotes");
break;
case CipherType.SshKey:
this.groupingTitle = this.i18nService.t("sshKeys");
Copy link
Contributor

Choose a reason for hiding this comment

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

@quexten Isn't doesn't look like this i18n key exists in browser's messages.json

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#12083

Thanks for catching it

Copy link
Contributor

Choose a reason for hiding this comment

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

Of course, and ty for fixing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants