Skip to content

Commit

Permalink
Sanitize Git remote URLs on the server side
Browse files Browse the repository at this point in the history
It's safer than doing it on the client side (e.g. Flux users can be restricted
to only port-forwarding to the Flux pod, not allowing them to see the git remote
password).
  • Loading branch information
2opremio committed Jan 13, 2020
1 parent ab466af commit 327a142
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/fluxctl/sync_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ func (opts *syncOpts) RunE(cmd *cobra.Command, args []string) error {
case git.RepoReady:
break
default:
return fmt.Errorf("git repository %s is not ready to sync (status: %s)", gitConfig.Remote.SafeURL(), string(gitConfig.Status))
return fmt.Errorf("git repository %s is not ready to sync (status: %s)", gitConfig.Remote.URL, string(gitConfig.Status))
}

fmt.Fprintf(cmd.OutOrStderr(), "Synchronizing with %s\n", gitConfig.Remote.SafeURL())
fmt.Fprintf(cmd.OutOrStderr(), "Synchronizing with %s\n", gitConfig.Remote.URL)

updateSpec := update.Spec{
Type: update.Sync,
Expand Down
2 changes: 2 additions & 0 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,8 @@ func (d *Daemon) GitRepoConfig(ctx context.Context, regenerate bool) (v6.GitConf
}

origin := d.Repo.Origin()
// Sanitize the URL before sharing it
origin.URL = origin.SafeURL()
status, _ := d.Repo.Status()
path := ""
if len(d.GitConfig.Paths) > 0 {
Expand Down

0 comments on commit 327a142

Please sign in to comment.