4 ms·
A weakness of modern secret management is that it isn’t. A secret value ought to be very carefully guarded even from the host machine itself. .NET for example
by jiggawatts 5y ago
A weakness of modern secret management is that it isn’t.
A secret value ought to be very carefully guarded even from the host machine itself.
.NET for example has SecureString, which is a good start — it can’t be accidentally printed or serialised insecurely. If it is serialised, then it is automatically encrypted by the host OS data protection API.
Windows even has TPM-hosted certificates! They’re essentially a smart card plugged into the motherboard.
A running app can use a TPM credential to sign requests but it can’t read or copy it.
These advancements are just completely ignored in the UNIX world, where everything is blindly copied into easily accessible locations in plain text…
- pxx 5y agoExcept afaict SecureString doesn't reliably do that and shouldn't be used. https://github.com/dotnet/platform-compat/blob/master/docs/DE0001.md https://github.com/dotnet/platform-compat/blob/master/docs/D...
- jiggawatts 5y ago“It’s not perfectly secure so use a totally insecure alternative instead” seems like terrible advice.
- pxx 5y agoNo it's "don't use this thing which doesn't do what it says on the tin and is therefore a foot gun." Something that is obviously insecure will be treated with more caution / put on the correct side of the authorization boundary compared to something that claims to be.
- jiggawatts 5y ago> "obviously insecure will be treated with more caution" What planet are you from and can I go there? SecureString provides one layer in the "defence in depth". If someone accidentally logs it, then it won't leak. If it is used as a script parameter, then the prompt will use password input characters automatically. Seriously, I want you to try this PowerShell snippet right now. (You can even run it on Linux too with pwsh v7, so no excuses!): PARAM( [parameter(Mandatory=$true)] [securestring]$Secret ) Write-Warning "Oops I didn't mean to log this: $Secret" $Secret | ConvertTo-Json -Compress $Secret | Export-Clixml 'accidental serialisation.xml' Get-Content 'accidental serialisation.xml' Run the the script and see what happens. There's even low-level protection built-in, such zeroing out the memory when it is garbage collected (unlike normal strings). Why is this a bad thing!? Do you like secrets leaking everywhere unless everyone is always hyper vigilant? Or do you prefer to roll your own half-baked secret storage type that nothing else is compatible with? PS: The page with that advice is based on an "archived" read-only repo with a bunch of open issues of people befuddled as to why this bad, BAD, BAD advice is being published there.
- majkinetor 5y agoAbsolutely. Secrets are awesome part of pwsh. You also have `Get-Secret` and friends for full blown pass-like solution.
- jiggawatts 5y agoThey're not really a part of "pwsh", the SecureString type is built in to the .NET Framework, and has been before PowerShell existed. One of the many reasons I detest stringly-typed programming is that many small things become difficult, including (but not limited to) the handling of secrets.