-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding secrets field and refactoring the logging process. (ovh#667
) * adding secrets field and refactoring the logging process. Adding secrets in the context and creating a function that we can call to hide sensitive data Signed-off-by: Fokion Sotiropoulos <[email protected]> Co-authored-by: Yvonnick Esnault <[email protected]> Signed-off-by: Fokion Sotiropoulos <[email protected]>
- Loading branch information
Showing
13 changed files
with
129 additions
and
20 deletions.
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,18 @@ | ||
package venom | ||
|
||
import ( | ||
"context" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestHideSensitive(t *testing.T) { | ||
ctx := context.Background() | ||
ctx = context.WithValue(ctx, ContextKey("secrets"), []string{"Joe", "Doe"}) | ||
assert.Equal(t, "__hidden__", HideSensitive(ctx, "Joe")) | ||
assert.Equal(t, "__hidden__ tests something", HideSensitive(ctx, "Joe tests something")) | ||
assert.Equal(t, "Dave tests something", HideSensitive(ctx, "Dave tests something")) | ||
assert.Equal(t, "1234", HideSensitive(ctx, 1234)) | ||
assert.Equal(t, "__hidden__!", HideSensitive(ctx, "Doe!")) | ||
assert.Equal(t, "__hidden__ __hidden__", HideSensitive(ctx, "Joe Doe")) | ||
} |
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
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,11 @@ | ||
name: Hide Secret | ||
vars: | ||
name : Tester | ||
secrets: | ||
- name | ||
testcases: | ||
- name: myvar_first | ||
steps: | ||
- type: exec | ||
script: "echo myvar {{.name}}" | ||
|
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