diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-05-20 19:06:52 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-05-20 19:12:56 +0300 |
commit | 5844b2d0ddb98c135b7c58531979f268b1b4c4d7 (patch) | |
tree | e136d50583892c9523426b16f354996bc322d7f2 /Makefile | |
parent | 0ee0fc45f6feebae2983cec02494273d91ca485c (diff) |
Makefile: Add canary for tests using outside Git envvars
In order to catch cases early where we do not sanitize Git environment
variables passed to us by the outside, this commit adds a canary to our
Makefile by setting `GIT_DIR=/dev/null` for our tests. If any test does
not sanitize envvars, then our spawned Git commands would pick up this
envvar, assume it as their repository path and (hopefully) end up
failing in a controlled way.
This does indeed detect one case where we spawn Git commands but don't
yet sanitize the environment, which is also getting fixed by this
commit.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -165,6 +165,7 @@ find_go_sources = $(shell find ${SOURCE_DIR} -type d \( -name ruby -o -nam # TEST_OPTIONS: any additional options # TEST_PACKAGES: packages which shall be tested run_go_tests = PATH='${SOURCE_DIR}/internal/testhelper/testdata/home/bin:${PATH}' \ + GIT_DIR=/dev/null \ go test -tags '${GO_BUILD_TAGS}' ${TEST_OPTIONS} ${TEST_PACKAGES} unexport GOROOT |