Skip to content

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

Merged
ostefano merged 4 commits into
MISP:masterfrom
TrinityBerserker:fix/ldap-email-field-json-array
Nov 11, 2026
Merged

ostefano merged 4 commits into
MISP:masterfrom
TrinityBerserker:fix/ldap-email-field-json-array

Conversation

@TrinityBerserker

Copy link
Copy Markdown
Contributor

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 Resolved

@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
Contributor 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 Resolved
@ostefano ostefano added the enhancement New feature or request label Oct 27, 2026
@ostefano

ostefano commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@TrinityBerserker please address concerns otherwise I will be closing this.

@TrinityBerserker

Copy link
Copy Markdown
Contributor Author

Hi @ostefano, sorry for the delay. I've just pushed the fix: removed the trailing comma (since it's the last element in the JSON object) and fixed the leading whitespace to match the indentation of the surrounding lines. The changes are up now, let me know if it looks good!

@ostefano

Copy link
Copy Markdown
Collaborator

The leading whitespace is still there.

@TrinityBerserker

Copy link
Copy Markdown
Contributor Author

Hi @ostefano and @righel, I apologize for the delay and for the runaround. I did a deep check and realized I had mixed up the variables and formatting between the Apache and LDAP blocks in my previous commits. I've just pushed a clean fix:

  • Apache block: Now uses APACHESECUREAUTH_LDAP_EMAIL_FIELD correctly as a JSON array without a trailing comma, with the exact indentation.
  • LDAP block: Restored its original variable LDAPAUTH_LDAPEMAILFIELD, formatting, and trailing comma.

All checks are passing and it's ready for review. Let me know if this looks good to merge. Thanks for your patience!

@ostefano
ostefano merged commit 48ec440 into MISP:master Nov 11, 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