Skip to content

Commit

Permalink
Add reason and invited fields to SessionStartEvent (#51070) (#51177)
Browse files Browse the repository at this point in the history
In addition to adding the new fields and populating them, this
also updates tsh kube exec to include a --kube-namespace flag similar
to tsh kube login to make the command easier and more intuitive to use.

Closes #51019.
  • Loading branch information
rosstimothy authored Jan 20, 2025
1 parent 07e5f96 commit 1dc4b52
Show file tree
Hide file tree
Showing 6 changed files with 1,113 additions and 990 deletions.
6 changes: 6 additions & 0 deletions api/proto/teleport/legacy/types/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ message SessionStart {
reserved "AccessRequests";
reserved 11;
// reserved jsontag "access_requests"

// Invited is a list of invited users to this session.
repeated string Invited = 12 [(gogoproto.jsontag) = "invited,omitempty"];

// Reason is the reason for starting this session.
string Reason = 13 [(gogoproto.jsontag) = "reason,omitempty"];
}

// SessionJoin emitted when another user joins a session
Expand Down
5 changes: 5 additions & 0 deletions api/types/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ func (m *SessionStart) TrimToMaxSize(maxSize int) AuditEvent {

out := utils.CloneProtoMsg(m)
out.InitialCommand = nil
out.Invited = nil

maxSize = adjustedMaxSize(out, maxSize)

Expand All @@ -303,6 +304,10 @@ func (m *SessionStart) TrimToMaxSize(maxSize int) AuditEvent {

out.InitialCommand = trimStrSlice(m.InitialCommand, maxFieldSize)

customFieldsCount = nonEmptyStrsInSlice(m.Invited)
maxFieldSize = maxSizePerField(maxSize, customFieldsCount)
out.Invited = trimStrSlice(m.Invited, maxFieldSize)

return out
}

Expand Down
Loading

0 comments on commit 1dc4b52

Please sign in to comment.