diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-30 02:54:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-30 02:54:01 +0300 |
commit | 22afa6177e5cdd2843502d425cb584135a35df60 (patch) | |
tree | 57a0d0b688f058b395f41445bdbc2372dc5da85e /lib/banzai | |
parent | 52dd3cdae10174cc35af6698b280acd1431cc4f8 (diff) |
Add latest changes from gitlab-org/security/gitlab@15-9-stable-ee
Diffstat (limited to 'lib/banzai')
-rw-r--r-- | lib/banzai/filter/inline_observability_filter.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/banzai/filter/inline_observability_filter.rb b/lib/banzai/filter/inline_observability_filter.rb index 334c04f2b59..50d4aac70cc 100644 --- a/lib/banzai/filter/inline_observability_filter.rb +++ b/lib/banzai/filter/inline_observability_filter.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'uri' + module Banzai module Filter class InlineObservabilityFilter < ::Banzai::Filter::InlineEmbedsFilter @@ -15,7 +17,8 @@ module Banzai doc.document.create_element( 'div', class: 'js-render-observability', - 'data-frame-url': url + 'data-frame-url': url, + 'data-observability-url': Gitlab::Observability.observability_url ) end @@ -28,8 +31,15 @@ module Banzai # obtained from the target link def element_to_embed(node) url = node['href'] - - create_element(url) + uri = URI.parse(url) + observability_uri = URI.parse(Gitlab::Observability.observability_url) + + if uri.scheme == observability_uri.scheme && + uri.port == observability_uri.port && + uri.host.casecmp?(observability_uri.host) && + uri.path.downcase.exclude?("auth/start") + create_element(url) + end end private |