feat(authtokens): Add classification to all fields (#1996)
This commit is contained in:
1 parent
d51ce41db8
commit
fc6cddfc7f
8 files changed
+144
-44
No files matched your search
@@ -81,16 +81,13 @@ func TestAuthenticate(t *testing.T) {
|
||||
got := tests_api.CloudEventFromFile(t, eventConfig.AuditEvents.Name())
|
||||
|
||||
// All attribute fields are classified for now.
|
||||
// TODO(johanbrandhorst): revert this when classification is done for auth methods
|
||||
reqDetails := tests_api.GetEventDetails(t, got, "request")
|
||||
tests_api.AssertRedactedValues(t, reqDetails)
|
||||
tests_api.AssertRedactedValues(t, reqDetails["Attrs"])
|
||||
tests_api.AssertRedactedValues(t, reqDetails["Attrs"].(map[string]interface{})["PasswordLoginAttributes"], "password", "login_name")
|
||||
|
||||
respDetails := tests_api.GetEventDetails(t, got, "response")
|
||||
tests_api.AssertRedactedValues(t, respDetails)
|
||||
tests_api.AssertRedactedValues(t, respDetails["Attrs"])
|
||||
tests_api.AssertRedactedValues(t, respDetails["Attrs"].(map[string]interface{})["AuthTokenResponse"], "token", "token_type", "user_id", "account_id", "auth_method_id", "authorized_actions", "id", "scope_id")
|
||||
tests_api.AssertRedactedValues(t, respDetails["Attrs"].(map[string]interface{})["AuthTokenResponse"], "token")
|
||||
|
||||
_ = os.WriteFile(eventConfig.AuditEvents.Name(), nil, 0o666) // clean out audit events from previous calls
|
||||
tok, err = methods.Authenticate(tc.Context(), tc.Server().DevPasswordAuthMethodId, "login", map[string]interface{}{"login_name": "user", "password": "bad-pass"})
|
||||
@@ -100,6 +97,5 @@ func TestAuthenticate(t *testing.T) {
|
||||
|
||||
reqDetails = tests_api.GetEventDetails(t, got, "request")
|
||||
tests_api.AssertRedactedValues(t, reqDetails)
|
||||
tests_api.AssertRedactedValues(t, reqDetails["Attrs"])
|
||||
tests_api.AssertRedactedValues(t, reqDetails["Attrs"].(map[string]interface{})["PasswordLoginAttributes"], "password", "login_name")
|
||||
}
|
||||
@@ -76,16 +76,16 @@ func TestAuthenticate_Tags(t *testing.T) {
|
||||
// TODO(johanbrandhorst): update redaction once typed attributes are available
|
||||
Attrs: &services.AuthenticateResponse_AuthTokenResponse{
|
||||
AuthTokenResponse: &authtokens.AuthToken{
|
||||
AccountId: encrypt.RedactedData,
|
||||
AccountId: "public-account_id",
|
||||
ApproximateLastUsedTime: timestamppb.New(now),
|
||||
AuthMethodId: encrypt.RedactedData,
|
||||
AuthMethodId: "public-auth_method_id",
|
||||
AuthorizedActions: []string{
|
||||
encrypt.RedactedData,
|
||||
"public-authorized_actions",
|
||||
},
|
||||
CreatedTime: timestamppb.New(now),
|
||||
ExpirationTime: timestamppb.New(now),
|
||||
Id: encrypt.RedactedData,
|
||||
ScopeId: encrypt.RedactedData,
|
||||
Id: "public-id",
|
||||
ScopeId: "public-scope_id",
|
||||
Scope: &scopes.ScopeInfo{
|
||||
Id: "public-scope_id",
|
||||
Type: "public-scope_type",
|
||||
@@ -94,7 +94,7 @@ func TestAuthenticate_Tags(t *testing.T) {
|
||||
ParentScopeId: "public-parent_scope_id",
|
||||
},
|
||||
UpdatedTime: timestamppb.New(now),
|
||||
UserId: encrypt.RedactedData,
|
||||
UserId: "public-user_id",
|
||||
Token: encrypt.RedactedData,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user