I would not hold my breath for some kind of ready-made solution on this. Aside from your own logging, you should also be concerned about the logging done by your dependencies. However, you have two areas for work: what is included in the magazines and who has access to the magazines.
For magazines, your best tools to deal with this issue are education and collaboration (including the aforementioned code reviews). Start by writing a list of non-functional requirements for logging, which includes security that takes into account what needs to be recorded and how to register (markers, levels, sensitive parameters, etc.). I recommend working with colleagues to define this list so that it does not become known as "Ravi logging crusade" instead of "something we really need to do."
Once this list is defined and you get the participation of your colleague and / or management, you can write wrappers for logging implementations that support the list of broken registration requirements that you have compiled. If it is really necessary to register sensitive parameters, provide a method for asymmetric encryption of parameters for subsequent retrieval by the root account: for example, the encryption key stored in a file, accessible only to root / container. To manage, you may need to spend some time creating value propositions that describe why your initiative is valuable to your company.
The next work with whoever defines your SLDC is to make sure that the changes to the SDLC are passed inward. Ask them to create a secure coding checklist for your company to implement with 1 paragraph on it, which reads: All logging is implemented using OurCompanySecureLogger. Now you can start work on securing the initiative. I recommend writing a check on the build server that looks at the dependencies and does not complete the build if it finds a direct link to log4j, slf4j, logback, etc.
For the other half of the problem, work with the SysOps team to define separation of duties rules. That is, software developers should not have access to the servers that are logging. If you are not well prepared at this point to support this concept, you may need to be creative.
source share