summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-06 22:34:08 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-06 22:34:08 +0000
commit877eefdb6d765fd9fd437b8328ecbe00cb07438a (patch)
treefe619e149eb11030f4766d8e4f3d0fe583557a44 /app/services
parentb9b8440df6afd24ba540343c612e522f52bea0db (diff)
downloadgitlab-ce-877eefdb6d765fd9fd437b8328ecbe00cb07438a.tar.gz
Add latest changes from gitlab-org/security/gitlab@15-7-stable-ee
Diffstat (limited to 'app/services')
-rw-r--r--app/services/error_tracking/list_projects_service.rb16
1 files changed, 3 insertions, 13 deletions
diff --git a/app/services/error_tracking/list_projects_service.rb b/app/services/error_tracking/list_projects_service.rb
index d52306ef805..2f23d47029c 100644
--- a/app/services/error_tracking/list_projects_service.rb
+++ b/app/services/error_tracking/list_projects_service.rb
@@ -2,8 +2,6 @@
module ErrorTracking
class ListProjectsService < ErrorTracking::BaseService
- MASKED_TOKEN_REGEX = /\A\*+\z/.freeze
-
private
def perform
@@ -22,31 +20,23 @@ module ErrorTracking
def project_error_tracking_setting
(super || project.build_error_tracking_setting).tap do |setting|
- url_changed = !setting.api_url&.start_with?(params[:api_host])
-
setting.api_url = ErrorTracking::ProjectErrorTrackingSetting.build_api_url_from(
api_host: params[:api_host],
organization_slug: 'org',
project_slug: 'proj'
)
- setting.token = token(setting, url_changed)
+ setting.token = token(setting)
setting.enabled = true
end
end
strong_memoize_attr :project_error_tracking_setting
- def token(setting, url_changed)
- return if url_changed && masked_token?
-
+ def token(setting)
# Use param token if not masked, otherwise use database token
- return params[:token] unless masked_token?
+ return params[:token] unless /\A\*+\z/.match?(params[:token])
setting.token
end
-
- def masked_token?
- MASKED_TOKEN_REGEX.match?(params[:token])
- end
end
end