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

fix: if one oidc verifier is failing, do not let the whole API fail #3769

Merged
merged 3 commits into from
Jan 13, 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
7 changes: 5 additions & 2 deletions api/pkg/request/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,15 @@ func MakeVerifierFromConfig(ctx context.Context, cfg *setup.Configuration) OIDCV
for _, provider := range cfg.Auth.Providers {
verifier, err := MakeOIDCProvider(ctx, provider.IssuerURL, provider.ClientID, DefaultClaimsVerifier)
if err != nil {
logrus.Errorf("failed to create OIDC verifier with error: %s", err.Error())
logrus.Warnf("failed to create OIDC verifier with Issuer URL %s and clientID %s with error: %s", provider.IssuerURL, provider.ClientID, err.Error())
continue
}
verifiers = append(verifiers, verifier)
}

if len(verifiers) == 1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fail if zero, and print the number of verifiers otherwise

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should we fail if zero if you initialize it with one already?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm yea I guess that is fine. If none of the OIDC providers configure then no one can talk to it except for Github actions. I guess that is fine. Send it!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the == 1 part, but I added an Infof message to print the # of OIDC verifiers. Hopefully that works!

logrus.Error("only one OIDC verifier configured.")
}
logrus.Infof("%d OIDC verifiers configured", len(verifiers))
return MakeMultiOIDCVerifier(verifiers...)
}

Expand Down
Loading