File tree Expand file tree Collapse file tree 7 files changed +16
-49
lines changed
Expand file tree Collapse file tree 7 files changed +16
-49
lines changed Original file line number Diff line number Diff line change 1+ ### Fixed
2+
3+ - Fixed a case where ggshield commit parser could fail because of the local git configuration.
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -euo pipefail
3- # AUTOGENERATED FILE, DO NOT EDIT!
4- # This file has been generated by the `action-entrypoint-generator` script
5- # defined in `scripts/action-entrypoint-generator`. To make changes to this
6- # file, modify the script and rerun it.
7-
8-
9- # Mark the current directory as safe. If we don't do this, git commands fail
10- # because the source in $PWD is owned by a different user than our `app` user.
11- git config --global --add safe.directory " $PWD "
12-
13-
143args=(" $@ " )
15- ggshield iac scan ci ${args[@]}
4+ exec /app/docker/entrypoint.sh ggshield iac scan ci ${args[@]}
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -euo pipefail
3- # AUTOGENERATED FILE, DO NOT EDIT!
4- # This file has been generated by the `action-entrypoint-generator` script
5- # defined in `scripts/action-entrypoint-generator`. To make changes to this
6- # file, modify the script and rerun it.
7-
8-
9- # Mark the current directory as safe. If we don't do this, git commands fail
10- # because the source in $PWD is owned by a different user than our `app` user.
11- git config --global --add safe.directory " $PWD "
12-
13-
143args=(" $@ " )
15- ggshield sca scan ci -v ${args[@]}
4+ exec /app/docker/entrypoint.sh ggshield sca scan ci -v ${args[@]}
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -euo pipefail
3- # AUTOGENERATED FILE, DO NOT EDIT!
4- # This file has been generated by the `action-entrypoint-generator` script
5- # defined in `scripts/action-entrypoint-generator`. To make changes to this
6- # file, modify the script and rerun it.
7-
8-
9- # Mark the current directory as safe. If we don't do this, git commands fail
10- # because the source in $PWD is owned by a different user than our `app` user.
11- git config --global --add safe.directory " $PWD "
12-
13-
143args=(" $@ " )
15- ggshield secret scan -v ${args[@]} ci
4+ exec /app/docker/entrypoint.sh ggshield secret scan -v ${args[@]} ci
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -euo pipefail
33
4+ export GG_GIT_CONFIG=/tmp/ggshield-git-config
5+
46# Mark the current directory as safe. If we don't do this, git commands fail
57# because the source in $PWD is owned by a different user than our `app` user.
6- git config --global --add safe.directory " $PWD "
8+ #
9+ # We use our own git config because ggshield ignores the global git configuration file.
10+ git config --file " $GG_GIT_CONFIG " --add safe.directory " $PWD "
711
812exec " $@ "
Original file line number Diff line number Diff line change @@ -189,7 +189,12 @@ def git(
189189) -> str :
190190 """Calls git with the given arguments, returns stdout as a string"""
191191 env = os .environ .copy ()
192+ # Ensure git messages are in English
192193 env ["LANG" ] = "C"
194+ # Ensure git behavior is not affected by the user git configuration, but give us a
195+ # way to set some configuration (useful for safe.directory)
196+ env ["GIT_CONFIG_GLOBAL" ] = os .getenv ("GG_GIT_CONFIG" , "" )
197+ env ["GIT_CONFIG_SYSTEM" ] = ""
193198
194199 if cwd is None :
195200 cwd = Path .cwd ()
Original file line number Diff line number Diff line change @@ -75,18 +75,6 @@ def is_windows():
7575"""
7676
7777
78- @pytest .fixture (scope = "session" , autouse = True )
79- def isolated_git ():
80- """
81- Don't use any of the existing Git config
82-
83- NOTE: As the fixture is scoped to the session we don't have to restore the
84- original values.
85- """
86- os .environ ["GIT_CONFIG_GLOBAL" ] = ""
87- os .environ ["GIT_CONFIG_SYSTEM" ] = ""
88-
89-
9078@pytest .fixture (autouse = True )
9179def do_not_use_real_user_dirs (monkeypatch , tmp_path ):
9280 """
You can’t perform that action at this time.
0 commit comments