diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-29 22:31:31 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-29 22:31:31 +0300 |
commit | e810b8327513c3b07cb779dbce6c75dbcb49ca84 (patch) | |
tree | 65b220240faa9e191388c6ab233fed03da2b8713 /lib/gitlab | |
parent | 11e9b7b58837da351f08c18e6f0f4faba4d7d301 (diff) |
Add latest changes from gitlab-org/security/gitlab@13-1-stable-ee
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/import_export/snippet_repo_restorer.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/gitlab/import_export/snippet_repo_restorer.rb b/lib/gitlab/import_export/snippet_repo_restorer.rb index 334d13a13ae..31b1a37bbe1 100644 --- a/lib/gitlab/import_export/snippet_repo_restorer.rb +++ b/lib/gitlab/import_export/snippet_repo_restorer.rb @@ -3,7 +3,7 @@ module Gitlab module ImportExport class SnippetRepoRestorer < RepoRestorer - attr_reader :snippet + attr_reader :snippet, :user SnippetRepositoryError = Class.new(StandardError) @@ -33,6 +33,16 @@ module Gitlab def create_repository_from_bundle repository.create_from_bundle(path_to_bundle) snippet.track_snippet_repository(repository.storage) + + response = Snippets::RepositoryValidationService.new(user, snippet).execute + + if response.error? + repository.remove + snippet.snippet_repository.delete + snippet.repository.expire_exists_cache + + raise SnippetRepositoryError, _("Invalid repository bundle for snippet with id %{snippet_id}") % { snippet_id: snippet.id } + end end def create_repository_from_db |