-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aws: Fix SDK's suppressing of sensitive API parameters being logged. (#…
…4065) The SDK did not correctly suppress sensitive API parameters via the `String` and `GoString` methods. Updates the SDK's behavior to suppress sensitive API parameters.
- Loading branch information
Showing
4 changed files
with
67 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//go:build go1.7 | ||
// +build go1.7 | ||
|
||
package awsutil | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/aws/aws-sdk-go/aws" | ||
) | ||
|
||
type testPrettifyStruct struct { | ||
Field1 string | ||
Field2 *string | ||
Field3 []byte `sensitive:"true"` | ||
Value []*string | ||
} | ||
|
||
func TestPrettify(t *testing.T) { | ||
cases := map[string]struct { | ||
Value interface{} | ||
Expect string | ||
}{ | ||
"general": { | ||
Value: testPrettifyStruct{ | ||
Field1: "abc123", | ||
Field2: aws.String("abc123"), | ||
Field3: []byte("don't show me"), | ||
Value: []*string{ | ||
aws.String("first"), | ||
aws.String("second"), | ||
}, | ||
}, | ||
Expect: `{ | ||
Field1: "abc123", | ||
Field2: "abc123", | ||
Field3: <sensitive>, | ||
Value: ["first","second"], | ||
}`, | ||
}, | ||
} | ||
|
||
for d, c := range cases { | ||
t.Run(d, func(t *testing.T) { | ||
actual := StringValue(c.Value) | ||
if e, a := c.Expect, actual; e != a { | ||
t.Errorf("expect:\n%v\nactual:\n%v\n", e, a) | ||
} | ||
}) | ||
} | ||
} |
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