mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-05-12 19:08:21 +00:00
Compare commits
No commits in common. "8ae52363cc9fc6ae0b07bc3b45c222213d294495" and "4634641adb36672eed6028d082751b2aad3dc70f" have entirely different histories.
8ae52363cc
...
4634641adb
2 changed files with 3 additions and 21 deletions
13
README.md
13
README.md
|
@ -105,19 +105,6 @@ For Scripting we have a -j or --json flag to convert the Output for the create,
|
||||||
|
|
||||||
Note: The JSON Output does not cover Error Messages, you can detect Errors by checking if the Exitcode is not 0
|
Note: The JSON Output does not cover Error Messages, you can detect Errors by checking if the Exitcode is not 0
|
||||||
|
|
||||||
# Exposing Secrets to Subprocesses
|
|
||||||
The `exec` command allows you to execute another command with environment variables that reference secrets stored in Passbolt.
|
|
||||||
Any environment variables containing `passbolt://` references are automatically resolved to their corresponding secret values
|
|
||||||
before the specified command is executed. This ensures that secrets are securely injected into the child process's environment
|
|
||||||
without exposing them to the parent shell.
|
|
||||||
For example:
|
|
||||||
```bash
|
|
||||||
export GITHUB_TOKEN=passbolt://<PASSBOLT_RESOURCE_ID_HERE>
|
|
||||||
passbolt exec -- gh auth login
|
|
||||||
```
|
|
||||||
|
|
||||||
This would resolve the passbolt:// reference in GITHUB_TOKEN to its actual secret value and pass it to the gh process.
|
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
Usage for all Subcommands is [here](https://github.com/passbolt/go-passbolt-cli/wiki/passbolt).
|
Usage for all Subcommands is [here](https://github.com/passbolt/go-passbolt-cli/wiki/passbolt).
|
||||||
And is also available via `man passbolt`
|
And is also available via `man passbolt`
|
||||||
|
|
11
cmd/exec.go
11
cmd/exec.go
|
@ -3,15 +3,14 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/passbolt/go-passbolt-cli/util"
|
"github.com/passbolt/go-passbolt-cli/util"
|
||||||
"github.com/passbolt/go-passbolt/api"
|
"github.com/passbolt/go-passbolt/api"
|
||||||
"github.com/passbolt/go-passbolt/helper"
|
"github.com/passbolt/go-passbolt/helper"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const PassboltPrefix = "passbolt://"
|
const PassboltPrefix = "passbolt://"
|
||||||
|
@ -93,10 +92,6 @@ func resolveEnvironmentSecrets(ctx context.Context, client *api.Client) ([]strin
|
||||||
}
|
}
|
||||||
|
|
||||||
envVars[i] = key + "=" + secret
|
envVars[i] = key + "=" + secret
|
||||||
|
|
||||||
if viper.GetBool("debug") {
|
|
||||||
fmt.Fprintf(os.Stdout, "%v env var populated with resource id %v\n", key, resourceId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return envVars, nil
|
return envVars, nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue