Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plan name to log messages, and improve logs #101

Merged
merged 2 commits into from
Dec 14, 2023
Merged

Conversation

maxisam
Copy link
Owner

@maxisam maxisam commented Dec 14, 2023

  • log now will indicate if it is a validation error
  • improve security by not using cmd to remove files

@@ -57,27 +57,38 @@
dumpCmd := BuildDumpCmd(archive, plan.Target)
timeout := time.Duration(plan.Scheduler.Timeout) * time.Minute

log.Debugf("dump cmd: %v", strings.Replace(dumpCmd, fmt.Sprintf(`-p "%v"`, plan.Target.Password), "-p xxxx", -1))
log.WithField("plan", plan.Name).Debugf("dump cmd: %v", strings.Replace(dumpCmd, fmt.Sprintf(`-p "%v"`, plan.Target.Password), "-p xxxx", -1))

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by an access to Password
flows to a logging call.
pkg/backup/validate.go Dismissed Show dismissed Hide dismissed
restoreCmd := backup.BuildRestoreCmd(backupPath, plan.Target, plan.Target)
log.Infof("Running restore command with : %v", restoreCmd)
log.WithField("plan", plan.Name).Infof("Running restore command with : %v", restoreCmd)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by an access to Password
flows to a logging call.
pkg/backup/local.go Fixed Show fixed Hide fixed
pkg/backup/local.go Fixed Show fixed Hide fixed
pkg/backup/local.go Fixed Show fixed Hide fixed
sort.Sort(sort.Reverse(sort.StringSlice(files)))
if len(files) > retention {
for _, file := range files[retention:] {
if err := os.Remove(file); err != nil {

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
@maxisam maxisam merged commit b93c780 into main Dec 14, 2023
3 of 4 checks passed
@maxisam maxisam deleted the refactor/show-error branch December 14, 2023 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant