-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: OB-37389 Obfuscate secrets inside Secret previous configuration
Secret entities not only contain secrets in data, but might also contain an annotation called something like "previous cofiguration", which contains the whole JSON of the previous definition of the Secret itself. This contains also the secrets in plaintext. This commit adds some logic to marshal such "inner" JSON, redact the secrets through the typed object, unmarshal the object back to a JSON string, and then overwrite the annotation with the updated string.
- Loading branch information
1 parent
b6e28d6
commit d442766
Showing
4 changed files
with
139 additions
and
2 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
42 changes: 42 additions & 0 deletions
42
components/processors/observek8sattributesprocessor/testdata/secretEventPrevConfig.json
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,42 @@ | ||
{ | ||
"apiVersion": "v1", | ||
"data": { | ||
"postgres-url": "Tm90IHNvIGVhc3kgbXIgaGFja2VyCg==", | ||
"postgres-url-proxy": "RGFtbiwgWU9VIFJFQUxMWSBUUklFRCEgQ21vbiBub3cuLi4K" | ||
}, | ||
"kind": "Secret", | ||
"metadata": { | ||
"annotations": { | ||
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"postgres-url\":\"Tm90IHNvIGVhc3kgbXIgaGFja2VyCg==\",\"postgres-url-proxy\":\"RGFtbiwgWU9VIFJFQUxMWSBUUklFRCEgQ21vbiBub3cuLi4K\"},\"kind\":\"Secret\",\"metadata\":{\"annotations\":{},\"creationTimestamp\":\"2021-03-18T20:20:00Z\",\"name\":\"postgres-billing-credentials\",\"namespace\":\"o2\",\"resourceVersion\":\"543685028\",\"uid\":\"619570cd-c3da-43b5-a2a3-f85f68860f30\"},\"type\":\"Opaque\"}\n" | ||
}, | ||
"creationTimestamp": "2024-08-14T20:10:30Z", | ||
"managedFields": [ | ||
{ | ||
"apiVersion": "v1", | ||
"fieldsType": "FieldsV1", | ||
"fieldsV1": { | ||
"f:data": { | ||
".": {}, | ||
"f:postgres-url": {}, | ||
"f:postgres-url-proxy": {} | ||
}, | ||
"f:metadata": { | ||
"f:annotations": { | ||
".": {}, | ||
"f:kubectl.kubernetes.io/last-applied-configuration": {} | ||
} | ||
}, | ||
"f:type": {} | ||
}, | ||
"manager": "kubectl-client-side-apply", | ||
"operation": "Update", | ||
"time": "2024-08-14T20:10:30Z" | ||
} | ||
], | ||
"name": "postgres-billing-credentials", | ||
"namespace": "o2", | ||
"resourceVersion": "40105", | ||
"uid": "638c64d7-14e0-4551-bc9f-7f8e7644c8b9" | ||
}, | ||
"type": "Opaque" | ||
} |