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

feat: New environment variable obfuscation functionality - CLI arguments #522

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@
ro.StepName,
witness.RunWithSigners(signers...),
witness.RunWithAttestors(attestors),
witness.RunWithAttestationOpts(attestation.WithWorkingDir(ro.WorkingDir), attestation.WithHashes(roHashes)),
witness.RunWithAttestationOpts(
attestation.WithWorkingDir(ro.WorkingDir),
attestation.WithHashes(roHashes),
attestation.WithEnvCapturer(

Check failure on line 137 in cmd/run.go

View workflow job for this annotation

GitHub Actions / Verify Docgen

undefined: attestation.WithEnvCapturer

Check failure on line 137 in cmd/run.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: attestation.WithEnvCapturer

Check failure on line 137 in cmd/run.go

View workflow job for this annotation

GitHub Actions / sast / witness

undefined: attestation.WithEnvCapturer

Check failure on line 137 in cmd/run.go

View workflow job for this annotation

GitHub Actions / e2e-test / witness

undefined: attestation.WithEnvCapturer

Check failure on line 137 in cmd/run.go

View workflow job for this annotation

GitHub Actions / unit-test / witness

undefined: attestation.WithEnvCapturer
ro.EnvAddSensitiveKeys, ro.EnvExcludeSensitiveKeys, ro.EnvDisableSensitiveVars, ro.EnvFilterSensitiveVars,
),
),
witness.RunWithTimestampers(timestampers...),
)
if err != nil {
Expand Down
10 changes: 10 additions & 0 deletions options/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ type RunOptions struct {
Tracing bool
TimestampServers []string
AttestorOptSetters map[string][]func(attestation.Attestor) (attestation.Attestor, error)
EnvFilterSensitiveVars bool
EnvDisableSensitiveVars bool
EnvAddSensitiveKeys []string
EnvExcludeSensitiveKeys []string
}

var RequiredRunFlags = []string{
Expand All @@ -57,6 +61,12 @@ func (ro *RunOptions) AddFlags(cmd *cobra.Command) {
cmd.Flags().BoolVarP(&ro.Tracing, "trace", "r", false, "Enable tracing for the command")
cmd.Flags().StringSliceVarP(&ro.TimestampServers, "timestamp-servers", "t", []string{}, "Timestamp Authority Servers to use when signing envelope")

// Environment variables flags
cmd.Flags().BoolVarP(&ro.EnvFilterSensitiveVars, "env-filter-sensitive-vars", "", false, "Switch from obfuscate to filtering variables which removes them from the output completely.")
cmd.Flags().BoolVarP(&ro.EnvDisableSensitiveVars, "env-disable-default-sensitive-vars", "", false, "Disable the default list of sensitive vars and only use the items mentioned by --add-sensitive-key.")
cmd.Flags().StringSliceVar(&ro.EnvAddSensitiveKeys, "env-add-sensitive-key", []string{}, "Add keys or globs (e.g. '*TEXT') to the list of sensitive environment keys.")
cmd.Flags().StringSliceVar(&ro.EnvExcludeSensitiveKeys, "env-exclude-sensitive-key", []string{}, "Exclude specific keys from the list of sensitive environment keys. Note: This does not support globs.")

cmd.MarkFlagsRequiredTogether(RequiredRunFlags...)

attestationRegistrations := attestation.RegistrationEntries()
Expand Down
Loading