debian-mirror-gitlab/app/controllers/concerns/integrations/params.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

123 lines
3.2 KiB
Ruby
Raw Normal View History

2021-06-08 01:23:25 +05:30
# frozen_string_literal: true
module Integrations
module Params
extend ActiveSupport::Concern
ALLOWED_PARAMS_CE = [
2023-03-17 16:20:25 +05:30
:app_store_issuer_id,
:app_store_key_id,
:app_store_private_key,
2023-05-27 22:25:52 +05:30
:app_store_private_key_file_name,
2021-06-08 01:23:25 +05:30
:active,
:alert_events,
:api_key,
2021-12-11 22:18:48 +05:30
:api_token,
2021-06-08 01:23:25 +05:30
:api_url,
2022-03-02 08:16:31 +05:30
:archive_trace_events,
2021-06-08 01:23:25 +05:30
:bamboo_url,
:branches_to_be_notified,
:labels_to_be_notified,
:labels_to_be_notified_behavior,
:build_key,
:build_type,
:ca_pem,
:channel,
:channels,
:color,
:colorize_messages,
:comment_on_event_enabled,
:comment_detail,
:confidential_issues_events,
:confluence_url,
:datadog_site,
:datadog_env,
:datadog_service,
2022-04-04 11:22:00 +05:30
:datadog_tags,
2021-06-08 01:23:25 +05:30
:default_irc_uri,
:device,
:disable_diffs,
:drone_url,
:enable_ssl_verification,
:external_wiki_url,
:google_iap_service_account_json,
:google_iap_audience_client_id,
2023-03-17 16:20:25 +05:30
:incident_events,
2021-06-08 01:23:25 +05:30
:inherit_from_id,
# We're using `issues_events` and `merge_requests_events`
# in the view so we still need to explicitly state them
# here. `Service#event_names` would only give
# `issue_events` and `merge_request_events` (singular!)
# See app/helpers/services_helper.rb for how we
# make those event names plural as special case.
:issues_events,
:issues_url,
:jenkins_url,
2023-07-09 08:55:56 +05:30
:jira_auth_type,
2023-06-20 00:43:36 +05:30
:jira_issue_prefix,
:jira_issue_regex,
2021-06-08 01:23:25 +05:30
:jira_issue_transition_automatic,
:jira_issue_transition_id,
:manual_configuration,
:merge_requests_events,
:mock_service_url,
:namespace,
:new_issue_url,
:notify_only_broken_pipelines,
2023-06-20 00:43:36 +05:30
:package_name,
2021-06-08 01:23:25 +05:30
:password,
:priority,
:project_key,
:project_name,
:project_url,
:recipients,
:restrict_to_branch,
:room,
:send_from_committer_email,
:server,
:server_host,
:server_port,
2023-05-27 22:25:52 +05:30
:service_account_key,
:service_account_key_file_name,
2021-06-08 01:23:25 +05:30
:sound,
:subdomain,
:teamcity_url,
:token,
:type,
:url,
:user_key,
:username,
2021-12-11 22:18:48 +05:30
:webhook,
:zentao_product_xid
2021-06-08 01:23:25 +05:30
].freeze
def integration_params
2021-11-11 11:23:49 +05:30
dynamic_params = integration.event_channel_names + integration.event_names
2021-06-08 01:23:25 +05:30
allowed = allowed_integration_params + dynamic_params
return_value = params.permit(:id, integration: allowed, service: allowed)
return_value[:integration] ||= return_value.delete(:service)
param_values = return_value[:integration]
if param_values.is_a?(ActionController::Parameters)
2023-03-04 22:38:38 +05:30
if %w[update test].include?(action_name) && integration.chat? &&
param_values['webhook'] == BaseChatNotification::SECRET_MASK
2023-01-13 00:05:48 +05:30
param_values.delete('webhook')
end
2022-06-21 17:19:12 +05:30
integration.secret_fields.each do |param|
2021-06-08 01:23:25 +05:30
param_values.delete(param) if param_values[param].blank?
end
end
return_value
end
def allowed_integration_params
ALLOWED_PARAMS_CE
end
end
end
Integrations::Params.prepend_mod_with('Integrations::Params')