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

Add client ID to OIDC error logs #7931

Open
3 tasks
muhlemmer opened this issue May 8, 2024 · 0 comments
Open
3 tasks

Add client ID to OIDC error logs #7931

muhlemmer opened this issue May 8, 2024 · 0 comments
Labels
auth enhancement New feature or request

Comments

@muhlemmer
Copy link
Contributor

Currently when an auth request results in an error and the error is returned to the client or browser, log lines like the following are omitted:

time=2024-05-08T14:24:08.722Z level=WARN msg="request error" oidc_error.description="The requested redirect_uri is missing in the client configuration. If you have any questions, you may contact the administrator of the application." oidc_error.type=invalid_request oidc_error.redirect_disabled=true status_code=400

This misses context like the client ID, making errors harder to debug.

As an operator I would like to understand which OIDC client / application is creating Auth Request errors.

Acceptance criteria

  • Auth request error logs contain client ID
  • Auth request error logs contain instance ID and/or issuer domain
  • Do we need organization ID?

Additional info

op.AuthRequestError is the general function that writes an HTTP response to the browser (either as printed message or redirect to the client). That function also omits the error logs. Passed AuthRequest may implement the optional op.LogAuthRequest interface which can return logging values. oidc.AuthRequest.LogValue() is an example of an implementation:

func (a *AuthRequest) LogValue() slog.Value {
	return slog.GroupValue(
		slog.Any("scopes", a.Scopes),
		slog.String("response_type", string(a.ResponseType)),
		slog.String("client_id", a.ClientID),
		slog.String("redirect_uri", a.RedirectURI),
	)
}

Note that zitadel uses its own implementations of AuthRequest which will need to receive this method.

@muhlemmer muhlemmer added auth enhancement New feature or request labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth enhancement New feature or request
Projects
Status: 🔖 Ready
Development

No branches or pull requests

1 participant