atom / node-keytar

Native Password Node Module
https://atom.github.io/node-keytar
MIT License
1.37k stars 193 forks source link

Ensure secret exists when tyring to read as text #476

Open jsimonet opened 1 year ago

jsimonet commented 1 year ago

Requirements for Contributing a Bug Fix

Identify the Bug

https://github.com/atom/node-keytar/issues/477

Description of the Change

Ensure the variable secret is not NULL before passing it to the function secret_value_get_text.

Alternate Designs

An alternate design could be to use a GCancellable object in secret_service_search_sync function call. I tried to use it but failed to understand how to use it.

Possible Drawbacks

This MR should not add a possible drawback.

Verification Process

Test suite still pass (npm run test). Using FindCredentials without unlocking my keystore in my electron app does not crash anymore.

The error I got during my usage was:

  (process:280213): libsecret-CRITICAL **: 16:02:21.069: secret_value_get_text: assertion 'value' failed

Release Notes

Fixed a bug where calling FindCredentials without unlocking the keystore on Linux.