-
Notifications
You must be signed in to change notification settings - Fork 260
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
Enable generic secrets in keytar via ipc #1286
Enable generic secrets in keytar via ipc #1286
Conversation
e57ac17
to
421dfe6
Compare
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.
It'd be good to avoid using keytar for new secrets code, can you use https://www.electronjs.org/docs/latest/api/safe-storage instead?
I can try to do that from the current branch, but the implementation would greatly benefit from parts of #1087. Is there any timeline for that PR? |
@Johennes is currently looking into scheduling for that work to continue, keep in mind that PR hasn't yet been tested, otherwise feel free to cargocult whatever you deem useful |
Sadly, the keytar deprecation topic sits further down in our backlog right now. We'll probably not be able to pick this up ourselves in the near future but contributions would certainly be welcome. |
421dfe6
to
83135ea
Compare
I switched to a minimal setup with |
@@ -0,0 +1,81 @@ | |||
/* | |||
Copyright 2023 New Vector Ltd |
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.
This should be your copyright
src/secrets.ts
Outdated
/** | ||
* Save secrets on a local machine. | ||
* These secrets are associated with a local machine user, not an Element user. | ||
* CAUTION: They are not cleared when a user logs out of Element. |
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.
Hmm, what is the reason for this? This doesn't seem desirable, we go out of our way to clear all data when you log out using electron-clear-data
via the clearStorage
IPC
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.
Of couse we can only do this on a trusted platform/filesystem, I am aware this is against the spirit of the remaining code base, thus the comment.
The feature of this PR is intended for use in matrix-org/matrix-react-sdk#11776 (Store the ssss key on the platform so it is easier to use and harder to lose). Not clearing the key reduces friction, as it enables a user to log into Element again and have the device automatically verified.
What if we make clearing the secrets a feature flag that explicitly warn about the implications?
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.
Yeah as it stands this would need product buy-in, right now its intentional that a log out wipes as much as possible.
Signed-off-by: Nils Hanff <[email protected]>
83135ea
to
503c42f
Compare
This PR implements an extended IPC interface (element-hq/element-web#26405) between the electron platform and application. The interface can be used to set, retrieve and destroy arbitrary secrets, similar to saving pickle keys. Notably, these changes allow setting a value for a secret instead of just generating a random one and retrieving it. See also matrix-org/matrix-react-sdk#11776.
Checklist
Notes: none
This change has no change notes, so will not be included in the changelog.