From 3e5f4a8802d60908fe3bcf56a72afd15e1a4777a Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 28 Jan 2020 14:23:34 +0000 Subject: Add latest changes from gitlab-org/security/gitlab@12-7-stable-ee --- lib/gitlab/asciidoc.rb | 2 -- lib/gitlab/asciidoc/include_processor.rb | 11 ++--------- 2 files changed, 2 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/gitlab/asciidoc.rb b/lib/gitlab/asciidoc.rb index 8d072422e17..da65caa6c9c 100644 --- a/lib/gitlab/asciidoc.rb +++ b/lib/gitlab/asciidoc.rb @@ -11,7 +11,6 @@ module Gitlab # the resulting HTML through HTML pipeline filters. module Asciidoc MAX_INCLUDE_DEPTH = 5 - MAX_INCLUDES = 32 DEFAULT_ADOC_ATTRS = { 'showtitle' => true, 'sectanchors' => true, @@ -41,7 +40,6 @@ module Gitlab extensions: extensions } context[:pipeline] = :ascii_doc - context[:max_includes] = [MAX_INCLUDES, context[:max_includes]].compact.min plantuml_setup diff --git a/lib/gitlab/asciidoc/include_processor.rb b/lib/gitlab/asciidoc/include_processor.rb index 53d1135a2d7..6e0b7ce60ba 100644 --- a/lib/gitlab/asciidoc/include_processor.rb +++ b/lib/gitlab/asciidoc/include_processor.rb @@ -14,8 +14,6 @@ module Gitlab @context = context @repository = context[:repository] || context[:project].try(:repository) - @max_includes = context[:max_includes].to_i - @included = [] # Note: Asciidoctor calls #freeze on extensions, so we can't set new # instance variables after initialization. @@ -30,11 +28,8 @@ module Gitlab def include_allowed?(target, reader) doc = reader.document - max_include_depth = doc.attributes.fetch('max-include-depth').to_i - - return false if max_include_depth < 1 + return false if doc.attributes.fetch('max-include-depth').to_i < 1 return false if target_uri?(target) - return false if included.size >= max_includes true end @@ -67,7 +62,7 @@ module Gitlab private - attr_reader :context, :repository, :cache, :max_includes, :included + attr_accessor :context, :repository, :cache # Gets a Blob at a path for a specific revision. # This method will check that the Blob exists and contains readable text. @@ -82,8 +77,6 @@ module Gitlab raise 'Blob not found' unless blob raise 'File is not readable' unless blob.readable_text? - included << filename - blob end -- cgit v1.2.1