Skip to content

Commit

Permalink
Add Contacts Audit Events (#49755)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Dec 4, 2024
1 parent 9c4e23d commit e2c803b
Show file tree
Hide file tree
Showing 11 changed files with 3,234 additions and 1,977 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 @@ -4687,6 +4687,8 @@ message OneOf {
events.UserTaskUpdate UserTaskUpdate = 189;
events.UserTaskDelete UserTaskDelete = 190;
events.SFTPSummary SFTPSummary = 191;
events.ContactCreate ContactCreate = 192;
events.ContactDelete ContactDelete = 193;
}
}

Expand Down Expand Up @@ -7580,3 +7582,98 @@ message UserTaskDelete {
(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 @@ -2352,3 +2352,11 @@ func (m *AutoUpdateVersionUpdate) TrimToMaxSize(_ int) AuditEvent {
func (m *AutoUpdateVersionDelete) 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 e2c803b

Please sign in to comment.