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-10938] Import ssh-keys from 1password 1pux #10787

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

djsmith85
Copy link
Contributor

@djsmith85 djsmith85 commented Aug 29, 2024

🎟️ Tracking

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

📔 Objective

With the introduction of the SSH keys item type, we can now also support importing ssh keys from other password managers. This add support for 1password's 1pux format.

The 1pux format has changed and the updates to fix it have been done at #10778. This PR requires the aforementioned to be merged first

⏰ 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

Copy link
Contributor

github-actions bot commented Aug 29, 2024

Logo
Checkmarx One – Scan Summary & Details11827cf6-210a-448f-bb04-2579387ef1b2

New Issues

Severity Issue Source File / Package Checkmarx Insight
HIGH CVE-2024-11115 Npm-electron-33.2.1 Vulnerable Package

Fixed Issues

Severity Issue Source File / Package
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.html: 15

Copy link
Contributor

@quexten quexten left a comment

Choose a reason for hiding this comment

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

Potential blocker: From the sample key it seems that 1Password uses the legacy PKCS#8 format for private keys. The library we use in rust for parsing keys (https://github.com/RustCrypto/SSH/tree/master/ssh-key) only supports the modern OPENSSH format. So either, we have to use another library on the fly to convert them, or convert them on import. Either way this will become a problem. (I'll have to note this on the regular import ticket as well)

@djsmith85 Any preference on converting during import or converting on the fly during usage? (it would mean blocking import until we either have a js library for parsing or add rust to web, but we would have a consistent format for private keys)

I'm leaning towards on import, so that we just have one consistent format (openssh) in the vault ciphers.

@djsmith85
Copy link
Contributor Author

@quexten Usually I'd say the conversion needs to happen on import, as the target system dictates what is supported. I'll need to look into libraries then to convert PKCS#8 to OPENSSH.

Idea for a future improvement: Adding support for users to manually add PKCS#8 into their vault and convert it on save?

* 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
Base automatically changed from auth/pm-10395/ssh-keys-item-type to feature/ssh-keys August 30, 2024 14:16
@quexten quexten force-pushed the tools/PM-10938/1pux-ssh-key-import branch from 1d33726 to 5bda3d1 Compare August 30, 2024 14:21
@quexten
Copy link
Contributor

quexten commented Aug 30, 2024

@djsmith85 Merge & squashing the target branch PR to the feature branch added all the squashed commits to your PR's diff (since they were squashed in the target) so I did an interactive rebase & force push to not have this PR be convoluted. Sorry about the inconvenience.

@quexten
Copy link
Contributor

quexten commented Sep 14, 2024

@djsmith85 Adding support for PKCS#8 parsing to rust importing code here: #11048, this will be ported over to sdk later on. Once sdk is included in all clients, it should not matter what format 1password provides, it will be parsed either way. For now users should be able to either go the 1password->file-openssh->bitwarden-desktop-import or 1password->copypaste-pkcs#8->bitwarden-desktop route.

Base automatically changed from feature/ssh-keys to main November 8, 2024 10:01
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 33.79%. Comparing base (395258d) to head (a9e9971).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10787   +/-   ##
=======================================
  Coverage   33.79%   33.79%           
=======================================
  Files        2912     2912           
  Lines       90701    90713   +12     
  Branches    17153    17155    +2     
=======================================
+ Hits        30648    30660   +12     
  Misses      57667    57667           
  Partials     2386     2386           

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

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.

2 participants