PowerShell / SecretManagement

PowerShell module to consistent usage of secrets through different extension vaults
MIT License
335 stars 47 forks source link

New cmdlet Request : Dissociate "Set-Secret" from "New-Secret" #105

Closed PowerBugi closed 3 years ago

PowerBugi commented 3 years ago

Hello,

Is it possible to dissociate the "modify" (set) command from the usual "create" (new) command ?

It's a bit confusing to do a "set" to create a new password, is there a reason ?

Thank you very much !

JustinGrote commented 3 years ago

@PowerBugi I think to keep the surface minimal, New-Secret is performed by Set-Secret -NoClobber which performs the same behavior. The default if setting a secret is to create a secret and automatically overwrite an existing secret since a common activity is secret rotation, which matches the convention of the Powershell verbs as "Set" better than "New", where new should fail if the secret already exists (because it's not "New")

Technically "Add" would be the correct verb anyway because you're adding to an existing collection (a vault)

You could easily make yourself an alias or function that calls Set-Secret -NoClobber. If there was enough demand for New-Secret as basically the same alias maybe, but what you want exists.

PaulHigin commented 3 years ago

This is correct. We used to have Add-Secret that always overwrote an existing secret, and changed it to Set-Secret to be more accurate.