Skip to content

Commit

Permalink
Use OriginalURL insead of CloneAddr in migration logging (#9418)
Browse files Browse the repository at this point in the history
CloneAddr will contain username and password credentials and they will
get stored in system notices about failed migrations (and logs if trace
is set). Replace with OriginalURL that doesn't have those.
  • Loading branch information
mrsdizzie authored and techknowlogick committed Dec 18, 2019
1 parent 21f84a6 commit d644934
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/migrations/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func MigrateRepository(ctx context.Context, doer *models.User, ownerName string,
opts.PullRequests = false
opts.GitServiceType = structs.PlainGitService
downloader = NewPlainGitDownloader(ownerName, opts.RepoName, opts.CloneAddr)
log.Trace("Will migrate from git: %s", opts.CloneAddr)
log.Trace("Will migrate from git: %s", opts.OriginalURL)
} else if opts.GitServiceType == structs.NotMigrated {
opts.GitServiceType = theFactory.GitServiceType()
}
Expand All @@ -77,7 +77,7 @@ func MigrateRepository(ctx context.Context, doer *models.User, ownerName string,
log.Error("rollback failed: %v", err1)
}

if err2 := models.CreateRepositoryNotice(fmt.Sprintf("Migrate repository from %s failed: %v", opts.CloneAddr, err)); err2 != nil {
if err2 := models.CreateRepositoryNotice(fmt.Sprintf("Migrate repository from %s failed: %v", opts.OriginalURL, err)); err2 != nil {
log.Error("create respotiry notice failed: ", err2)
}
return nil, err
Expand Down

0 comments on commit d644934

Please sign in to comment.