Skip to content

Commit

Permalink
[v16] Add Contacts Audit Events (#50548)
Browse files Browse the repository at this point in the history
* Add Contacts Audit Events (#49755)

* Add Contact resource; include it in default editor permissions and web ACL

* Add contacts to ACL test

* Improve godocs

Co-authored-by: Zac Bergquist <[email protected]>

* Add `contact` to the web user context

* Add contact audit events

* Lint fix

* Use string interpolation

Co-authored-by: Grzegorz Zdunek <[email protected]>

* Comment ContactType enum

* make grpc

---------

Co-authored-by: Zac Bergquist <[email protected]>
Co-authored-by: Grzegorz Zdunek <[email protected]>

* Blank line at the end of proto file

---------

Co-authored-by: Zac Bergquist <[email protected]>
Co-authored-by: Grzegorz Zdunek <[email protected]>
  • Loading branch information
3 people authored Dec 23, 2024
1 parent 8fa540d commit 4af5a9e
Show file tree
Hide file tree
Showing 11 changed files with 2,735 additions and 1,478 deletions.
97 changes: 97 additions & 0 deletions api/proto/teleport/legacy/types/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4635,6 +4635,8 @@ message OneOf {
events.UserTaskCreate UserTaskCreate = 188;
events.UserTaskUpdate UserTaskUpdate = 189;
events.UserTaskDelete UserTaskDelete = 190;
events.ContactCreate ContactCreate = 192;
events.ContactDelete ContactDelete = 193;
events.WorkloadIdentityCreate WorkloadIdentityCreate = 194;
events.WorkloadIdentityUpdate WorkloadIdentityUpdate = 195;
events.WorkloadIdentityDelete WorkloadIdentityDelete = 196;
Expand Down Expand Up @@ -7672,3 +7674,98 @@ message UserLoginAccessListInvalid {
(gogoproto.jsontag) = ""
];
}

// ContactCreate is emitted when a contact is created.
message ContactCreate {
// Metadata is a common event metadata
Metadata Metadata = 1 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ResourceMetadata is a common resource event metadata
ResourceMetadata Resource = 2 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// User is a common user event metadata
UserMetadata User = 3 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ConnectionMetadata holds information about the connection
ConnectionMetadata Connection = 4 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Status indicates whether the creation was successful.
Status Status = 5 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Email is the Email of the contact being deleted
string Email = 6 [(gogoproto.jsontag) = "email"];

// ContactType is the type of the contact being deleted ('Business' or 'Security')
ContactType ContactType = 7 [(gogoproto.jsontag) = "contact_type"];
}

// ContactDelete is emitted when a contact is deleted.
message ContactDelete {
// Metadata is a common event metadata
Metadata Metadata = 1 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ResourceMetadata is a common resource event metadata
ResourceMetadata Resource = 2 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// User is a common user event metadata
UserMetadata User = 3 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ConnectionMetadata holds information about the connection
ConnectionMetadata Connection = 4 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Status indicates whether the deletion was successful.
Status Status = 5 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Email is the Email of the contact being deleted
string Email = 6 [(gogoproto.jsontag) = "email"];

// ContactType is the type of the contact being deleted ('Business' or 'Security')
ContactType ContactType = 7 [(gogoproto.jsontag) = "contact_type"];
}

// ContactType is the type of contact being added.
enum ContactType {
CONTACT_TYPE_UNSPECIFIED = 0;
CONTACT_TYPE_BUSINESS = 1;
CONTACT_TYPE_SECURITY = 2;
}
8 changes: 8 additions & 0 deletions api/types/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -2387,3 +2387,11 @@ func (m *WorkloadIdentityUpdate) TrimToMaxSize(maxSize int) AuditEvent {
func (m *WorkloadIdentityDelete) TrimToMaxSize(_ int) AuditEvent {
return m
}

func (m *ContactCreate) TrimToMaxSize(_ int) AuditEvent {
return m
}

func (m *ContactDelete) TrimToMaxSize(_ int) AuditEvent {
return m
}
Loading

0 comments on commit 4af5a9e

Please sign in to comment.