Skip to content

Conversation

ethomson
Copy link
Member

Validate that the repository (the .git folder for bare repositories, or its parent, the working directory, for non-bare repositories) is owned by the current user. This prevents a class of attacks where an attacker creates a .git directory in a shared folder (eg /tmp) with a malicious configuration. Other users on the system who run git commands in /tmp would then be vulnerable.

Provide individual file ownership checks for both the current user and
the system user, as well as a combined current user and system user
check.
Ensure that the repository directory is owned by the current user; this
prevents us from opening configuration files that may have been created
by an attacker.
Provide a mock for file ownership for testability.
Test that we prevent opening directories that are not owned by
ourselves.
Pull the global configuration loader out of the symlink check so that it
can be re-used.
Obey the `safe.directory` configuration variable if it is set in the
global or system configuration. (Do not try to load this from the
repository configuration - to avoid malicious repositories that then
mark themselves as safe.)
Introduce the `GIT_OPT_SET_OWNER_VALIDATION` option, so that users can
disable repository ownership validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant