summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-28 14:23:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-28 14:23:34 +0000
commit3e5f4a8802d60908fe3bcf56a72afd15e1a4777a (patch)
treec0f216d842e657a01c85ec031bfbae0a927cbc62 /lib
parentb9bf11ef5f63203c6974c4432553270f7b3d29a1 (diff)
downloadgitlab-ce-3e5f4a8802d60908fe3bcf56a72afd15e1a4777a.tar.gz
Add latest changes from gitlab-org/security/gitlab@12-7-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/asciidoc.rb2
-rw-r--r--lib/gitlab/asciidoc/include_processor.rb11
2 files changed, 2 insertions, 11 deletions
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