Build the SecureString for an inline key on Windows too
The vault is written with ConvertFrom-SecureString -SecureString, so the inline branch has to produce a SecureString as well - it only set the plain text, and under Set-StrictMode the vault write then failed with 'the variable $secure cannot be retrieved'. Caught by running the new form on the Windows box rather than assuming it. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -379,7 +379,10 @@ function Set-VaultKey {
|
|||||||
Initialize-Root
|
Initialize-Root
|
||||||
if ($Key) {
|
if ($Key) {
|
||||||
Write-Warn2 'the key was given on the command line, so it is in this shell history - the hidden prompt leaves no trace'
|
Write-Warn2 'the key was given on the command line, so it is in this shell history - the hidden prompt leaves no trace'
|
||||||
$plain = $Key
|
$plain = $Key
|
||||||
|
# The vault is written from a SecureString (DPAPI), so the inline form
|
||||||
|
# has to produce one too.
|
||||||
|
$secure = ConvertTo-SecureString -String $Key -AsPlainText -Force
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Paste the API key for ref '$Ref' (input hidden):"
|
Write-Host "Paste the API key for ref '$Ref' (input hidden):"
|
||||||
$secure = Read-Host -AsSecureString
|
$secure = Read-Host -AsSecureString
|
||||||
|
|||||||
Reference in New Issue
Block a user