2023-06-29 16:45:36 +02:00
|
|
|
include::../common/rationale.adoc[]
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2023-06-29 16:45:36 +02:00
|
|
|
include::../common/description.adoc[]
|
|
|
|
|
|
|
|
=== What is the potential impact?
|
|
|
|
|
|
|
|
include::../common/impact.adoc[]
|
|
|
|
|
|
|
|
== How to fix it
|
|
|
|
|
|
|
|
=== Code examples
|
2020-06-30 12:49:37 +02:00
|
|
|
|
2023-06-29 16:45:36 +02:00
|
|
|
include::../common/fix/code-rationale.adoc[]
|
2020-06-30 12:49:37 +02:00
|
|
|
|
2023-06-29 16:45:36 +02:00
|
|
|
==== Noncompliant code example
|
|
|
|
|
|
|
|
[source,python,diff-id=1,diff-type=noncompliant]
|
2020-06-30 12:49:37 +02:00
|
|
|
----
|
|
|
|
import ldap
|
|
|
|
|
|
|
|
def init_ldap():
|
|
|
|
connect = ldap.initialize('ldap://example:1389')
|
|
|
|
|
|
|
|
connect.simple_bind('cn=root') # Noncompliant
|
|
|
|
connect.simple_bind_s('cn=root') # Noncompliant
|
|
|
|
connect.bind_s('cn=root', None) # Noncompliant
|
|
|
|
connect.bind('cn=root', None) # Noncompliant
|
|
|
|
----
|
|
|
|
|
|
|
|
|
2023-06-29 16:45:36 +02:00
|
|
|
==== Compliant solution
|
|
|
|
|
|
|
|
[source,python,diff-id=1,diff-type=compliant]
|
2020-06-30 12:49:37 +02:00
|
|
|
----
|
|
|
|
import ldap
|
|
|
|
import os
|
|
|
|
|
|
|
|
def init_ldap():
|
|
|
|
connect = ldap.initialize('ldap://example:1389')
|
|
|
|
|
2023-06-29 16:45:36 +02:00
|
|
|
connect.simple_bind('cn=root', os.environ.get('LDAP_PASSWORD'))
|
|
|
|
connect.simple_bind_s('cn=root', os.environ.get('LDAP_PASSWORD'))
|
|
|
|
connect.bind_s('cn=root', os.environ.get('LDAP_PASSWORD'))
|
|
|
|
connect.bind('cn=root', os.environ.get('LDAP_PASSWORD'))
|
2020-06-30 12:49:37 +02:00
|
|
|
----
|
|
|
|
|
2023-06-29 16:45:36 +02:00
|
|
|
//=== How does this work?
|
|
|
|
|
|
|
|
//=== Pitfalls
|
|
|
|
|
|
|
|
//=== Going the extra mile
|
|
|
|
|
|
|
|
|
|
|
|
== Resources
|
|
|
|
//=== Documentation
|
|
|
|
|
|
|
|
include::../common/resources/documentation.adoc[]
|
|
|
|
|
|
|
|
//=== Articles & blog posts
|
|
|
|
//=== Conference presentations
|
|
|
|
//=== Standards
|
|
|
|
|
|
|
|
include::../common/resources/standards.adoc[]
|
|
|
|
|
|
|
|
//=== Benchmarks
|
2023-06-22 10:38:01 +02:00
|
|
|
|
2021-09-20 15:38:42 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== Message
|
|
|
|
|
|
|
|
Provide a password when authenticating to this LDAP server.
|
|
|
|
|
2021-09-20 15:38:42 +02:00
|
|
|
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|