zendesk_apps_support 4.51.0 → 4.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/locales/en.yml +10 -0
- data/config/locales/translations/zendesk_apps_support.yml +32 -0
- data/lib/zendesk_apps_support/manifest/parameter.rb +3 -2
- data/lib/zendesk_apps_support/package.rb +6 -1
- data/lib/zendesk_apps_support/validations/manifest.rb +96 -9
- data/lib/zendesk_apps_support/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b97eb1a2194b8abdccf09feffc8d107e538d4bfa9868746b58e0719d3a59c25e
|
|
4
|
+
data.tar.gz: 661447396aedf9da4286ad1712c2f131d622eed2cf67e816616dcfb7dd216bad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 36ec44324414e0bcb0d4c4924b7eaf6e4d2e41e38fc5552b696c604829485baecde48e432bf3c555b3015a41a87be7f786c4cbcae88ffdd814bfd4e8fed249e8
|
|
7
|
+
data.tar.gz: cf492e02bbcd1daddf87b9128fdd449fcfedbb4edc0ca7cff8fccb2869d6f77c04c60f29be35f48f3a66fe5f4f66d634d89a57d1dbe6cba3c2f21134ea405a6b
|
data/config/locales/en.yml
CHANGED
|
@@ -314,6 +314,16 @@ en:
|
|
|
314
314
|
object_types_not_supported: objectTypes is not supported for the %{location}
|
|
315
315
|
location.
|
|
316
316
|
object_types_required: objectTypes is required for the %{location} location.
|
|
317
|
+
mtls_parameter_cannot_have_certain_settings: mtls parameter cannot have
|
|
318
|
+
default, secure, or scopes settings.
|
|
319
|
+
too_many_mtls_parameters: 'Too many parameters with type ''mtls'': three
|
|
320
|
+
permitted'
|
|
321
|
+
mtls_allowed_domain_contains_scheme: "%{field} must not include a protocol
|
|
322
|
+
or scheme."
|
|
323
|
+
mtls_allowed_domain_too_long: "%{field} must not exceed 253 characters."
|
|
324
|
+
mtls_allowed_domain_invalid_wildcard: "%{field} can only use a wildcard
|
|
325
|
+
as the first two characters, e.g. *.example.com."
|
|
326
|
+
mtls_allowed_domain_invalid_format: "%{field} must be a valid domain name."
|
|
317
327
|
warning:
|
|
318
328
|
app_build:
|
|
319
329
|
deprecated_version: You are targeting a deprecated version of the framework.
|
|
@@ -700,3 +700,35 @@ parts:
|
|
|
700
700
|
Do not translate 'scopes'. %{params} refers to secure parameters with no scopes configured.
|
|
701
701
|
Scopes in manifest refers to https://developer.zendesk.com/documentation/apps/getting-started/setting-up-new-apps/#scopes"
|
|
702
702
|
value: "The scopes property is not configured for parameter(s): %{params}. This may cause token exposure vulnerabilities. Learn about: %{link}"
|
|
703
|
+
- translation:
|
|
704
|
+
key: "txt.apps.admin.error.app_build.mtls_parameter_cannot_have_certain_settings"
|
|
705
|
+
title: "Validation message to indicate that mtls parameter cannot have default, secure, or scopes settings.
|
|
706
|
+
Do not translate 'mtls', 'secure', 'default' and 'scopes' as they are manifest properties.
|
|
707
|
+
'secure' in manifest refers to https://developer.zendesk.com/documentation/apps/getting-started/setting-up-new-apps/#secure
|
|
708
|
+
'scopes' in manifest refers to https://developer.zendesk.com/documentation/apps/getting-started/setting-up-new-apps/#scopes
|
|
709
|
+
'default' in manifest refers to https://developer.zendesk.com/documentation/apps/getting-started/setting-up-new-apps/#default"
|
|
710
|
+
value: "mtls parameter cannot have default, secure, or scopes settings."
|
|
711
|
+
- translation:
|
|
712
|
+
key: "txt.apps.admin.error.app_build.too_many_mtls_parameters"
|
|
713
|
+
title: "Validation message to indicate that mtls parameter cannot exceed three parameters. Do not translate 'mtls' as it is a manifest property."
|
|
714
|
+
value: "Too many parameters with type 'mtls': three permitted"
|
|
715
|
+
- translation:
|
|
716
|
+
key: "txt.apps.admin.error.app_build.mtls_allowed_domain_contains_scheme"
|
|
717
|
+
title: "Validation message to indicate that the allowed_domain property of an mtls parameter must not include a protocol or scheme.
|
|
718
|
+
%{field} refers to the manifest field path."
|
|
719
|
+
value: "%{field} must not include a protocol or scheme."
|
|
720
|
+
- translation:
|
|
721
|
+
key: "txt.apps.admin.error.app_build.mtls_allowed_domain_too_long"
|
|
722
|
+
title: "Validation message to indicate that the allowed_domain property of an mtls parameter exceeds the maximum length of 253 characters.
|
|
723
|
+
%{field} refers to the manifest field path."
|
|
724
|
+
value: "%{field} must not exceed 253 characters."
|
|
725
|
+
- translation:
|
|
726
|
+
key: "txt.apps.admin.error.app_build.mtls_allowed_domain_invalid_wildcard"
|
|
727
|
+
title: "Validation message to indicate that the allowed_domain property of an mtls parameter uses a wildcard incorrectly.
|
|
728
|
+
%{field} refers to the manifest field path."
|
|
729
|
+
value: "%{field} can only use a wildcard as the first two characters, e.g. *.example.com."
|
|
730
|
+
- translation:
|
|
731
|
+
key: "txt.apps.admin.error.app_build.mtls_allowed_domain_invalid_format"
|
|
732
|
+
title: "Validation message to indicate that the allowed_domain property of an mtls parameter is not a valid domain name.
|
|
733
|
+
%{field} refers to the manifest field path."
|
|
734
|
+
value: "%{field} must be a valid domain name."
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module ZendeskAppsSupport
|
|
4
4
|
class Manifest
|
|
5
5
|
class Parameter
|
|
6
|
-
TYPES = %w[text checkbox url number multiline hidden oauth].freeze
|
|
7
|
-
ATTRIBUTES = %i[name type required secure default scopes].freeze
|
|
6
|
+
TYPES = %w[text checkbox url number multiline hidden oauth mtls].freeze
|
|
7
|
+
ATTRIBUTES = %i[name type required secure default scopes allowed_domain].freeze
|
|
8
8
|
attr_reader(*ATTRIBUTES)
|
|
9
9
|
def default?
|
|
10
10
|
@has_default
|
|
@@ -18,6 +18,7 @@ module ZendeskAppsSupport
|
|
|
18
18
|
@has_default = p.key? 'default'
|
|
19
19
|
@default = p['default'] if @has_default
|
|
20
20
|
@scopes = p['scopes']
|
|
21
|
+
@allowed_domain = p['allowed_domain']
|
|
21
22
|
end
|
|
22
23
|
end
|
|
23
24
|
end
|
|
@@ -35,9 +35,14 @@ module ZendeskAppsSupport
|
|
|
35
35
|
marketplace = options.fetch(:marketplace, true)
|
|
36
36
|
skip_marketplace_translations = options.fetch(:skip_marketplace_translations, false)
|
|
37
37
|
validate_custom_object_record_sidebar_location = options.fetch(:validate_custom_object_record_sidebar_location, false)
|
|
38
|
+
validate_mtls_param = options.fetch(:validate_mtls_param, false)
|
|
38
39
|
|
|
39
40
|
errors = []
|
|
40
|
-
errors << Validations::Manifest.call(
|
|
41
|
+
errors << Validations::Manifest.call(
|
|
42
|
+
self,
|
|
43
|
+
validate_custom_object_record_sidebar_location: validate_custom_object_record_sidebar_location,
|
|
44
|
+
validate_mtls_param: validate_mtls_param
|
|
45
|
+
)
|
|
41
46
|
|
|
42
47
|
if has_valid_manifest?(errors)
|
|
43
48
|
errors << Validations::Marketplace.call(self) if marketplace
|
|
@@ -12,9 +12,13 @@ module ZendeskAppsSupport
|
|
|
12
12
|
PARAMETER_TYPES = ZendeskAppsSupport::Manifest::Parameter::TYPES
|
|
13
13
|
OAUTH_MANIFEST_LINK = 'https://developer.zendesk.com/apps/docs/developer-guide/manifest#oauth'
|
|
14
14
|
SECURE_PARAM_SCOPES = %w[header body url jwt_secret_key jwt_claim basic_auth_username basic_auth_password].freeze
|
|
15
|
+
MTLS = 'mtls'
|
|
16
|
+
MTLS_ALLOWED_DOMAIN_MAX_LENGTH = 253
|
|
17
|
+
MTLS_ALLOWED_DOMAIN_LABEL_MAX_LENGTH = 63
|
|
18
|
+
MTLS_ALLOWED_DOMAIN_LABEL_REGEXP = /\A[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\z/
|
|
15
19
|
|
|
16
20
|
class << self
|
|
17
|
-
def call(package, validate_custom_object_record_sidebar_location: false)
|
|
21
|
+
def call(package, validate_custom_object_record_sidebar_location: false, validate_mtls_param: false)
|
|
18
22
|
unless package.has_file?('manifest.json')
|
|
19
23
|
nested_manifest = package.files.find { |file| file =~ %r{\A[^/]+?/manifest\.json\Z} }
|
|
20
24
|
if nested_manifest
|
|
@@ -23,7 +27,8 @@ module ZendeskAppsSupport
|
|
|
23
27
|
return [ValidationError.new(:missing_manifest)]
|
|
24
28
|
end
|
|
25
29
|
collate_manifest_errors(package,
|
|
26
|
-
validate_custom_object_record_sidebar_location: validate_custom_object_record_sidebar_location
|
|
30
|
+
validate_custom_object_record_sidebar_location: validate_custom_object_record_sidebar_location,
|
|
31
|
+
validate_mtls_param: validate_mtls_param)
|
|
27
32
|
rescue JSON::ParserError => e
|
|
28
33
|
return [ValidationError.new(:manifest_not_json, errors: e)]
|
|
29
34
|
rescue ZendeskAppsSupport::Manifest::OverrideError => e
|
|
@@ -32,7 +37,8 @@ module ZendeskAppsSupport
|
|
|
32
37
|
|
|
33
38
|
private
|
|
34
39
|
|
|
35
|
-
def collate_manifest_errors(package, validate_custom_object_record_sidebar_location: false
|
|
40
|
+
def collate_manifest_errors(package, validate_custom_object_record_sidebar_location: false,
|
|
41
|
+
validate_mtls_param: false)
|
|
36
42
|
manifest = package.manifest
|
|
37
43
|
|
|
38
44
|
errors = [
|
|
@@ -41,7 +47,7 @@ module ZendeskAppsSupport
|
|
|
41
47
|
oauth_error(manifest),
|
|
42
48
|
default_locale_error(manifest, package),
|
|
43
49
|
validate_urls(manifest),
|
|
44
|
-
validate_parameters(manifest),
|
|
50
|
+
validate_parameters(manifest, validate_mtls_param: validate_mtls_param),
|
|
45
51
|
if manifest.requirements_only? || manifest.marketing_only?
|
|
46
52
|
[ ban_location(manifest),
|
|
47
53
|
ban_framework_version(manifest) ]
|
|
@@ -82,18 +88,21 @@ module ZendeskAppsSupport
|
|
|
82
88
|
errors
|
|
83
89
|
end
|
|
84
90
|
|
|
85
|
-
def validate_parameters(manifest)
|
|
91
|
+
def validate_parameters(manifest, validate_mtls_param: false)
|
|
86
92
|
if manifest.marketing_only?
|
|
87
93
|
marketing_only_errors(manifest)
|
|
88
94
|
else
|
|
89
95
|
[
|
|
90
96
|
parameters_error(manifest),
|
|
91
97
|
invalid_hidden_parameter_error(manifest),
|
|
92
|
-
invalid_type_error(manifest),
|
|
98
|
+
invalid_type_error(manifest, validate_mtls_param: validate_mtls_param),
|
|
93
99
|
too_many_oauth_parameters(manifest),
|
|
94
100
|
oauth_cannot_be_secure(manifest),
|
|
95
101
|
name_as_parameter_name_error(manifest),
|
|
96
|
-
invalid_secure_param_scopes_errors(manifest)
|
|
102
|
+
invalid_secure_param_scopes_errors(manifest),
|
|
103
|
+
(mtls_cannot_have_certain_settings(manifest) if validate_mtls_param),
|
|
104
|
+
(too_many_mtls_parameters(manifest) if validate_mtls_param),
|
|
105
|
+
(mtls_allowed_domain_errors(manifest) if validate_mtls_param)
|
|
97
106
|
]
|
|
98
107
|
end
|
|
99
108
|
end
|
|
@@ -475,12 +484,14 @@ module ZendeskAppsSupport
|
|
|
475
484
|
end
|
|
476
485
|
end
|
|
477
486
|
|
|
478
|
-
def invalid_type_error(manifest)
|
|
487
|
+
def invalid_type_error(manifest, validate_mtls_param: false)
|
|
488
|
+
allowed_types = validate_mtls_param ? PARAMETER_TYPES : PARAMETER_TYPES - [MTLS]
|
|
489
|
+
|
|
479
490
|
invalid_types = []
|
|
480
491
|
manifest.parameters.each do |parameter|
|
|
481
492
|
parameter_type = parameter.type
|
|
482
493
|
|
|
483
|
-
invalid_types << parameter_type unless
|
|
494
|
+
invalid_types << parameter_type unless allowed_types.include?(parameter_type)
|
|
484
495
|
end
|
|
485
496
|
|
|
486
497
|
if invalid_types.any?
|
|
@@ -531,6 +542,82 @@ module ZendeskAppsSupport
|
|
|
531
542
|
rescue URI::InvalidURIError
|
|
532
543
|
false
|
|
533
544
|
end
|
|
545
|
+
|
|
546
|
+
def mtls_cannot_have_certain_settings(manifest)
|
|
547
|
+
manifest.parameters.map do |parameter|
|
|
548
|
+
if parameter.type == MTLS && invalid_mtls_settings?(parameter)
|
|
549
|
+
return ValidationError.new(:mtls_parameter_cannot_have_certain_settings)
|
|
550
|
+
end
|
|
551
|
+
end
|
|
552
|
+
end
|
|
553
|
+
|
|
554
|
+
def invalid_mtls_settings?(parameter)
|
|
555
|
+
parameter.secure || parameter.default? || !parameter.scopes.nil?
|
|
556
|
+
end
|
|
557
|
+
|
|
558
|
+
def too_many_mtls_parameters(manifest)
|
|
559
|
+
mtls_parameter_count = manifest.parameters.count { |parameter| parameter.type == MTLS }
|
|
560
|
+
ValidationError.new(:too_many_mtls_parameters) if mtls_parameter_count > 3
|
|
561
|
+
end
|
|
562
|
+
|
|
563
|
+
def mtls_allowed_domain_errors(manifest)
|
|
564
|
+
manifest.parameters.each_with_object([]) do |parameter, errors|
|
|
565
|
+
next unless parameter.type == MTLS
|
|
566
|
+
|
|
567
|
+
errors.concat(mtls_allowed_domain_error_for(parameter))
|
|
568
|
+
end
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
def mtls_allowed_domain_error_for(parameter)
|
|
572
|
+
field = "parameters[name=\"#{parameter.name}\"].allowed_domain"
|
|
573
|
+
allowed_domain = parameter.allowed_domain
|
|
574
|
+
|
|
575
|
+
presence_or_type_error = mtls_allowed_domain_presence_or_type_error(allowed_domain, field)
|
|
576
|
+
return [presence_or_type_error] if presence_or_type_error
|
|
577
|
+
|
|
578
|
+
errors = mtls_allowed_domain_syntax_errors(allowed_domain, field)
|
|
579
|
+
return errors if errors.any?
|
|
580
|
+
|
|
581
|
+
errors << mtls_allowed_domain_format_error(allowed_domain, field)
|
|
582
|
+
errors.compact
|
|
583
|
+
end
|
|
584
|
+
|
|
585
|
+
def mtls_allowed_domain_presence_or_type_error(allowed_domain, field)
|
|
586
|
+
if allowed_domain.nil? || allowed_domain == ''
|
|
587
|
+
return ValidationError.new(:field_cannot_be_empty, field: field)
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
return if allowed_domain.is_a?(String)
|
|
591
|
+
|
|
592
|
+
ValidationError.new(:unacceptable_string, field: field, value: allowed_domain)
|
|
593
|
+
end
|
|
594
|
+
|
|
595
|
+
def mtls_allowed_domain_syntax_errors(allowed_domain, field)
|
|
596
|
+
errors = []
|
|
597
|
+
if allowed_domain.include?('://')
|
|
598
|
+
errors << ValidationError.new(:mtls_allowed_domain_contains_scheme, field: field)
|
|
599
|
+
end
|
|
600
|
+
if allowed_domain.length > MTLS_ALLOWED_DOMAIN_MAX_LENGTH
|
|
601
|
+
errors << ValidationError.new(:mtls_allowed_domain_too_long, field: field)
|
|
602
|
+
end
|
|
603
|
+
if allowed_domain.include?('*') && !allowed_domain.start_with?('*.')
|
|
604
|
+
errors << ValidationError.new(:mtls_allowed_domain_invalid_wildcard, field: field)
|
|
605
|
+
end
|
|
606
|
+
errors
|
|
607
|
+
end
|
|
608
|
+
|
|
609
|
+
def mtls_allowed_domain_format_error(allowed_domain, field)
|
|
610
|
+
hostname = allowed_domain.start_with?('*.') ? allowed_domain[2..] : allowed_domain
|
|
611
|
+
labels = hostname.split('.')
|
|
612
|
+
|
|
613
|
+
return if labels.size >= 2 && labels.all? { |label| valid_mtls_domain_label?(label) }
|
|
614
|
+
|
|
615
|
+
ValidationError.new(:mtls_allowed_domain_invalid_format, field: field)
|
|
616
|
+
end
|
|
617
|
+
|
|
618
|
+
def valid_mtls_domain_label?(label)
|
|
619
|
+
label.length <= MTLS_ALLOWED_DOMAIN_LABEL_MAX_LENGTH && label.match?(MTLS_ALLOWED_DOMAIN_LABEL_REGEXP)
|
|
620
|
+
end
|
|
534
621
|
end
|
|
535
622
|
end
|
|
536
623
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zendesk_apps_support
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.52.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James A. Rosen
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2026-
|
|
14
|
+
date: 2026-08-05 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: i18n
|