-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fixes 500 error when using PKI authentication with an incomplete certificate chain #86700
Fixes 500 error when using PKI authentication with an incomplete certificate chain #86700
Conversation
ACK: will review tomorrow |
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.
Code LGTM, but I didn't manage to reproduce this issue in 7.9.3 locally (either I messed up with the certificates somehow or the behavior is different on Linux). Would you mind sharing the temp certificates you used to test this?
valid_to: validTo, | ||
} = peerCertificate; | ||
|
||
let issuerCertType: string; |
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.
nit: would you mind adding a comment here explaining why we do this and what every "type" means?
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.
Done in f2c3f3c.
FWIW, I don't think there is ever a case where a peer certificate has a null issuerCertificate
value. At least, I haven't been able to reproduce that locally.
However, the way the getCertificateChain
method was written previously, if the authentication process made it to this step and the peer certificate was valid but had a null issuerCertificate
value, Kibana would allow the authentication attempt to proceed. I didn't want to change that behavior and potentially introduce a regression, but I can't be sure if we would encounter a null value or not, seeing as we are encountering undefined values when we shouldn't be.
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Distributable file count
History
To update your PR or re-run it, just comment with: |
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.
Looks great, thanks! Used your certificates to confirm the error in 7.9 and that the issue doesn't happen now.
valid_to: validTo, | ||
} = peerCertificate; | ||
|
||
// The issuerCertificate field can be three different values: |
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.
❤️
…ificate chain (elastic#86700) # Conflicts: # x-pack/plugins/security/server/authentication/providers/pki.ts
Fixes #77121.