mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
redact sensitive output values in run logs
This commit is contained in:
parent
b54017ef83
commit
7b34e3e743
@ -246,7 +246,6 @@ func TestApplyJSON_outputs(t *testing.T) {
|
||||
},
|
||||
"password": map[string]interface{}{
|
||||
"sensitive": true,
|
||||
"value": "horse-battery",
|
||||
"type": "string",
|
||||
},
|
||||
},
|
||||
|
@ -42,10 +42,15 @@ func OutputsFromMap(outputValues map[string]*states.OutputValue) (Outputs, tfdia
|
||||
return nil, diags
|
||||
}
|
||||
|
||||
var redactedValue json.RawMessage
|
||||
if !ov.Sensitive {
|
||||
redactedValue = json.RawMessage(value)
|
||||
}
|
||||
|
||||
outputs[name] = Output{
|
||||
Sensitive: ov.Sensitive,
|
||||
Type: json.RawMessage(valueType),
|
||||
Value: json.RawMessage(value),
|
||||
Value: redactedValue,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,12 +52,10 @@ func TestOutputsFromMap(t *testing.T) {
|
||||
"beep": {
|
||||
Sensitive: true,
|
||||
Type: json.RawMessage(`"string"`),
|
||||
Value: json.RawMessage(`"horse-battery"`),
|
||||
},
|
||||
"blorp": {
|
||||
Sensitive: true,
|
||||
Type: json.RawMessage(`["object",{"a":["object",{"b":["object",{"c":"string"}]}]}]`),
|
||||
Value: json.RawMessage(`{"a":{"b":{"c":"oh, hi"}}}`),
|
||||
},
|
||||
"honk": {
|
||||
Sensitive: false,
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
// This version describes the schema of JSON UI messages. This version must be
|
||||
// updated after making any changes to this view, the jsonHook, or any of the
|
||||
// command/views/json package.
|
||||
const JSON_UI_VERSION = "1.0"
|
||||
const JSON_UI_VERSION = "1.1"
|
||||
|
||||
func NewJSONView(view *View) *JSONView {
|
||||
log := hclog.New(&hclog.LoggerOptions{
|
||||
|
@ -98,7 +98,6 @@ func TestRefreshJSON_outputs(t *testing.T) {
|
||||
},
|
||||
"password": map[string]interface{}{
|
||||
"sensitive": true,
|
||||
"value": "horse-battery",
|
||||
"type": "string",
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user