Repository: mealie-recipes/mealie
Pull request: fix: Exclude additional sensitive information from mealie logs
## What type of PR is this?

_(REQUIRED)_
- bug
- cleanup

## What this PR does / why we need it:

_(REQUIRED)_
Add LDAP_QUERY_PASSWORD,  OIDC_CLIENT_ID, and OPENAI_API_KEY to the list of excluded settings when logging.

## Which issue(s) this PR fixes:

_(REQUIRED)_
Fixes #4217

## Testing
Run Mealie and view the logs, you should no longer see the above listed variables printed to the log on startup.


Problem statement:
[BUG] - Mealie exposes sensitive information in log files
I noticed that Mealie excludes some of the sensitive informatin from the logs, but it does not exclude everything; mainly, it's missing LDAP_QUERY_PASSWORD, OIDC_CLIENT_ID, and OPENAI_API_KEY.

I will open a PR to _hopefully_ fix this issue, although this is my first time contributing to Mealie, so if I miss some spots in the code where this info may be leaked, please let me know and I will correct it.

Hints from issue discussion:
You should be able to just add those fields here:

https://github.com/mealie-recipes/mealie/blob/8778559a208d3cdd0332229f4fde6acd4c12f7d4/mealie/app.py#L60-L75
Also, please use the bug template next time: https://github.com/mealie-recipes/mealie/issues/new/choose

Commit message: Add additional values to exclude from logs

Patch to review:
diff --git a/mealie/app.py b/mealie/app.py
index 069d0f7e316..05b6f2025e8 100644
--- a/mealie/app.py
+++ b/mealie/app.py
@@ -63,6 +63,9 @@ async def lifespan_fn(_: FastAPI) -> AsyncGenerator[None, None]:
         settings.model_dump_json(
             indent=4,
             exclude={
+                "LDAP_QUERY_PASSWORD",
+                "OIDC_CLIENT_ID",
+                "OPENAI_API_KEY",
                 "SECRET",
                 "SFTP_PASSWORD",
                 "SFTP_USERNAME",


Code review comments:
diff_hunk: @@ -63,6 +63,9 @@ async def lifespan_fn(_: FastAPI) -> AsyncGenerator[None, None]:
         settings.model_dump_json(
             indent=4,
             exclude={
+                "LDAP_QUERY_PASSWORD",
+                "OIDC_CLIENT_ID",
path: mealie/app.py
text: @user1:
```suggestion
```