Skip to content

Commit 3557d41

Browse files
committed
secretsource: some improvement to comments for extension authors
1 parent 6737abd commit 3557d41

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

secretsource/extension.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import (
77
"go.k6.io/k6/lib/fsext"
88
)
99

10-
// Constructor returns an instance of an output extension module.
10+
// Constructor returns an instance of a secret source extension module.
11+
// This should return an instance of [Source] given the parameters.
12+
// The Secret Source should not log its secrets and any returned secret will be cached and redacted
13+
// by the [Manager]. No additional work needs to be done by the Secret source apart from retrieving
14+
// the secret.
1115
type Constructor func(Params) (Source, error)
1216

1317
// Params contains all possible constructor parameters an output may need.

secretsource/hook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ func recursiveReplace(v any, replacer *strings.Replacer) any {
6565
return v
6666
}
6767
return fmt.Sprintf("Had a logrus.fields value with type %T, "+
68-
"please report that this is unsupported and will be redacted in all logs in case it containing secrets", v)
68+
"please report that this is unsupported and will be redacted in all logs in case it contains secrets", v)
6969
}

secretsource/interface.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ package secretsource
44
type Source interface {
55
// Human readable description to be printed on the cli
66
Description() string
7+
// Get retrives the value for a given key and returns it.
8+
// Logging the value before it is returned is going to lead to it being leaked.
9+
// The error might lead to an exception visible to users.
710
Get(key string) (value string, err error)
811
}

0 commit comments

Comments
 (0)