Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve a threading issue with secrets; Handle SecretStore vaults better with inbuilt defaults; Write documentation for SecretStore vaults #1303

Merged
merged 6 commits into from
May 26, 2024

Conversation

Badgerati
Copy link
Owner

Description of the Change

  • Resolves a threading issue with secrets and vaults by creating a Lockable per vault, and adding Lock-PodeObject wrappers to Get, Set, Read, Update, Remove, and Unlock functions.
  • Adds inbuilt defaults when using the SecretStore secret vault provider, so it can be more easily used.
  • Adds documentation for SecretStore, and flags that -UnlockSecret is mandatory.

Related Issue

Resolves #1180
Resolves #1250

Examples

Start-PodeServer -Threads 2 {
    Add-PodeEndpoint -Address * -Port 8080 -Protocol Http

    # register the vault
    Register-PodeSecretVault `
        -Name 'ExampleVault' `
        -ModuleName 'Microsoft.PowerShell.SecretStore' `
        -UnlockSecret 'Sup3rSecur3Pa$$word!'

    # set a secret in the local vault
    Set-PodeSecret -Key 'example' -Vault 'ExampleVault' -InputObject 'hello, world!'

    # mount the "example" secret from local vault, making it accessible via $secret:example
    Mount-PodeSecret -Name 'example' -Vault 'ExampleVault' -Key 'example'

    # retrieve the secret in a route
    Add-PodeRoute -Method Get -Path '/' -ScriptBlock {
        Write-PodeJsonResponse @{ Value = $secret:example }
    }

    # update the secret in a route
    Add-PodeRoute -Method Post -Path '/' -ScriptBlock {
        $secret:example = $WebEvent.Data.Value
    }
}

…ore better with inbuilt defaults, write docs for SecretStore
@Badgerati Badgerati added this to the 2.10.1 milestone May 25, 2024
@Badgerati Badgerati self-assigned this May 25, 2024
@Badgerati Badgerati merged commit dd3830b into develop May 26, 2024
30 checks passed
@Badgerati Badgerati deleted the Issue-1250 branch May 26, 2024 12:23
@Badgerati Badgerati mentioned this pull request May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pode Secrets Issue Error: No extension vaults registered when adding secret
1 participant