File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,19 @@ export default (robot, redis = Redis) => {
2121 const redisUrl = process . env [ redisUrlEnv ] || 'redis://localhost:6379'
2222 robot . config = Object . assign ( robot . config || { } , { redisUrl } )
2323 if ( redisUrlEnv ) {
24- robot . logger . info ( `hubot-redis-brain: Discovered redis from ${ redisUrlEnv } environment variable: ${ redisUrl } ` )
24+ // Sanitize password in URL for logging
25+ const sanitizedUrl = ( ( ) => {
26+ try {
27+ const urlObj = new URL ( redisUrl )
28+ if ( urlObj . password ) {
29+ urlObj . password = '*****'
30+ }
31+ return urlObj . toString ( )
32+ } catch {
33+ return redisUrl
34+ }
35+ } ) ( )
36+ robot . logger . info ( `hubot-redis-brain: Discovered redis from ${ redisUrlEnv } environment variable: ${ sanitizedUrl } ` )
2537 } else {
2638 robot . logger . info ( 'hubot-redis-brain: Using default redis on localhost:6379' )
2739 }
You can’t perform that action at this time.
0 commit comments