gaelcolas / gaelcolas/Datum.ProtectedData

[Unprotect-Datum] Never uses Certificate Parameter when calling Unprotect-Data

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
2
Forks
4
PR merge metrics
No merged PRs in 30d

Description

There is a typo at the switch where it adds the parameters to call Unprotect-Data. The Value `ByCertificae` should be `ByCertificate`
```PowerShell
Switch ($PSCmdlet.ParameterSetName) {
'ByCertificae' { $UnprotectDataParams.Add('Certificate', $Certificate)}
'ByPassword' { $UnprotectDataParams.Add('Password', $Password) }
}
```
[Line 110](https://github.com/gaelcolas/Datum.ProtectedData/blob/38a22d402f507370c7a70b7fa572438681b61187/Datum.ProtectedData/public/Unprotect-Datum.ps1#L110)

Because of that the Parameter `Certificate` is never added. This results in Unprotect-Data to determine the required Certificate by its automation which searches the following locations:
`Cert:\CurrentUser\My`
`Cert:\LocalMachine\My`

This results in irittating behavior where you can decrypt a secret with an command like this:
```PowerShell
Unprotect-Datum -Base64Data $encCredential -Certificate ' '
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.