The vulnerability lies in the copyDir function in copy_dir.go, which is responsible for copying directories. The function resolves symbolic links but, prior to the patch, did not perform any validation to ensure that the resolved path of the symlink remained within the intended source directory. This created a path traversal vulnerability.
The patch addresses this by adding a check immediately after resolving the symlink. It computes the relative path and verifies that it does not traverse upwards (i.e., contain '..') or point to an absolute path, thus constraining the file operations within the intended directory boundaries.
The GitGetter.fetchSubmodules function in get_git.go was also modified to explicitly set DisableSymlinks = true on the client it uses. This indicates that fetching git submodules was an attack vector that could trigger the vulnerable file copying logic in copyDir. By enabling this flag, the fix is propagated to the submodule handling logic.
The analysis of the fixing commit 87541b2501c00df5eaedea6acc61a2a4a4efa5b7 provides clear evidence of these changes. The core of the vulnerability is in copyDir, and GitGetter.fetchSubmodules is a function that would appear in a runtime profile during an exploit scenario involving git submodules.