PowerShell / SecretStore

MIT License
158 stars 24 forks source link

Do we need to store the ModulePath in the vaultinfo file? #106

Open brwilkinson opened 2 months ago

brwilkinson commented 2 months ago

Prerequisites

Steps to reproduce

cat $env:LOCALAPPDATA\Microsoft\PowerShell\secretmanagement\secretvaultregistry\vaultinfo

Do we have to store the ModulePath in the metadata file?

{
  "Vaults": {
    "SS": {
      "ModuleName": "Microsoft.PowerShell.SecretStore",
      "Description": "",
      "ModulePath": "C:\\Users\\myuser\\Documents\\PowerShell\\Modules\\Microsoft.PowerShell.SecretStore",
      "VaultParameters": {},
      "SetSecretSupportsMetadata": true
    }
  },
  "DefaultVaultName": "SS"
}
"ModulePath": "C:\\Users\\myuser\\OneDrive - Blah\\Documents\\PowerShell\\Modules\\Microsoft.PowerShell.SecretStore",

Expected behavior

I recently migrated from using documents in $home to documents in $env:OneDrive

then had to spend a bunch of time fixing the issue by unregistering and reregistering the secretvault.

Does the path really need to be in there?

Actual behavior

errors pointing to the old path that did not exist after the documents directory and modules directory was moved.

Error details

No response

Environment data

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.4
PSEdition                      Core

Version

1.1.2

Visuals

No response

brwilkinson commented 2 months ago

This could also occur if you switched module path from user to machine.