리포지터리 일관성 검사
Gitaly는 리포지터리 일관성 검사를 실행합니다:
- 리포지터리 검사를 트리거할 때
- 미러링된 리포지터리에서 변경 사항을 가져올 때
- 사용자가 변경 사항을 리포지터리에 푸시할 때
이러한 일관성 검사는 리포지터리에 필요한 모든 객체를 보유하고 있는지, 그리고 이러한 객체가 유효한 객체인지를 확인합니다. 이러한 검사는 다음과 같이 분류될 수 있습니다:
- 리포지터리가 손상되지 않음을 단언하는 기본적인 검사. 이에는 연결성 검사와 객체의 구문을 분석할 수 있는지를 확인하는 검사가 포함됩니다.
- Git의 이전 보안 관련 버그를 악용할 수 있는 객체를 인식하는 보안 검사.
- 모든 객체 메타데이터가 유효한지를 확인하는 코스메틱 검사. 이전 Git 버전 및 다른 Git 구현은 유효하지 않은 메타데이터를 가진 객체를 생성할 수 있지만, 최신 버전은 이러한 형태의 객체를 해석할 수 있습니다.
일관성 검사를 통과하지 못한 유효하지 않은 객체를 제거하려면 리포지터리의 히스토리를 다시 작성해야 하며, 이는 종종 불가능할 수 있습니다. 그러므로, 기본적으로 Gitaly는 리포지터리 일관성에 부정적인 영향을 미치지 않는 일련의 코스메틱 문제를 비활성화합니다.
기본적으로 Gitaly는 기본 또는 보안 관련 검사를 비활성화하지 않으므로 알려진 취약점을 트리거할 수 있는 객체를 배포하지 않습니다. 이는 프로젝트에 악의가 없더라도 해당 객체를 포함하는 리포지터리를 가져오는 능력을 제한합니다.
리포지터리 일관성 검사 재정의
인스턴스 관리자는 일관성 검사를 통과하지 못하는 리포지터리를 처리해야 하는 경우 일관성 검사를 재정의할 수 있습니다.
Linux 패키지 설치의 경우, /etc/gitlab/gitlab.rb
파일을 편집하고 다음 키를 설정합니다(이 예제에서는 hasDotgit
일관성 검사를 비활성화합니다):
-
GitLab 15.10 이후:
ignored_blobs = "/etc/gitlab/instance_wide_ignored_git_blobs.txt" gitaly['configuration'] = { # ... git: { # ... config: [ # 각 줄에 축약되지 않은 SHA-1을 기록한 파일 생성 # 자세한 내용은 https://git-scm.com/docs/git-config#Documentation/git-config.txt-fsckskipList 참조 { key: "fsck.skipList", value: ignored_blobs }, { key: "fetch.fsck.skipList", value: ignored_blobs }, { key: "receive.fsck.skipList", value: ignored_blobs }, { key: "fsck.hasDotgit", value: "ignore" }, { key: "fetch.fsck.hasDotgit", value: "ignore" }, { key: "receive.fsck.hasDotgit", value: "ignore" }, { key: "fsck.missingSpaceBeforeEmail", value: "ignore" }, ], }, }
-
GitLab 15.3부터 GitLab 15.9까지:
ignored_blobs = "/etc/gitlab/instance_wide_ignored_git_blobs.txt" gitaly['gitconfig'] = [ # 각 줄에 축약되지 않은 SHA-1을 기록한 파일 생성 # 자세한 내용은 https://git-scm.com/docs/git-config#Documentation/git-config.txt-fsckskipList 참조 { key: "fsck.skipList", value: ignored_blobs }, { key: "fetch.fsck.skipList", value: ignored_blobs }, { key: "receive.fsck.skipList", value: ignored_blobs }, { key: "fsck.hasDotgit", value: "ignore" }, { key: "fetch.fsck.hasDotgit", value: "ignore" }, { key: "receive.fsck.hasDotgit", value: "ignore" }, { key: "fsck.missingSpaceBeforeEmail", value: "ignore" }, ]
-
GitLab 15.2 이전 (레거시 방법):
ignored_git_errors = [ "hasDotgit = ignore", "missingSpaceBeforeEmail = ignore", ] omnibus_gitconfig['system'] = { # 각 줄에 축약되지 않은 SHA-1을 기록한 파일 생성 # 자세한 내용은 https://git-scm.com/docs/git-config#Documentation/git-config.txt-fsckskipList 참조 "fsck.skipList" => ignored_blobs "fetch.fsck.skipList" => ignored_blobs, "receive.fsck.skipList" => ignored_blobs, "fsck" => ignored_git_errors, "fetch.fsck" => ignored_git_errors, "receive.fsck" => ignored_git_errors, }
자체 컴파일한 설치의 경우, 동등한 작업을 수행하려면 Gitaly 구성 파일(gitaly.toml
)을 편집합니다:
[[git.config]]
key = "fsck.hasDotgit"
value = "ignore"
[[git.config]]
key = "fetch.fsck.hasDotgit"
value = "ignore"
[[git.config]]
key = "receive.fsck.hasDotgit"
value = "ignore"
[[git.config]]
key = "fsck.missingSpaceBeforeEmail"
value = "ignore"
[[git.config]]
key = "fetch.fsck.missingSpaceBeforeEmail"
value = "ignore"
[[git.config]]
key = "receive.fsck.missingSpaceBeforeEmail"
value = "ignore"
[[git.config]]
key = "fsck.skipList"
value = "/etc/gitlab/instance_wide_ignored_git_blobs.txt"
[[git.config]]
key = "fetch.fsck.skipList"
value = "/etc/gitlab/instance_wide_ignored_git_blobs.txt"
[[git.config]]
key = "receive.fsck.skipList"
value = "/etc/gitlab/instance_wide_ignored_git_blobs.txt"
비활성화된 검사
일부 코스메틱 검사가 기본적으로 비활성화되어 있어서 Gitaly가 보안 또는 Gitaly 클라이언트에 영향을 미치지 않는 특정한 손상된 특성을 가진 리포지터리와 계속 작동할 수 있습니다.
일괄 처리 검사의 전체 디렉터리은 Git 문서를 참조하세요.
badTimezone
badTimezone
체크는 Git에서 사용자가 잘못된 시간대로 커밋을 만들도록 하는 버그가 있었기 때문에 비활성화되었습니다. 결과적으로 일부 Git 로그에는 명세와 일치하지 않는 커밋이 포함되어 있습니다. 기본적으로 Gitaly는 packfile을 받으면 fsck
를 실행하므로 이러한 커밋이 포함된 푸시는 거부됩니다.
missingSpaceBeforeDate
missingSpaceBeforeDate
체크는 서명에 메일과 날짜 사이에 공백이 없거나 날짜가 완전히 누락될 때 git-fsck(1)
가 실패하기 때문에 비활성화되었습니다. Git 클라이언트의 오동작을 포함한 다양한 문제로 인해 발생할 수 있습니다.
zeroPaddedFilemode
zeroPaddedFilemode
체크는 이전 Git 버전에서 일부 파일 모드를 0으로 채워 넣었기 때문에 비활성화되었습니다. 예를 들어, 트리 객체가 파일 모드를 040000
으로 인코드하는 대신에 파일 모드가 40000
인 경우가 있었습니다.