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

Get-Secret fails to retrieve some secrets listed by Get-SecretInfo #63

Open
sba923 opened this issue Aug 27, 2021 · 9 comments
Open

Get-Secret fails to retrieve some secrets listed by Get-SecretInfo #63

sba923 opened this issue Aug 27, 2021 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@sba923
Copy link

sba923 commented Aug 27, 2021

This should speak for itself:

PS❯  get-secretinfo | ? { $_.name -eq 'LeCab' } | select name,type

Name          Type
----          ----
LeCab PSCredential

PS❯  get-secret -name LeCab
Get-Secret: The secret LeCab was not found.

In the affected vault, Get-SecretInfo lists 85 secrets, this failure occurs for 8 of them:

PS❯  get-secretinfo | ? { $null -eq (get-secret -name $_.Name -ea 0) } | select name, type

Name                                        Type
----                                        ----
Enquête "Reconnaissance au travail" PSCredential
FileLocator Pro [LITE]              PSCredential
International SOS                   PSCredential
LeCab                               PSCredential
OgoneVisaNo3DS                      PSCredential
Pick Go Pay APN key                 PSCredential
Samsung Galaxy A40                  PSCredential
Windows 7 Ultimate                  PSCredential

I'm running PowerShell 7.1.4 on Windows 10.0.19043.1165.amd64fre.vb_release.191206-1406 with Microsoft.PowerShell.SecretManagement version 1.1.0 and SecretManagement.KeePass version 0.9.1.3

@sba923
Copy link
Author

sba923 commented Aug 27, 2021

Repro'ed with SecretManagement.KeePass version 0.9.2

@JustinGrote
Copy link
Owner

JustinGrote commented Aug 27, 2021

Try it with verbose and debug turned on? There might be some clues in there.
Specificailly $VerbosePreference = 'continue' and $DebugPreference = 'continue'

@sba923
Copy link
Author

sba923 commented Aug 27, 2021

PS❯  get-secret -name 'LeCab'
VERBOSE: Secret information was successfully retrieved from vault <REDACTED>.
VERBOSE: Secret LeCab was successfully retrieved from vault <REDACTED>.
Get-Secret: The secret LeCab was not found.

@JustinGrote
Copy link
Owner

Sounds like something went null somewhere. If you can make a dummy keepass file that you can reproduce the issue I can debug it and find what's going wrong.

@sba923
Copy link
Author

sba923 commented Aug 27, 2021

Here you go: test.zip

Master password is test.

PS❯  get-secretinfo -vault test | ? { $null -eq (get-secret -vault test -name $_.Name -ea 0) } | select name, type

Name                           Type
----                           ----
FileLocator Pro [LITE] PSCredential
LeCab                  PSCredential
Samsung Galaxy A40     PSCredential
Windows 7 Ultimate     PSCredential

@JustinGrote JustinGrote self-assigned this Aug 28, 2021
@JustinGrote JustinGrote added the bug Something isn't working label Aug 28, 2021
@danubie
Copy link

danubie commented Sep 3, 2021

@sba923: It looks like a similar issue I run into.

If you do store an item in Keepass with no (or empty) password, SecretManagement.KeePass would internally return a null-value. This finally seems to be treated as "no secret found" by MS.SecretManagement.

IMHO this is OK. Because afiak the SecretManagement module would generally not allow to set "empty" secrects.

@sba923
Copy link
Author

sba923 commented Sep 3, 2021

@danubie thanks for sharing your thoughts

I actually use KeePass to store all kinds of secrets, some of which have an empty "Username" field and/or an empty "Password" field, for instance for software product keys, phone IMEIs....

@danubie
Copy link

danubie commented Sep 4, 2021

That's exactly where I got caught: A folder for API keys having "usernames" but no password

@user8446
Copy link

Hi,

I just put the API key in the password and a "1" for the username

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants