-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Update bitwarden extension: fix search when vault contains SSH keys #17492
base: main
Are you sure you want to change the base?
Conversation
- docs: update changelog - chore: unset removed shortcut - fix: handle ssh keys in search - Initial commit
Thank you for your contribution! 🎉 🔔 @jomifepe @daniel-stoneuk @andreaselia @pernielsentikaer @eth-p @YamenSharaf @undefinedzack @anirudhganwal06 @ivaarsson @gasparhabif @marinsokol you might want to have a look. You can use this guide to learn how to check out the Pull Request locally in order to test it. Due to our current reduced availability, the initial review may take up to 10-15 business days |
@jomifepe can you check this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR adds support for SSH keys in the Bitwarden extension, fixing a critical bug where the Search Vault command would error out when encountering SSH keys in a user's vault.
- Added proper handling for SSH_KEY item type in
src/types/vault.ts
with a new interface for SSH key properties - Created new
CopyPublicKeyAction.tsx
component to allow copying public keys to clipboard - Updated caching utility in
caching.ts
to properly handle SSH key items while maintaining security - Added icon and label mappings for SSH keys in
general.ts
andlabels.ts
for consistent UI representation - Implemented defensive error handling in
useItemAccessories.ts
to prevent crashes from unknown item types in the future
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
13 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
export interface SshKey { | ||
privateKey: string; | ||
publicKey: string; | ||
keyFingerprint: string; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The SshKey interface properties are all defined as required strings without null options, unlike other interfaces like Card and Identity which allow null values. Consider whether these fields should also allow null values for consistency and to handle potential edge cases where some fields might not be present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good bot. This is a fair observation, but at least as of now, SSH keys are not directly editable in the Bitwarden GUI (you have to either import them or generate them in Bitwarden itself), so I don't believe these are truly nullable, but I'm happy to change this for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition 💯
Looks clean overall. I've left a few comments.
@@ -17,7 +17,7 @@ const RepromptForm = (props: RepromptFormProps) => { | |||
navigationTitle="Confirmation Required" | |||
actions={ | |||
<ActionPanel> | |||
<Action.SubmitForm title="Confirm" onSubmit={onSubmit} shortcut={{ key: "enter", modifiers: [] }} /> | |||
<Action.SubmitForm title="Confirm" onSubmit={onSubmit} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the warnings 🙏
"Getting public key..." | ||
); | ||
if (publicKey) { | ||
await Clipboard.copy(publicKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should pass the transient flag depending on the preference here too.
await Clipboard.copy(publicKey); | |
await Clipboard.copy(publicKey, { transient: getTransientCopyPreference("other") }); |
{type === ItemType.SSH_KEY && ( | ||
<ActionPanel.Section> | ||
<CopyPublicKeyAction /> | ||
</ActionPanel.Section> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Might be useful to also have copy actions for the private key and fingerprint. Would you mind creating these?
Description
Closes #15837 and #16976.
Currently, the Search Vault command, the extension's main entry point, errors out if the vault contains an SSH key, a new item type added in late 2024. (This is why some users may not have any problems and also why downgrading to an earlier version of the CLI "fixes" the issue, since older versions just ignore SSH keys.)
This PR updates the extension's code to correctly handle the new item type. It displays SSH keys in the list of search results and adds an action to copy the public key to the clipboard. (I can also add an action to copy the private key and / or key fingerprint, though I'm not sure how useful these would be.)
I also added a check to ensure that the command won't completely error out if a new item type is added in the future (it'll have placeholder icons and no actions, which seems sensible until proper handling can be added in a PR similar to this one).
Also, while not related, I went ahead and fixed a warning generated by specifying a shortcut for
Action.SubmitForm
(Raycast is already overriding this to Command + Enter).Screencast
An SSH key in search results:
Checklist
npm run build
and tested this distribution build in Raycastassets
folder are used by the extension itselfREADME
are placed outside of themetadata
folder