Skip to content

Unexport dangerous command functions

Paul Okstad (ex-GitLab) requested to merge po-safecmd-unexport into master

Closes #2171 (closed)

This is mostly a mechanical change to prevent using the older command spawning functions that do not support validation. The following commands were run inside the Gitaly repo to un-export various functions:

# gorename doesn't support modules, so use a vendor directory
go mod vendor

GO111MODULE=off gorename -from '"gitlab.com/gitlab-org/gitaly/internal/git".Command' -to unsafeCmd
# Renamed 3 occurrences in 3 files in 1 package.

GO111MODULE=off gorename -from '"gitlab.com/gitlab-org/gitaly/internal/git".BareCommand' -to unsafeBareCmd
# Renamed 6 occurrences in 3 files in 1 package.

GO111MODULE=off gorename -from '"gitlab.com/gitlab-org/gitaly/internal/git".StdinCommand' -to unsafeStdinCmd
# Renamed 2 occurrences in 2 files in 1 package.

GO111MODULE=off gorename -from '"gitlab.com/gitlab-org/gitaly/internal/git".CommandWithoutRepo' -to unsafeCmdWithoutRepo
# Renamed 3 occurrences in 3 files in 1 package.

Originally, I intended to simply lowercase the old function names, but there were conflicts so I prefixed them with unsafe. I also shortened Command to Cmd to reduce variable name length.

Edited by 🤖 GitLab Bot 🤖

Merge request reports

Loading