Commit d343b44
committed
Redact password from DatabaseSessionService engine-creation errors
DatabaseSessionService.__init__ embedded the raw db_url in three ValueError
messages raised when engine creation fails (invalid URL argument, missing
driver module, or any other error). A SQLAlchemy URL for a networked backend
carries the password inline, e.g. postgresql+asyncpg://user:password@host/db,
so any of these failures (for example a driver that is not installed) surfaced
the database password verbatim in the exception and in any logs that record it.
Render the URL with hide_password=True before including it in the messages,
falling back to a redacted placeholder when the URL cannot be parsed. The
messages keep the useful dialect/host/database context while no longer exposing
the password.1 parent 4cee97f commit d343b44
1 file changed
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
73 | 89 | | |
74 | 90 | | |
75 | 91 | | |
| |||
284 | 300 | | |
285 | 301 | | |
286 | 302 | | |
| 303 | + | |
287 | 304 | | |
288 | 305 | | |
289 | | - | |
| 306 | + | |
290 | 307 | | |
291 | 308 | | |
292 | 309 | | |
293 | | - | |
| 310 | + | |
294 | 311 | | |
295 | 312 | | |
296 | | - | |
| 313 | + | |
297 | 314 | | |
298 | 315 | | |
299 | 316 | | |
| |||
0 commit comments