-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent "session.start" from being overwritten by "session.exec" #19450
Conversation
The `session.exec` event was not being passed through the session recorder, which resulted in said event having an event index of 0. This caused the original `session.start` event which also has an `eid` of 0 to be overwritten by the `session.exec` event. By emitting the `session.exec` event via the same mechanism as the `session.start` event it gets a proper event index and no longer overwrites the `session.start`. Closes #13622
e3c397c
to
d3e019a
Compare
@@ -436,13 +436,14 @@ func emitExecAuditEvent(ctx *ServerContext, cmd string, execErr error) { | |||
scpEvent.Code = events.SCPDownloadCode | |||
} | |||
} | |||
if err := ctx.srv.EmitAuditEvent(ctx.srv.Context(), scpEvent); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I think the best we can do is add a comment.
// use ctx.srv instead of ctx.session to emit the event to ensure that it gets recorded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments in 70c568e indicating the session emitter is recorded and the context emitter is not.
@rosstimothy See the table below for backport results.
|
) The `session.exec` event was not being passed through the session recorder, which resulted in said event having an event index of 0. This caused the original `session.start` event which also has an `eid` of 0 to be overwritten by the `session.exec` event. By emitting the `session.exec` event via the same mechanism as the `session.start` event it gets a proper event index and no longer overwrites the `session.start`. Closes #13622
The
session.exec
event was not being passed through the session recorder, which resulted in said event having an event index of 0. This caused the originalsession.start
event which also has aneid
of 0 to be overwritten by thesession.exec
event.By emitting the
session.exec
event via the same mechanism as thesession.start
event it gets a proper event index and no longer overwrites thesession.start
.Closes #13622