From e158f77f034bd1da822bfffb97e50106f067d126 Mon Sep 17 00:00:00 2001 From: Willie Date: Fri, 29 May 2026 17:04:01 +0800 Subject: [PATCH] fix(init): route --remote through validated git.SetOrAddRemote The CLI addRemote ran a raw "git remote add origin " with the user-supplied URL, sharing the argv flag-smuggling risk just fixed in the git package. Delegate to git.SetOrAddRemote so the --remote flag goes through the same leading-dash rejection and "--" terminator, removing the duplicated exec path. --- cmd/skillshare/init.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/skillshare/init.go b/cmd/skillshare/init.go index acfc564b0..82cf764ed 100644 --- a/cmd/skillshare/init.go +++ b/cmd/skillshare/init.go @@ -1214,9 +1214,10 @@ func setupGitRemote(sourcePath, remoteURL string, dryRun bool) bool { } func addRemote(sourcePath, remoteURL string) bool { - cmd := exec.Command("git", "remote", "add", "origin", remoteURL) - cmd.Dir = sourcePath - if err := cmd.Run(); err != nil { + // SetOrAddRemote validates the URL (rejecting flag-smuggling values that + // begin with "-") and passes "--" before positional args. setupGitRemote + // has already confirmed origin is absent, so this takes the add path. + if err := gitops.SetOrAddRemote(sourcePath, remoteURL); err != nil { ui.Warning("Failed to add remote: %v", err) return false }