Skip to content
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

[v15] Don't emit audit events for illegitimate SAML/OIDC requests #52324

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions lib/auth/auth_with_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -3495,7 +3495,15 @@ func (a *ServerWithRoles) CreateOIDCAuthRequest(ctx context.Context, req types.O

oidcReq, err := a.authServer.CreateOIDCAuthRequest(ctx, req)
if err != nil {
emitSSOLoginFailureEvent(a.CloseContext(), a.authServer.emitter, events.LoginMethodOIDC, err, req.SSOTestFlow)
if trace.IsNotFound(err) {
// This flow is triggered via an unauthenticated endpoint, so it's not unusual to see
// attempts to hit this API with an invalid connector ID. These are not legitimate SSO
// attempts, so avoid cluttering the audit log with them.
log.WithField("connector", req.ConnectorID).Infoln("rejecting invalid OIDC auth request")

} else {
emitSSOLoginFailureEvent(a.CloseContext(), a.authServer.emitter, events.LoginMethodOIDC, err, req.SSOTestFlow)
}
return nil, trace.Wrap(err)
}

Expand Down Expand Up @@ -3649,7 +3657,14 @@ func (a *ServerWithRoles) CreateSAMLAuthRequest(ctx context.Context, req types.S

samlReq, err := a.authServer.CreateSAMLAuthRequest(ctx, req)
if err != nil {
emitSSOLoginFailureEvent(a.CloseContext(), a.authServer.emitter, events.LoginMethodSAML, err, req.SSOTestFlow)
if trace.IsNotFound(err) {
// This flow is triggered via an unauthenticated endpoint, so it's not unusual to see
// attempts to hit this API with an invalid connector ID. These are not legitimate SSO
// attempts, so avoid cluttering the audit log with them.
log.WithField("connector", req.ConnectorID).Infoln("rejecting invalid SAML auth request")
} else {
emitSSOLoginFailureEvent(a.CloseContext(), a.authServer.emitter, events.LoginMethodSAML, err, req.SSOTestFlow)
}
return nil, trace.Wrap(err)
}

Expand Down
Loading