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

web: don't log unauthenticated requests for index.html #50563

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions lib/web/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,10 @@ func NewHandler(cfg Config, opts ...HandlerOption) (*APIHandler, error) {
h.logger.WarnContext(r.Context(), "Failed to generate CSRF token", "error", err)
}

session, err := h.authenticateWebSession(w, r)
if err != nil {
h.logger.DebugContext(r.Context(), "Could not authenticate", "error", err)
}
// Ignore errors here, as unauthenticated requests for index.html are common - the user might
// not have logged in yet, or their session may have expired.
// The web app will show them the login page in this case.
session, _ := h.authenticateWebSession(w, r)
session.XCSRF = csrfToken

httplib.SetNoCacheHeaders(w.Header())
Expand Down Expand Up @@ -724,7 +724,7 @@ type webSession struct {
}

func (h *Handler) authenticateWebSession(w http.ResponseWriter, r *http.Request) (webSession, error) {
ctx, err := h.AuthenticateRequest(w, r, false)
ctx, err := h.AuthenticateRequest(w, r, false /* validate bearer token */)
if err != nil {
return webSession{}, trace.Wrap(err)
}
Expand Down
Loading