Suppress error messages / LDAP test

Problem:
Hello,
I am looking a way to suppress error message while testing specific options in Authentication Sources. Recently we have been advised by pentest team to make error message less verbose while testing connection in LDAP config tab or with api.

“The application uses the built-in functionality of the test LDAP connection to connect to a selected host on a given port. Due to the lack of generic server responses, it is possible to distinguish the reason for the connection failure - which enables the implementation of a simple port scanner of the infrastructure accessible from the servers perspective.”

{"message":"ERF50-1006 [Foreman::WrappedException]: Unable to connect to LDAP server ([Errno::ECONNREFUSED]: Connection refused - connect(2) for 127.0.0.1:2222)"}

Expected outcome:
Less detailed output without hostname and port.

Foreman and Proxy versions:
Foreman 2.4.0-1

The test connection button is only available for users permitted to define LDAP authentication sources. As such, such users should only be those with the highest trust levels - as defining a malicious LDAP source can lead to unauthorized access to the Foreman system leading to much more significant issues than a network scan. If a user is not trusted, they should not have permission to define LDAP sources.

Obfuscation of error messages does not increase security, it only makes debugging of actual problems more difficult.
The hostname and port output in the error message are the one defined by the user that configured the LDAP source, so they are not in any way disclosing sensitive information.

In the future, please report any security concerns to our security team at foreman-security@googlegroups.com and do not post them on a public forum.

Thank you for your reply. I understand your point of view, however organizations are different and sometimes making custom changes in application can serve other purposes. Like in my case being compliant with security requirements.
Nevertheless I was able to change error output to less descriptive one. This thread can be closed and removed.