Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DEFAULT_WORKSPACE path to git safe.directory by default #1770

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-linter.yml file, or with `oxsecurity/megalinter:beta` docker image

- Set DEFAULT_WORKSPACE as git safe directory per default [#1766](https://github.com/oxsecurity/megalinter/issues/1766)
- Update pre-commit hooks from v5 to v6 ([#1755](https://github.com/oxsecurity/megalinter/issues/1755)).
- Fix version in URL in logs produced by reporters
- Improve documentation for TAP_REPORTER
Expand Down
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ if [[ ${LOG_LEVEL} == "DEBUG" ]]; then
fi

# Manage newest git versions (related to CVE https://github.blog/2022-04-12-git-security-vulnerability-announced/)
#
if [[ "${WORKSPACE_AS_SAFE_DIR}" != 'false' && "${DEFAULT_WORKSPACE}" && -d "${DEFAULT_WORKSPACE}" ]] ; then
echo "Setting git safe.directory DEFAULT_WORKSPACE: ${DEFAULT_WORKSPACE} ..."
git config --global --add safe.directory "${DEFAULT_WORKSPACE}"
else
echo "Skipped setting git safe.directory DEFAULT_WORKSPACE: ${DEFAULT_WORKSPACE} ..."
fi

if [ -z ${GITHUB_WORKSPACE+x} ]; then
echo "Setting git safe.directory default: /github/workspace ..."
git config --global --add safe.directory /github/workspace
else
echo "Setting git safe.directory GITHUB_WORKSPACE: $GITHUB_WORKSPACE ..."
git config --global --add safe.directory "$GITHUB_WORKSPACE"
fi

echo "Setting git safe.directory to /tmp/lint ..."
git config --global --add safe.directory /tmp/lint

Expand Down