Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion controllers/util/backup_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ func EnsureDirectoryForBackup(solrCloud *solr.SolrCloud, backupRepository *solr.
// Directory creation only required/possible for volume (i.e. local) backups
if IsRepoVolume(backupRepository) {
backupPath := BackupLocationPath(backupRepository, backup.Spec.Location)
// Exec mkdir directly (argv form) rather than through "/bin/bash -c".
// backupPath is derived from the user-controlled SolrBackup.spec.location;
// passing it through a shell allowed command injection. As a discrete argv
// element it is treated as a literal path and shell metacharacters are inert.
return RunExecForPod(
solrCloud.GetAllSolrPodNames()[0],
solrCloud.Namespace,
[]string{"/bin/bash", "-c", "mkdir -p " + backupPath},
[]string{"mkdir", "-p", backupPath},
config,
)
}
Expand Down
Loading