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

implement indeterminate LDAP verification #1574

Merged
merged 7 commits into from
Aug 3, 2023
Merged

implement indeterminate LDAP verification #1574

merged 7 commits into from
Aug 3, 2023

Conversation

rosecodym
Copy link
Collaborator

This PR implements tri-state verification for the LDAP detector. This implementation looks for network errors to explicitly flag as indeterminate, rather than authentication errors to explicitly flag as determinate; this is because the error that occurs from authentication failures doesn't appear to have its own type and I didn't want to have to match on the error message text.

@rosecodym rosecodym requested review from a team July 28, 2023 16:56
pkg/detectors/ldap/ldap.go Outdated Show resolved Hide resolved
pkg/detectors/ldap/ldap.go Show resolved Hide resolved
Comment on lines 68 to 72
err := verifyLDAP(username[1], password[1], ldapURL)
s1.Verified = err == nil
if !isErrDeterminate(err) {
s1.VerificationError = err
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: The s1.Verified = err == nil looks weird, but I'm not sure this is better.

if err := verifyLDAP(username[1], password[1], ldapURL); err == nil {
    s1.Verified = true
} else if !isErrDeterminate(err) {
    s1.VerificationError = err
}

It's technically different behavior since we don't explicitly set s1.Verified = false for the err != nil case.

@rosecodym rosecodym merged commit d763097 into main Aug 3, 2023
9 checks passed
@rosecodym rosecodym deleted the tri-state-ldap branch August 3, 2023 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants