Skip to content

Fix: Ensure ldapEmailField is formatted as a JSON array - #484

Open
TrinityBerserker wants to merge 2 commits into
MISP:masterfrom
TrinityBerserker:fix/ldap-email-field-json-array
Open

TrinityBerserker wants to merge 2 commits into
MISP:masterfrom
TrinityBerserker:fix/ldap-email-field-json-array

Conversation

@TrinityBerserker

Copy link
Copy Markdown

This PR fixes the JSON generation for ldapEmailField in configure_misp.sh. The value was being processed as a raw string, but the LdapAuth plugin expects an array. The fix wraps the value in brackets and quotes to ensure a valid JSON array is generated.

Verification:
I tested this locally by running the Docker setup with LDAPAUTH_ENABLE=true and LDAPAUTH_LDAPEMAILFIELD="mail". The previous error Provided new config is not array, NULL given no longer appears in the logs, and the configuration is generated correctly.

Fixes #287

Comment thread core/files/configure_misp.sh Outdated
\"ldapDefaultOrg\": \"${APACHESECUREAUTH_LDAP_DEFAULT_ORG}\",
\"ldapAllowReferrals\": ${APACHESECUREAUTH_LDAP_OPT_REFERRALS},
\"ldapEmailField\": ${APACHESECUREAUTH_LDAP_EMAIL_FIELD}
\"ldapEmailField": [\"${LDAPAUTH_LDAPEMAILFIELD}\"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing backslash escaping the ldapEmailField last double quote

@ostefano ostefano left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is wrong. the field is APACHESECUREAUTH_LDAP_EMAIL_FIELD but you are using the LDAPAUTH_LDAPEMAILFIELD env var.

@TrinityBerserker

Copy link
Copy Markdown
Author

Thanks for the review @righel and @ostefano! I've fixed both issues: updated the env var to APACHESECUREAUTH_LDAP_EMAIL_FIELD and added the missing backslash escaping for the JSON key. Let me know if it looks good now!

@ostefano ostefano left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

See comment

Comment thread core/files/configure_misp.sh
@ostefano ostefano added the enhancement New feature or request label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: LDAP configuration via environment variables fails due to incorrect JSON generation for ldapEmailField

3 participants