From f0549f76491c02818d2e11a9df2037f0cfe190a9 Mon Sep 17 00:00:00 2001 From: rhit-silkaijr Date: Mon, 6 Oct 2025 22:49:42 -0400 Subject: [PATCH 1/5] Redacting usernames from logged paths via regex string --- cli/profiles.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/profiles.go b/cli/profiles.go index 2ebd584..2420c58 100644 --- a/cli/profiles.go +++ b/cli/profiles.go @@ -7,6 +7,7 @@ import ( "log/slog" "os" "path/filepath" + "regexp" "strings" resolver "github.com/satisfactorymodding/ficsit-resolver" @@ -173,8 +174,8 @@ func (p *Profiles) Save() error { } profilesFile := filepath.Join(viper.GetString("local-dir"), viper.GetString("profiles-file")) - - slog.Info("saving profiles", slog.String("path", profilesFile)) + re := regexp.MustCompile(`(Users\\).*(\\)`) + slog.Info("saving profiles", slog.String("path", re.ReplaceAllString(profilesFile, `Users\\*****\\`))) profilesJSON, err := json.MarshalIndent(p, "", " ") if err != nil { From ed71acc41a7229c4b26d47f3226b9f0ce7375cd3 Mon Sep 17 00:00:00 2001 From: rhit-silkaijr Date: Tue, 7 Oct 2025 11:35:44 -0400 Subject: [PATCH 2/5] Trying single " --- cli/profiles.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/profiles.go b/cli/profiles.go index 2420c58..27dd311 100644 --- a/cli/profiles.go +++ b/cli/profiles.go @@ -175,7 +175,7 @@ func (p *Profiles) Save() error { profilesFile := filepath.Join(viper.GetString("local-dir"), viper.GetString("profiles-file")) re := regexp.MustCompile(`(Users\\).*(\\)`) - slog.Info("saving profiles", slog.String("path", re.ReplaceAllString(profilesFile, `Users\\*****\\`))) + slog.Info("saving profiles", slog.String("path", re.ReplaceAllString(profilesFile, `Users\*****\`))) profilesJSON, err := json.MarshalIndent(p, "", " ") if err != nil { From 76a12983acbc92eac3e633736b620f48e1b389be Mon Sep 17 00:00:00 2001 From: rhit-silkaijr Date: Tue, 4 Nov 2025 16:52:17 -0500 Subject: [PATCH 3/5] Handling Unix case --- cli/profiles.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cli/profiles.go b/cli/profiles.go index 27dd311..4af55b9 100644 --- a/cli/profiles.go +++ b/cli/profiles.go @@ -175,7 +175,9 @@ func (p *Profiles) Save() error { profilesFile := filepath.Join(viper.GetString("local-dir"), viper.GetString("profiles-file")) re := regexp.MustCompile(`(Users\\).*(\\)`) - slog.Info("saving profiles", slog.String("path", re.ReplaceAllString(profilesFile, `Users\*****\`))) + interimString := re.ReplaceAllString(profilesFile, `Users\*****\`) + re := regexp.MustCompile(`(home/).*(/)`) + slog.Info("saving profiles", slog.String("path", re.ReplaceAllString(profilesFile, `home/*****/`))) profilesJSON, err := json.MarshalIndent(p, "", " ") if err != nil { From 380dbae84fed38edd3b2785271282e0ceddcbddd Mon Sep 17 00:00:00 2001 From: rhit-silkaijr Date: Tue, 4 Nov 2025 16:55:09 -0500 Subject: [PATCH 4/5] Fixing string usage --- cli/profiles.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/profiles.go b/cli/profiles.go index 4af55b9..ab06262 100644 --- a/cli/profiles.go +++ b/cli/profiles.go @@ -177,7 +177,7 @@ func (p *Profiles) Save() error { re := regexp.MustCompile(`(Users\\).*(\\)`) interimString := re.ReplaceAllString(profilesFile, `Users\*****\`) re := regexp.MustCompile(`(home/).*(/)`) - slog.Info("saving profiles", slog.String("path", re.ReplaceAllString(profilesFile, `home/*****/`))) + slog.Info("saving profiles", slog.String("path", re.ReplaceAllString(interimString, `home/*****/`))) profilesJSON, err := json.MarshalIndent(p, "", " ") if err != nil { From bca80b1b26e61474e4ddf3170b0539a79b9e0593 Mon Sep 17 00:00:00 2001 From: rhit-silkaijr Date: Tue, 4 Nov 2025 17:00:30 -0500 Subject: [PATCH 5/5] fixing lint --- cli/profiles.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/profiles.go b/cli/profiles.go index ab06262..e1447f8 100644 --- a/cli/profiles.go +++ b/cli/profiles.go @@ -176,8 +176,8 @@ func (p *Profiles) Save() error { profilesFile := filepath.Join(viper.GetString("local-dir"), viper.GetString("profiles-file")) re := regexp.MustCompile(`(Users\\).*(\\)`) interimString := re.ReplaceAllString(profilesFile, `Users\*****\`) - re := regexp.MustCompile(`(home/).*(/)`) - slog.Info("saving profiles", slog.String("path", re.ReplaceAllString(interimString, `home/*****/`))) + re2 := regexp.MustCompile(`(home/).*(/)`) + slog.Info("saving profiles", slog.String("path", re2.ReplaceAllString(interimString, `home/*****/`))) profilesJSON, err := json.MarshalIndent(p, "", " ") if err != nil {