-
Notifications
You must be signed in to change notification settings - Fork 21
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 #355
Open
matglas
wants to merge
18
commits into
in-toto:main
Choose a base branch
from
matglas:env-obfuscate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1eff76d
chore: New environment variable obfuscation functionality
matglas 662c6e6
Update attestation/environment/obfuscate.go
matglas c9c477f
feat: Change to default obfuscate and add cli flags.
matglas 90836fb
chore: Adjust naming to filter envs. Fix tests.
matglas 15ab22d
chore: Making the environment test cases more robust.
matglas ff6f17f
feat: Add exclude-sensitive-key flag.
matglas eca8f62
Update attestation/environment/sensitive_env_vars.go
matglas 51df1d2
chore: Fix tests and command run.
matglas cb158c2
chore: Fix linux tracing in commandrun.
matglas 9bea208
Refactor environment.
matglas 7b01c06
Add new environment to commandrun
matglas c969593
Add license headers
matglas 38ba44c
Fix lint errors
matglas 2d91073
WIP Linux tracing fix
matglas 4298179
Update environment/sensitive_env_vars.go
matglas 486a0f1
Add AttestationContextOption for Environment Caputurer.
matglas 99defd7
Merge branch 'main' into env-obfuscate
matglas b398517
Fix format
matglas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2024 The Witness Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package attestation | ||
|
||
import ( | ||
env "github.com/in-toto/go-witness/environment" | ||
) | ||
|
||
func (ctx *AttestationContext) EnvironmentCapturer() *env.Capture { | ||
return ctx.environmentCapturer | ||
} | ||
|
||
// WithEnvFilterVarsEnabled will make the filter (removing) of vars the acting behavior. | ||
// The default behavior is obfuscation of variables. | ||
func WithEnvFilterVarsEnabled() AttestationContextOption { | ||
return func(a *AttestationContext) { | ||
env.WithFilterVarsEnabled()(a.environmentCapturer) | ||
} | ||
} | ||
|
||
// WithEnvAdditionalKeys add additional keys to final list that is checked for sensitive variables. | ||
func WithEnvAdditionalKeys(additionalKeys []string) AttestationContextOption { | ||
return func(a *AttestationContext) { | ||
env.WithAdditionalKeys(additionalKeys)(a.environmentCapturer) | ||
} | ||
} | ||
|
||
// WithEnvExcludeKeys add additional keys to final list that is checked for sensitive variables. | ||
func WithEnvExcludeKeys(excludeKeys []string) AttestationContextOption { | ||
return func(a *AttestationContext) { | ||
env.WithExcludeKeys(excludeKeys)(a.environmentCapturer) | ||
} | ||
} | ||
|
||
// WithEnvDisableDefaultSensitiveList will disable the default list and only use the additional keys. | ||
func WithEnvDisableDefaultSensitiveList() AttestationContextOption { | ||
return func(a *AttestationContext) { | ||
env.WithDisableDefaultSensitiveList()(a.environmentCapturer) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as a sanity check, we're ensuring backwards compatibility here right? Again, been out of the loop on this last week or two but just asking the questions to ensure that this was all considered 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes backward compatibility on the tracing. But with the side note that we now do not filter anymore but use configuration of the
EnvironmentCapturer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't see a problem with that we can resolve this conversation.