Skip to content

Commit

Permalink
Add audit events to Crown Jewel methods (#46641)
Browse files Browse the repository at this point in the history
* Add audit events to Crown Jewel methods

This PR adds the audit events for the crown jewel functionatlity.

Part of gravitational/access-graph#1193

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* fix lint

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
  • Loading branch information
tigrato committed Sep 20, 2024
1 parent 15fcdf4 commit 0324484
Show file tree
Hide file tree
Showing 14 changed files with 3,786 additions and 2,114 deletions.
126 changes: 126 additions & 0 deletions api/proto/teleport/legacy/types/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4380,6 +4380,9 @@ message OneOf {
events.AutoUpdateVersionCreate AutoUpdateVersionCreate = 176;
events.AutoUpdateVersionUpdate AutoUpdateVersionUpdate = 177;
events.AutoUpdateVersionDelete AutoUpdateVersionDelete = 178;
events.CrownJewelCreate CrownJewelCreate = 182;
events.CrownJewelUpdate CrownJewelUpdate = 183;
events.CrownJewelDelete CrownJewelDelete = 184;
}
}

Expand Down Expand Up @@ -6791,3 +6794,126 @@ message AutoUpdateVersionDelete {
(gogoproto.jsontag) = ""
];
}

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

// Status indicates whether the update was successful.
Status Status = 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) = ""
];

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

// CrownJewelQuery is the query used to track the crown jewel.
string CrownJewelQuery = 6 [(gogoproto.jsontag) = "crown_jewel_query"];
}

// CrownJewelUpdate is emitted when a Access Graph CrownJewel is updated.
message CrownJewelUpdate {
// Metadata is a common event metadata
Metadata Metadata = 1 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Status indicates whether the update was successful.
Status Status = 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) = ""
];

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

// CurrentCrownJewelQuery is the current query used to track the crown jewel.
string CurrentCrownJewelQuery = 6 [(gogoproto.jsontag) = "current_crown_jewel_query"];

// UpdatedCrownJewelQuery is the new query used to track the crown jewel.
string UpdatedCrownJewelQuery = 7 [(gogoproto.jsontag) = "updated_crown_jewel_query"];
}

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

// Status indicates whether the update was successful.
Status Status = 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) = ""
];

// ResourceMetadata is a common resource event metadata.
ResourceMetadata resource = 5 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}
12 changes: 12 additions & 0 deletions api/types/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -2231,3 +2231,15 @@ func (m *SPIFFEFederationCreate) TrimToMaxSize(maxSize int) AuditEvent {
func (m *SPIFFEFederationDelete) TrimToMaxSize(maxSize int) AuditEvent {
return m
}
func (m *CrownJewelCreate) TrimToMaxSize(_ int) AuditEvent {
return m
}

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

func (m *CrownJewelDelete) TrimToMaxSize(_ int) AuditEvent {

return m
}
Loading

0 comments on commit 0324484

Please sign in to comment.