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 3 commits into
base: feature/ssh-keys
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 & Details3e7ba1a0-3c22-4d7f-8388-8b4443857217

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Absolute_Path_Traversal /apps/cli/src/oss-serve-configurator.ts: 282 Attack Vector
MEDIUM Absolute_Path_Traversal /apps/cli/src/oss-serve-configurator.ts: 314 Attack Vector
MEDIUM Absolute_Path_Traversal /apps/cli/src/oss-serve-configurator.ts: 282 Attack Vector
MEDIUM Absolute_Path_Traversal /apps/cli/src/oss-serve-configurator.ts: 314 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/web/src/app/layouts/product-switcher/product-switcher.component.html: 1 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /libs/components/src/navigation/nav-divider.component.html: 1 Attack Vector
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/browser/src/autofill/popup/fido2/fido2-use-browser-link.component.html: 1 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 475 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 475 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 445 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 445 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 475 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 445 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.ts: 859 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.ts: 880 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.ts: 880 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.ts: 883 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.ts: 883 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 541 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 541 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 541 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 1518 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/background/overlay.background.ts: 1517 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.ts: 597 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.ts: 859 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.ts: 859 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.ts: 880 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/overlay/inline-menu/pages/list/autofill-inline-menu-list.ts: 883 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/auth/lock.component.ts: 18 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/auth/lock.component.ts: 46 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/password-generator-history.component.html: 11 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/password-generator-history.component.html: 11 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 583 Attack Vector
MEDIUM Client_Privacy_Violation /bitwarden_license/bit-web/src/app/auth/sso/sso.component.ts: 161 Attack Vector
MEDIUM Client_Privacy_Violation /bitwarden_license/bit-web/src/app/auth/sso/sso.component.ts: 161 Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/connectors/webauthn-fallback.ts: 116 Attack Vector
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 14 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 60 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 56 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/tools/popup/generator/password-generator-history.component.html: 26 Attack Vector
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/password-history.component.html: 18 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/app/tools/password-generator-history.component.html: 15 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/password-history.component.html: 12 Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 50 Attack Vector
MEDIUM Missing_HSTS_Header /apps/cli/src/auth/commands/login.command.ts: 707 Attack Vector
MEDIUM Unpinned Actions Full Length Commit SHA /publish-desktop.yml: 115 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 /version-bump.yml: 500 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-web.yml: 44 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 /version-bump.yml: 360 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 /version-bump.yml: 298 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 /version-bump.yml: 248 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: 92 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 /version-bump.yml: 188 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-desktop.yml: 124 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 /version-bump.yml: 48 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 /version-bump.yml: 516 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: 668 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 /retrieve-current-desktop-rollout.yml: 23 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 /version-bump.yml: 195 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 /version-bump.yml: 82 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: 129 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-browser.yml: 420 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 /version-bump.yml: 163 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-cli.yml: 402 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: 1245 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 /version-bump.yml: 492 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-browser.yml: 379 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 /version-bump.yml: 202 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: 1291 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 /version-bump.yml: 508 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: 171 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 /version-bump.yml: 181 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 Angular_Usage_of_Unsafe_DOM_Sanitizer /apps/desktop/src/app/components/avatar.component.ts: 75 Attack Vector
LOW Angular_Usage_of_Unsafe_DOM_Sanitizer /libs/components/src/avatar/avatar.component.ts: 80 Attack Vector
LOW Angular_Usage_of_Unsafe_DOM_Sanitizer /libs/components/src/icon/icon.component.ts: 18 Attack Vector
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/common.ts: 2 Attack Vector
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/common.ts: 2 Attack Vector
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/accessibility-cookie.component.html: 18 Attack Vector
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/common.ts: 2 Attack Vector
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/sso.ts: 21 Attack Vector
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/common.ts: 2 Attack Vector
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/sso.ts: 19 Attack Vector
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/common.ts: 2 Attack Vector
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/sso.ts: 15 Attack Vector
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/popup/login-via-auth-request.component.ts: 52 Attack Vector
LOW Client_DOM_Open_Redirect /apps/browser/src/tools/popup/generator/password-generator-history.component.ts: 19 Attack Vector
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/popup/account-switching/current-account.component.ts: 35 Attack Vector
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/login/login-via-auth-request.component.ts: 60 Attack Vector
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/popup/login-via-auth-request.component.ts: 52 Attack Vector
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/login/login-via-auth-request.component.ts: 60 Attack Vector
LOW Client_DOM_Open_Redirect /apps/browser/src/vault/popup/components/vault/attachments.component.ts: 33 Attack Vector
LOW Client_DOM_Open_Redirect /apps/browser/src/billing/popup/settings/premium.component.ts: 27 Attack Vector
LOW Client_DOM_Open_Redirect /apps/browser/src/vault/popup/components/vault/password-history.component.ts: 23 Attack Vector
LOW Client_DOM_Open_Redirect /libs/common/src/auth/iframe-component.ts: 49 Attack Vector
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/scripts/duo.js: 277 Attack Vector
LOW Client_DOM_Open_Redirect /libs/common/src/auth/webauthn-iframe.ts: 25 Attack Vector
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/scripts/duo.js: 277 Attack Vector
LOW Client_Hardcoded_Domain /libs/common/src/billing/services/payment-processors/stripe.service.ts: 23 Attack Vector
LOW Client_Hardcoded_Domain /apps/web/src/app/billing/shared/payment.component.ts: 68 Attack Vector
LOW Client_Hardcoded_Domain /apps/web/src/app/billing/shared/payment.component.ts: 68 Attack Vector
LOW Client_Hardcoded_Domain /apps/web/src/connectors/captcha.ts: 57 Attack Vector
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/models/response.ts: 36 Attack Vector
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/commands/get.command.ts: 149 Attack Vector
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/commands/get.command.ts: 142 Attack Vector
LOW Client_JQuery_Deprecated_Symbols /libs/importer/src/importers/base-importer.ts: 314 Attack Vector
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/commands/get.command.ts: 324 Attack Vector
LOW Client_JQuery_Deprecated_Symbols /libs/importer/src/services/import.service.ts: 455 Attack Vector
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/commands/download.command.ts: 22 Attack Vector
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/base-program.ts: 115 Attack Vector
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/auth/commands/login.command.ts: 575 Attack Vector
LOW Client_JQuery_Deprecated_Symbols

More results are available on AST platform

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?

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.

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