Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
commit43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch)
treedceebdc68925362117480a5d672bcff122fb625b /app/validators
parent20c84b99005abd1c82101dfeff264ac50d2df211 (diff)
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/addressable_url_validator.rb3
-rw-r--r--app/validators/json_schema_validator.rb1
-rw-r--r--app/validators/json_schemas/application_setting_database_apdex_settings.json34
-rw-r--r--app/validators/json_schemas/build_report_result_data.json5
-rw-r--r--app/validators/json_schemas/build_report_result_data_tests.json12
-rw-r--r--app/validators/json_schemas/clusters_agents_authorizations_ci_access_config.json (renamed from app/validators/json_schemas/cluster_agent_authorization_configuration.json)0
-rw-r--r--app/validators/json_schemas/clusters_agents_authorizations_user_access_config.json6
-rw-r--r--app/validators/json_schemas/google_service_account_key.json48
-rw-r--r--app/validators/json_schemas/import_failure_external_identifiers.json18
-rw-r--r--app/validators/json_schemas/pinned_nav_items.json22
10 files changed, 144 insertions, 5 deletions
diff --git a/app/validators/addressable_url_validator.rb b/app/validators/addressable_url_validator.rb
index c6d9bd73566..3e6ec0b6f29 100644
--- a/app/validators/addressable_url_validator.rb
+++ b/app/validators/addressable_url_validator.rb
@@ -31,6 +31,8 @@
# * <tt>allow_blank</tt> - Allow urls to be +blank+. Default: +false+
# * <tt>allow_nil</tt> - Allow urls to be +nil+. Default: +false+
# * <tt>ports</tt> - Allowed ports. Default: +all+.
+# * <tt>deny_all_requests_except_allowed</tt> - Deny all requests. Default: Respects the instance app setting.
+# Note: Regardless of whether enforced during validation, an HTTP request that uses the URI may still be blocked.
# * <tt>enforce_user</tt> - Validate user format. Default: +false+
# * <tt>enforce_sanitization</tt> - Validate that there are no html/css/js tags. Default: +false+
#
@@ -54,6 +56,7 @@ class AddressableUrlValidator < ActiveModel::EachValidator
allow_localhost: true,
allow_local_network: true,
ascii_only: false,
+ deny_all_requests_except_allowed: Gitlab::UrlBlocker::DENY_ALL_REQUESTS_EXCEPT_ALLOWED_DEFAULT,
enforce_user: false,
enforce_sanitization: false,
dns_rebind_protection: false
diff --git a/app/validators/json_schema_validator.rb b/app/validators/json_schema_validator.rb
index 4896c2ea2ef..9c246a114f6 100644
--- a/app/validators/json_schema_validator.rb
+++ b/app/validators/json_schema_validator.rb
@@ -25,6 +25,7 @@ class JsonSchemaValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
value = value.to_h.stringify_keys if options[:hash_conversion] == true
+ value = Gitlab::Json.parse(value.to_s) if options[:parse_json] == true && !value.nil?
unless valid_schema?(value)
record.errors.add(attribute, _("must be a valid json schema"))
diff --git a/app/validators/json_schemas/application_setting_database_apdex_settings.json b/app/validators/json_schemas/application_setting_database_apdex_settings.json
new file mode 100644
index 00000000000..8b58dd44586
--- /dev/null
+++ b/app/validators/json_schemas/application_setting_database_apdex_settings.json
@@ -0,0 +1,34 @@
+{
+ "description": "Database Apdex Settings",
+ "type": "object",
+ "properties": {
+ "prometheus_api_url": {
+ "type": "string"
+ },
+ "apdex_sli_query": {
+ "type": "object",
+ "properties": {
+ "main": {
+ "type": "string"
+ },
+ "ci": {
+ "type": "string"
+ }
+ }
+ },
+ "apdex_slo": {
+ "type": "object",
+ "properties": {
+ "main": {
+ "type": "number",
+ "format": "float"
+ },
+ "ci": {
+ "type": "number",
+ "format": "float"
+ }
+ }
+ }
+ },
+ "additionalProperties": false
+}
diff --git a/app/validators/json_schemas/build_report_result_data.json b/app/validators/json_schemas/build_report_result_data.json
index d109389a046..d9ef7633acd 100644
--- a/app/validators/json_schemas/build_report_result_data.json
+++ b/app/validators/json_schemas/build_report_result_data.json
@@ -8,10 +8,7 @@
"format": "float"
},
"tests": {
- "type": "object",
- "items": {
- "$ref": "./build_report_result_data_tests.json"
- }
+ "$ref": "./build_report_result_data_tests.json"
}
},
"additionalProperties": false
diff --git a/app/validators/json_schemas/build_report_result_data_tests.json b/app/validators/json_schemas/build_report_result_data_tests.json
index 3b6a2688313..456b651dd6c 100644
--- a/app/validators/json_schemas/build_report_result_data_tests.json
+++ b/app/validators/json_schemas/build_report_result_data_tests.json
@@ -7,7 +7,7 @@
"type": "string"
},
"duration": {
- "type": "string"
+ "type": "number"
},
"failed": {
"type": "integer"
@@ -20,6 +20,16 @@
},
"success": {
"type": "integer"
+ },
+ "suite_error": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ]
}
},
"additionalProperties": false
diff --git a/app/validators/json_schemas/cluster_agent_authorization_configuration.json b/app/validators/json_schemas/clusters_agents_authorizations_ci_access_config.json
index f3de0b7043b..f3de0b7043b 100644
--- a/app/validators/json_schemas/cluster_agent_authorization_configuration.json
+++ b/app/validators/json_schemas/clusters_agents_authorizations_ci_access_config.json
diff --git a/app/validators/json_schemas/clusters_agents_authorizations_user_access_config.json b/app/validators/json_schemas/clusters_agents_authorizations_user_access_config.json
new file mode 100644
index 00000000000..75624af9e6a
--- /dev/null
+++ b/app/validators/json_schemas/clusters_agents_authorizations_user_access_config.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "description": "Cluster Agent configuration for an authorized project or group through user_access keyword",
+ "type": "object",
+ "additionalProperties": true
+}
diff --git a/app/validators/json_schemas/google_service_account_key.json b/app/validators/json_schemas/google_service_account_key.json
new file mode 100644
index 00000000000..d040ef19f66
--- /dev/null
+++ b/app/validators/json_schemas/google_service_account_key.json
@@ -0,0 +1,48 @@
+{
+ "description": "Google service account key",
+ "type": "object",
+ "required": [
+ "type",
+ "project_id",
+ "private_key_id",
+ "private_key",
+ "client_email",
+ "client_id",
+ "auth_uri",
+ "token_uri",
+ "auth_provider_x509_cert_url",
+ "client_x509_cert_url"
+ ],
+ "properties": {
+ "type": {
+ "const": "service_account"
+ },
+ "project_id": {
+ "type": "string"
+ },
+ "private_key_id": {
+ "type": "string"
+ },
+ "private_key": {
+ "type": "string"
+ },
+ "client_email": {
+ "type": "string"
+ },
+ "client_id": {
+ "type": "string"
+ },
+ "auth_uri": {
+ "type": "string"
+ },
+ "token_uri": {
+ "type": "string"
+ },
+ "auth_provider_x509_cert_url": {
+ "type": "string"
+ },
+ "client_x509_cert_url": {
+ "type": "string"
+ }
+ }
+}
diff --git a/app/validators/json_schemas/import_failure_external_identifiers.json b/app/validators/json_schemas/import_failure_external_identifiers.json
new file mode 100644
index 00000000000..19d4e51ad21
--- /dev/null
+++ b/app/validators/json_schemas/import_failure_external_identifiers.json
@@ -0,0 +1,18 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "description": "Import failure external identifiers",
+ "type": "object",
+ "maxProperties": 4,
+ "patternProperties": {
+ ".*": {
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "integer"
+ }
+ ]
+ }
+ }
+}
diff --git a/app/validators/json_schemas/pinned_nav_items.json b/app/validators/json_schemas/pinned_nav_items.json
new file mode 100644
index 00000000000..60dee5cc463
--- /dev/null
+++ b/app/validators/json_schemas/pinned_nav_items.json
@@ -0,0 +1,22 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "description": "Pinned navigation items per panel",
+ "type": "object",
+ "properties": {
+ "group": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "uniqueItems": true
+ },
+ "project": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "uniqueItems": true
+ }
+ },
+ "additionalProperties": false
+}