Skip to content

[PM-16227] Move import to sdk and enable it in browser/web #12479

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

Merged
merged 67 commits into from
Mar 10, 2025

Conversation

quexten
Copy link
Contributor

@quexten quexten commented Dec 19, 2024

🎟️ Tracking

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

📔 Objective

Makes use of the sdk in order to handle import on desktop web and browser. Drops importer code from desktop_native since it's not needed there anymore.

📸 Screenshots

Screen.Recording.2025-01-15.at.12.59.04.mov
Screen.Recording.2025-01-15.at.12.52.06.mov

Failed import:

Screen.Recording.2025-01-15.at.13.10.25.mov

⏰ 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 Dec 19, 2024

Logo
Checkmarx One – Scan Summary & Detailsb940fcc5-60f7-4b34-9de5-a4be747fbdba

Great job, no security vulnerabilities found in this Pull Request

Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 55.05618% with 40 lines in your changes missing coverage. Please review.

Project coverage is 35.94%. Comparing base (85a5aea) to head (ffdb01b).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
libs/common/src/models/export/ssh-key.export.ts 0.00% 9 Missing ⚠️
...angular/src/vault/components/add-edit.component.ts 0.00% 8 Missing ⚠️
...ponents/sshkey-section/sshkey-section.component.ts 27.27% 7 Missing and 1 partial ⚠️
.../src/services/default-ssh-import-prompt.service.ts 84.44% 3 Missing and 4 partials ⚠️
libs/vault/src/cipher-form/cipher-form.stories.ts 0.00% 3 Missing ⚠️
apps/browser/src/popup/services/services.module.ts 0.00% 1 Missing ⚠️
apps/desktop/src/app/services/services.module.ts 0.00% 1 Missing ⚠️
.../desktop/src/vault/app/vault/add-edit.component.ts 0.00% 1 Missing ⚠️
libs/common/src/models/export/cipher.export.ts 0.00% 1 Missing ⚠️
libs/importer/src/components/import.component.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12479      +/-   ##
==========================================
- Coverage   36.01%   35.94%   -0.08%     
==========================================
  Files        3174     3175       +1     
  Lines       93357    93121     -236     
  Branches    16960    16969       +9     
==========================================
- Hits        33623    33472     -151     
+ Misses      57144    57052      -92     
- Partials     2590     2597       +7     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@quexten quexten changed the title Move import to sdk and enable it in browser/web [PM-16227] Move import to sdk and enable it in browser/web Dec 23, 2024
@quexten quexten marked this pull request as ready for review December 24, 2024 14:24
@quexten quexten requested review from a team as code owners December 24, 2024 14:24
audreyality

This comment was marked as outdated.

Comment on lines 846 to 849
} else {
password = await this.getSshKeyPassword();
await this.importSshKeyFromClipboard(password);
}

This comment was marked as outdated.

mzieniukbw
mzieniukbw previously approved these changes Feb 11, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Great work!

Copy link
Member

@coltonhurst coltonhurst left a comment

Choose a reason for hiding this comment

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

Autofill removals look good!

Copy link

@quexten quexten merged commit 01f6fd7 into main Mar 10, 2025
87 of 89 checks passed
@quexten quexten deleted the km/pm-16227/ssh-import-web-browser branch March 10, 2025 17:41
blackwood pushed a commit that referenced this pull request Mar 24, 2025
* Move import to sdk and enable it in browser/web

* Add uncomitted files

* Update package lock

* Fix prettier formatting

* Fix build

* Rewrite import logic

* Update ssh import logic for cipher form component

* Fix build on browser

* Break early in retry logic

* Fix build

* Fix build

* Fix build errors

* Update paste icons and throw error on wrong import

* Fix tests

* Fix build for cli

* Undo change to jest config

* Undo change to feature flag enum

* Remove unneeded lifetime

* Fix browser build

* Refactor control flow

* Fix i18n key and improve import behavior

* Remove for loop limit

* Clean up tests

* Remove unused code

* Update libs/vault/src/cipher-form/components/sshkey-section/sshkey-section.component.ts

Co-authored-by: SmithThe4th <[email protected]>

* Move import logic to service and add tests

* Fix linting

* Remove erroneous includes

* Attempt to fix storybook

* Fix storybook, explicitly implement ssh-import-prompt service abstraction

* Fix eslint

* Update libs/importer/src/importers/bitwarden/bitwarden-json-importer.ts

Co-authored-by: ✨ Audrey ✨ <[email protected]>

* Fix services module

* Remove ssh import sdk init code

* Add tests for errors

* Fix import

* Fix import

* Fix pkcs8 encrypted key not parsing

* Fix import button showing on web

---------

Co-authored-by: SmithThe4th <[email protected]>
Co-authored-by: ✨ Audrey ✨ <[email protected]>
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.

"The SSH key is invalid" when using 'Import key from clipboard' on Windows
8 participants