Skip to content

Commit df6a098

Browse files
fix(k8s): retain conjur-map key in SecretSelectedFields and tests
- Add conjur-map to SecretSelectedFields to allow mapping secrets to Conjur - Update tests to verify conjur-map is retained and extra keys are removed - Reference Conjur documentation for context on conjur-map usage Fixes: https://venafi.atlassian.net/browse/VC-43052 Signed-off-by: Richard Wall <richard.wall@cyberark.com>
1 parent 880bfbf commit df6a098

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

docs/datagatherers/k8s-dynamic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Secrets can be gathered using the following config:
7777
resource: secrets
7878
```
7979

80-
Before Secrets are sent to the Preflight backend, they are redacted so no secret data is transmitted. See [`fieldfilter.go`](./../../pkg/datagatherer/k8s/fieldfilter.go) to see the details of which fields are filteres and which ones are redacted.
80+
Before Secrets are sent to the Preflight backend, they are redacted so no secret data is transmitted. See [`fieldfilter.go`](./../../pkg/datagatherer/k8s/fieldfilter.go) to see the details of which fields are filtered and which ones are redacted.
8181

8282
> **All resource other than Kubernetes Secrets are sent in full, so make sure that you don't store secret information on arbitrary resources.**
8383

pkg/datagatherer/k8s/fieldfilter.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import (
99
// The `data` is redacted, to prevent private keys or sensitive data being
1010
// collected. Only the following none-sensitive keys are retained: tls.crt,
1111
// ca.crt. These keys are assumed to always contain public TLS certificates.
12+
// The `conjur-map` key is also retained, as it is used to map Secrets to
13+
// Conjur variables, and is not considered sensitive.
14+
// See https://docs.cyberark.com/conjur-open-source/latest/en/content/integrations/k8s-ocp/cjr-secrets-provider-lp.htm
1215
var SecretSelectedFields = []FieldPath{
1316
{"kind"},
1417
{"apiVersion"},
@@ -26,6 +29,7 @@ var SecretSelectedFields = []FieldPath{
2629
{"type"},
2730
{"data", "tls.crt"},
2831
{"data", "ca.crt"},
32+
{"data", "conjur-map"},
2933
}
3034

3135
// RouteSelectedFields is the list of fields sent from OpenShift Route objects to the

pkg/datagatherer/k8s/fieldfilter_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ func TestSelect(t *testing.T) {
3535
},
3636
"type": "kubernetes.io/tls",
3737
"data": map[string]interface{}{
38-
"tls.crt": "cert data",
39-
"tls.key": "secret",
38+
"tls.crt": "cert data",
39+
"tls.key": "secret",
40+
"extra": "should be removed",
41+
"conjur-map": "should be kept",
4042
},
4143
},
4244
SecretSelectedFields,
@@ -61,7 +63,8 @@ func TestSelect(t *testing.T) {
6163
"type": "kubernetes.io/tls",
6264
"data": map[string]interface{}{
6365
// The "tls.key" is ignored.
64-
"tls.crt": "cert data",
66+
"tls.crt": "cert data",
67+
"conjur-map": "should be kept",
6568
},
6669
},
6770
))

0 commit comments

Comments
 (0)