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:
-rw-r--r--.gitlab/CODEOWNERS2
-rw-r--r--.rubocop_todo/gitlab/service_response.yml1
-rw-r--r--.rubocop_todo/layout/argument_alignment.yml2
-rw-r--r--.rubocop_todo/rspec/context_wording.yml1
-rw-r--r--.rubocop_todo/rspec/expect_change.yml3
-rw-r--r--.rubocop_todo/rspec/scattered_let.yml1
-rw-r--r--.rubocop_todo/style/if_unless_modifier.yml1
-rw-r--r--CHANGELOG.md47
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.checksum2
-rw-r--r--Gemfile.lock4
-rw-r--r--app/assets/javascripts/emoji/components/category.vue2
-rw-r--r--app/assets/javascripts/emoji/components/emoji_group.vue37
-rw-r--r--app/assets/javascripts/repository/components/table/row.vue4
-rw-r--r--app/assets/stylesheets/framework/emojis.scss10
-rw-r--r--app/controllers/jwt_controller.rb2
-rw-r--r--app/graphql/mutations/work_items/delete_task.rb58
-rw-r--r--app/graphql/types/issue_type.rb2
-rw-r--r--app/graphql/types/merge_request_type.rb2
-rw-r--r--app/graphql/types/mutation_type.rb1
-rw-r--r--app/graphql/types/work_items/deleted_task_input_type.rb19
-rw-r--r--app/models/concerns/time_trackable.rb8
-rw-r--r--app/models/deploy_token.rb3
-rw-r--r--app/models/timelog.rb12
-rw-r--r--app/policies/project_policy.rb4
-rw-r--r--app/services/auth/dependency_proxy_authentication_service.rb30
-rw-r--r--app/services/ci/pipeline_schedules/variables_base_save_service.rb52
-rw-r--r--app/services/ci/pipeline_schedules/variables_create_service.rb24
-rw-r--r--app/services/ci/pipeline_schedules/variables_update_service.rb24
-rw-r--r--app/services/personal_access_tokens/rotate_service.rb44
-rw-r--r--app/services/project_access_tokens/rotate_service.rb58
-rw-r--r--app/services/work_items/delete_task_service.rb45
-rw-r--r--app/services/work_items/task_list_reference_removal_service.rb56
-rw-r--r--app/validators/json_schemas/cyclonedx/bom-1.4.schema.json (renamed from app/validators/json_schemas/cyclonedx_report.json)2
-rw-r--r--app/validators/json_schemas/cyclonedx/bom-1.5.schema.json4895
-rw-r--r--app/views/admin/dashboard/stats.html.haml2
-rw-r--r--app/views/projects/merge_requests/_nav_btns.html.haml2
-rw-r--r--config/feature_flags/development/ci_redirect_component_project.yml (renamed from config/feature_flags/development/hide_unaccessible_saml_branches.yml)10
-rw-r--r--config/feature_flags/development/duo_chat_current_resource_by_default.yml (renamed from config/feature_flags/experiment/skip_conflict_files_in_gitaly.yml)12
-rw-r--r--config/feature_flags/development/graphql_git_blame.yml4
-rw-r--r--config/feature_flags/development/packages_dependency_proxy_containers_scope_check.yml8
-rw-r--r--data/deprecations/16-7-dependency-proxy-group-deploy-token.yml8
-rw-r--r--db/click_house/migrate/20231211130023_drop_contribution_analytics_mv.rb30
-rw-r--r--db/click_house/migrate/20231211143660_drop_contribution_analytics_table.rb27
-rw-r--r--doc/api/graphql/reference/index.md49
-rw-r--r--doc/development/contributing/index.md2
-rw-r--r--doc/development/documentation/styleguide/word_list.md11
-rw-r--r--doc/development/documentation/topic_types/troubleshooting.md6
-rw-r--r--doc/integration/advanced_search/elasticsearch_troubleshooting.md31
-rw-r--r--doc/update/deprecations.md8
-rw-r--r--doc/user/application_security/policies/img/scan_results_evaluation_white-bg.pngbin0 -> 169020 bytes
-rw-r--r--doc/user/application_security/policies/scan-result-policies.md11
-rw-r--r--doc/user/okrs.md32
-rw-r--r--doc/user/permissions.md7
-rw-r--r--doc/user/project/repository/index.md2
-rw-r--r--doc/user/project/repository/tags/index.md13
-rw-r--r--doc/user/project/service_desk/configure.md3
-rw-r--r--doc/user/project/time_tracking.md4
-rw-r--r--lib/api/ci/pipeline_schedules.rb19
-rw-r--r--lib/api/resource_access_tokens.rb8
-rw-r--r--lib/api/search.rb2
-rw-r--r--lib/gitlab/checks/tag_check.rb10
-rw-r--r--lib/gitlab/ci/components/instance_path.rb40
-rw-r--r--lib/gitlab/ci/parsers/sbom/cyclonedx.rb15
-rw-r--r--lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator.rb25
-rw-r--r--lib/gitlab/gitaly_client/conflicts_service.rb4
-rw-r--r--lib/gitlab/group_search_results.rb1
-rw-r--r--lib/gitlab/internal_events.rb2
-rw-r--r--locale/gitlab.pot18
-rw-r--r--metrics_server/metrics_server.rb6
-rw-r--r--spec/controllers/groups/dependency_proxy_for_containers_controller_spec.rb52
-rw-r--r--spec/factories/personal_access_tokens.rb6
-rw-r--r--spec/features/profiles/two_factor_auths_spec.rb2
-rw-r--r--spec/features/projects/blobs/user_follows_pipeline_suggest_nudge_spec.rb2
-rw-r--r--spec/features/projects/branches/user_creates_branch_spec.rb2
-rw-r--r--spec/features/projects/settings/monitor_settings_spec.rb2
-rw-r--r--spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb2
-rw-r--r--spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb2
-rw-r--r--spec/features/projects/show/user_interacts_with_auto_devops_banner_spec.rb2
-rw-r--r--spec/frontend/emoji/components/emoji_group_spec.js15
-rw-r--r--spec/frontend/repository/components/table/row_spec.js11
-rw-r--r--spec/frontend/vue_shared/alert_details/alert_details_spec.js103
-rw-r--r--spec/lib/gitlab/checks/tag_check_spec.rb61
-rw-r--r--spec/lib/gitlab/ci/components/instance_path_spec.rb82
-rw-r--r--spec/lib/gitlab/ci/parsers/sbom/cyclonedx_spec.rb73
-rw-r--r--spec/lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator_spec.rb268
-rw-r--r--spec/lib/gitlab/gitaly_client/conflicts_service_spec.rb23
-rw-r--r--spec/lib/gitlab/internal_events_spec.rb6
-rw-r--r--spec/models/issue_spec.rb5
-rw-r--r--spec/models/merge_request_spec.rb5
-rw-r--r--spec/models/timelog_spec.rb47
-rw-r--r--spec/policies/project_policy_spec.rb47
-rw-r--r--spec/requests/api/ci/pipeline_schedules_spec.rb267
-rw-r--r--spec/requests/api/graphql/mutations/work_items/delete_task_spec.rb79
-rw-r--r--spec/requests/api/resource_access_tokens_spec.rb88
-rw-r--r--spec/requests/jwt_controller_spec.rb56
-rw-r--r--spec/services/auth/dependency_proxy_authentication_service_spec.rb45
-rw-r--r--spec/services/ci/pipeline_schedules/variables_create_service_spec.rb108
-rw-r--r--spec/services/ci/pipeline_schedules/variables_update_service_spec.rb107
-rw-r--r--spec/services/personal_access_tokens/rotate_service_spec.rb44
-rw-r--r--spec/services/project_access_tokens/rotate_service_spec.rb189
-rw-r--r--spec/services/system_notes/time_tracking_service_spec.rb12
-rw-r--r--spec/services/work_items/delete_task_service_spec.rb88
-rw-r--r--spec/services/work_items/task_list_reference_removal_service_spec.rb152
-rw-r--r--spec/support/rspec_order_todo.yml3
-rw-r--r--spec/support/shared_examples/models/trackable_shared_examples.rb25
-rw-r--r--spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb2
107 files changed, 6909 insertions, 1066 deletions
diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS
index ccf502edb5b..87194d6c0a6 100644
--- a/.gitlab/CODEOWNERS
+++ b/.gitlab/CODEOWNERS
@@ -2,7 +2,7 @@
# project here: https://gitlab.com/gitlab-org/gitlab/-/project_members
# As described in https://docs.gitlab.com/ee/user/project/code_owners.html
-* @gitlab-org/maintainers/rails-backend @gitlab-org/maintainers/frontend @gitlab-org/maintainers/database @gl-quality/qe-maintainers @gl-quality/tooling-maintainers @gitlab-org/delivery @gitlab-org/maintainers/cicd-templates @nolith @gitlab-org/tw-leadership @gitlab-org/maintainers/kas-version-maintainers
+* @gitlab-org/maintainers/rails-backend @gitlab-org/maintainers/frontend @gitlab-org/maintainers/database @gl-quality/qe-maintainers @gl-quality/tooling-maintainers @gitlab-org/delivery @gitlab-org/maintainers/cicd-templates @gitlab-org/tw-leadership @gitlab-org/maintainers/kas-version-maintainers
.gitlab/CODEOWNERS @gitlab-org/development-leaders @gitlab-org/tw-leadership
diff --git a/.rubocop_todo/gitlab/service_response.yml b/.rubocop_todo/gitlab/service_response.yml
index fa65cade197..e000f897914 100644
--- a/.rubocop_todo/gitlab/service_response.yml
+++ b/.rubocop_todo/gitlab/service_response.yml
@@ -37,7 +37,6 @@ Gitlab/ServiceResponse:
- 'app/services/timelogs/base_service.rb'
- 'app/services/work_items/create_and_link_service.rb'
- 'app/services/work_items/create_from_task_service.rb'
- - 'app/services/work_items/delete_task_service.rb'
- 'ee/app/services/analytics/cycle_analytics/value_streams/create_service.rb'
- 'ee/app/services/app_sec/dast/profiles/destroy_service.rb'
- 'ee/app/services/app_sec/dast/scanner_profiles/destroy_service.rb'
diff --git a/.rubocop_todo/layout/argument_alignment.yml b/.rubocop_todo/layout/argument_alignment.yml
index 97da3fca535..a0ae27f77b2 100644
--- a/.rubocop_todo/layout/argument_alignment.yml
+++ b/.rubocop_todo/layout/argument_alignment.yml
@@ -146,7 +146,6 @@ Layout/ArgumentAlignment:
- 'app/graphql/mutations/work_items/create.rb'
- 'app/graphql/mutations/work_items/create_from_task.rb'
- 'app/graphql/mutations/work_items/delete.rb'
- - 'app/graphql/mutations/work_items/delete_task.rb'
- 'app/graphql/mutations/work_items/update.rb'
- 'app/graphql/mutations/work_items/update_task.rb'
- 'app/graphql/resolvers/admin/analytics/usage_trends/measurements_resolver.rb'
@@ -475,7 +474,6 @@ Layout/ArgumentAlignment:
- 'app/graphql/types/users/namespace_commit_email_type.rb'
- 'app/graphql/types/work_item_type.rb'
- 'app/graphql/types/work_items/convert_task_input_type.rb'
- - 'app/graphql/types/work_items/deleted_task_input_type.rb'
- 'app/graphql/types/work_items/type_type.rb'
- 'app/graphql/types/work_items/widgets/description_input_type.rb'
- 'app/graphql/types/work_items/widgets/description_type.rb'
diff --git a/.rubocop_todo/rspec/context_wording.yml b/.rubocop_todo/rspec/context_wording.yml
index 57320ca4c6c..2c63ac26763 100644
--- a/.rubocop_todo/rspec/context_wording.yml
+++ b/.rubocop_todo/rspec/context_wording.yml
@@ -2306,7 +2306,6 @@ RSpec/ContextWording:
- 'spec/requests/api/graphql/mutations/todos/create_spec.rb'
- 'spec/requests/api/graphql/mutations/work_items/create_from_task_spec.rb'
- 'spec/requests/api/graphql/mutations/work_items/create_spec.rb'
- - 'spec/requests/api/graphql/mutations/work_items/delete_task_spec.rb'
- 'spec/requests/api/graphql/mutations/work_items/update_spec.rb'
- 'spec/requests/api/graphql/mutations/work_items/update_task_spec.rb'
- 'spec/requests/api/graphql/namespace_query_spec.rb'
diff --git a/.rubocop_todo/rspec/expect_change.yml b/.rubocop_todo/rspec/expect_change.yml
index 235ee63b230..f358600f4fe 100644
--- a/.rubocop_todo/rspec/expect_change.yml
+++ b/.rubocop_todo/rspec/expect_change.yml
@@ -287,7 +287,6 @@ RSpec/ExpectChange:
- 'spec/requests/api/graphql/mutations/work_items/create_from_task_spec.rb'
- 'spec/requests/api/graphql/mutations/work_items/create_spec.rb'
- 'spec/requests/api/graphql/mutations/work_items/delete_spec.rb'
- - 'spec/requests/api/graphql/mutations/work_items/delete_task_spec.rb'
- 'spec/requests/api/graphql/mutations/work_items/update_spec.rb'
- 'spec/requests/api/graphql/mutations/work_items/update_task_spec.rb'
- 'spec/requests/api/groups_spec.rb'
@@ -387,10 +386,8 @@ RSpec/ExpectChange:
- 'spec/services/work_items/create_and_link_service_spec.rb'
- 'spec/services/work_items/create_from_task_service_spec.rb'
- 'spec/services/work_items/create_service_spec.rb'
- - 'spec/services/work_items/delete_task_service_spec.rb'
- 'spec/services/work_items/parent_links/create_service_spec.rb'
- 'spec/services/work_items/parent_links/destroy_service_spec.rb'
- - 'spec/services/work_items/task_list_reference_removal_service_spec.rb'
- 'spec/services/work_items/task_list_reference_replacement_service_spec.rb'
- 'spec/services/work_items/update_service_spec.rb'
- 'spec/services/work_items/widgets/hierarchy_service/update_service_spec.rb'
diff --git a/.rubocop_todo/rspec/scattered_let.yml b/.rubocop_todo/rspec/scattered_let.yml
index 00d8fd127ae..f94aa2b8b00 100644
--- a/.rubocop_todo/rspec/scattered_let.yml
+++ b/.rubocop_todo/rspec/scattered_let.yml
@@ -196,7 +196,6 @@ RSpec/ScatteredLet:
- 'spec/requests/api/graphql/group/work_item_types_spec.rb'
- 'spec/requests/api/graphql/milestone_spec.rb'
- 'spec/requests/api/graphql/mutations/boards/create_spec.rb'
- - 'spec/requests/api/graphql/mutations/work_items/delete_task_spec.rb'
- 'spec/requests/api/graphql/namespace/projects_spec.rb'
- 'spec/requests/api/graphql/project/deployment_spec.rb'
- 'spec/requests/api/graphql/project/environments_spec.rb'
diff --git a/.rubocop_todo/style/if_unless_modifier.yml b/.rubocop_todo/style/if_unless_modifier.yml
index 985655536bc..db8f6d8d851 100644
--- a/.rubocop_todo/style/if_unless_modifier.yml
+++ b/.rubocop_todo/style/if_unless_modifier.yml
@@ -319,7 +319,6 @@ Style/IfUnlessModifier:
- 'app/services/users/build_service.rb'
- 'app/services/users/respond_to_terms_service.rb'
- 'app/services/wikis/create_attachment_service.rb'
- - 'app/services/work_items/task_list_reference_removal_service.rb'
- 'app/services/work_items/task_list_reference_replacement_service.rb'
- 'app/uploaders/file_mover.rb'
- 'app/uploaders/object_storage.rb'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b5d0aa9bee7..1eefa21ee34 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,23 @@
documentation](doc/development/changelog.md) for instructions on adding your own
entry.
+## 16.6.2 (2023-12-13)
+
+### Fixed (1 change)
+
+- [Fix adding confidential child tasks](gitlab-org/security/gitlab@1e67ddffca37e733aee2c3b118c2f9510fc094c0)
+
+### Security (8 changes)
+
+- [Prevent tag names starting with SHA-1 and SHA-256 values](gitlab-org/security/gitlab@d942166b879e8986d9deb45ab1732fa563e715c2) ([merge request](gitlab-org/security/gitlab!3746))
+- [Pass encoded file paths to router](gitlab-org/security/gitlab@1e414bb90ec85c818955bb241934bd43137adb4d) ([merge request](gitlab-org/security/gitlab!3735))
+- [Validate access level of user while rotating token](gitlab-org/security/gitlab@a8267a4facee6ba922897fa2a1f358636d24fb09) ([merge request](gitlab-org/security/gitlab!3750))
+- [Fix large time_spent value causing GraphQL error `Integer out of bounds`](gitlab-org/security/gitlab@6a48b4b8d58daf75a1d1da192b69c790435427bc) ([merge request](gitlab-org/security/gitlab!3745))
+- [Restrict Protected branch access via group to direct members](gitlab-org/security/gitlab@dde50268150c2ef4653c7024eb8357321042ec94) ([merge request](gitlab-org/security/gitlab!3726))
+- [Remove the ability to fork and create MR for auditors](gitlab-org/security/gitlab@c1a532527ee764c32f9c0779fa787a31b6d481f4) ([merge request](gitlab-org/security/gitlab!3738))
+- [Restrict passing variables on the pipeline schedule API](gitlab-org/security/gitlab@0f12c83c9be495e37a04594c678a500643deb410) ([merge request](gitlab-org/security/gitlab!3723))
+- [Smartcard auth: encrypt client cert in params](gitlab-org/security/gitlab@180374e354da080d90c70500aef9e574cc371e9e) ([merge request](gitlab-org/security/gitlab!3729))
+
## 16.6.1 (2023-11-30)
### Fixed (3 changes)
@@ -570,6 +587,23 @@ entry.
- [Remove pubsub migration helper for actioncable](gitlab-org/gitlab@763ca1305db6f1c9cf6700b8497494a81926d742) ([merge request](gitlab-org/gitlab!133066))
- [Use partitioned table for CommitStatus](gitlab-org/gitlab@063826e042778995fae13928a2fb5de2c8855b45) ([merge request](gitlab-org/gitlab!134489))
+## 16.5.4 (2023-12-13)
+
+### Fixed (1 change)
+
+- [Truncate verification failure message to 255](gitlab-org/security/gitlab@640f8fa1b9ac91767b25992be646b8369fe41e09) **GitLab Enterprise Edition**
+
+### Security (8 changes)
+
+- [Prevent tag names starting with SHA-1 and SHA-256 values](gitlab-org/security/gitlab@2a67d2efe432eeb1264ffe3dd5e0625c364d3d4b) ([merge request](gitlab-org/security/gitlab!3747))
+- [Pass encoded file paths to router](gitlab-org/security/gitlab@7299f46a651db01f451694bf7b801ae8af672592) ([merge request](gitlab-org/security/gitlab!3736))
+- [Validate access level of user while rotating token](gitlab-org/security/gitlab@4a1ca1e3f95d858966ef1f985925c57f70923e17) ([merge request](gitlab-org/security/gitlab!3751))
+- [Fix large time_spent value causing GraphQL error `Integer out of bounds`](gitlab-org/security/gitlab@a87f5d04de526fbed7ecbf6ed8d44db356076826) ([merge request](gitlab-org/security/gitlab!3744))
+- [Restrict Protected branch access via group to direct members](gitlab-org/security/gitlab@22fd1a0d19f49c761fb20f80c326fa8658c962f7) ([merge request](gitlab-org/security/gitlab!3727))
+- [Remove the ability to fork and create MR for auditors](gitlab-org/security/gitlab@1a9d9490b3cf0e91321a90333d3f79ed275df4c0) ([merge request](gitlab-org/security/gitlab!3739))
+- [Restrict passing variables on the pipeline schedule API](gitlab-org/security/gitlab@eeb86c57a3b09b04659cb3d1300e396bdd51db58) ([merge request](gitlab-org/security/gitlab!3724))
+- [Smartcard auth: encrypt client cert in params](gitlab-org/security/gitlab@4ca907081651de95bcb392ee2ca2626dd7679f36) ([merge request](gitlab-org/security/gitlab!3730))
+
## 16.5.3 (2023-11-30)
### Security (11 changes)
@@ -1281,6 +1315,19 @@ entry.
- [Alias read_namespace to access_namespace and move usages to new ability](gitlab-org/gitlab@61cdb4127143162a9bf9182f9c3c2d8421ee447f) by @Taucher2003 ([merge request](gitlab-org/gitlab!126625))
- [Remove `custom_roles_on_groups` feature flag](gitlab-org/gitlab@ddb4b4399b8bb82793410005c5778a002ae409b9) ([merge request](gitlab-org/gitlab!132187)) **GitLab Enterprise Edition**
+## 16.4.4 (2023-12-13)
+
+### Security (8 changes)
+
+- [Prevent tag names starting with SHA-1 and SHA-256 values](gitlab-org/security/gitlab@dea535057d372f313db2f3afb7928a65a3acfcf7) ([merge request](gitlab-org/security/gitlab!3748))
+- [Pass encoded file paths to router](gitlab-org/security/gitlab@435d14da6592134edc1b051be9e53a5756f37eff) ([merge request](gitlab-org/security/gitlab!3737))
+- [Validate access level of user while rotating token](gitlab-org/security/gitlab@d4e74025a0910966e4c92a117a5d1721c1d69854) ([merge request](gitlab-org/security/gitlab!3752))
+- [Fix large time_spent value causing GraphQL error `Integer out of bounds`](gitlab-org/security/gitlab@532192423ae25061c7454a47956b0d9f9ff07ffa) ([merge request](gitlab-org/security/gitlab!3753))
+- [Restrict Protected branch access via group to direct members](gitlab-org/security/gitlab@267933e624d8988ace9948804476f1c5d14fc228) ([merge request](gitlab-org/security/gitlab!3728))
+- [Remove the ability to fork and create MR for auditors](gitlab-org/security/gitlab@720c977c36a1ec349b38897b61b7fcb62e6bd1eb) ([merge request](gitlab-org/security/gitlab!3740))
+- [Restrict passing variables on the pipeline schedule API](gitlab-org/security/gitlab@ed1141076ffef659886753830b201e68c9bacf32) ([merge request](gitlab-org/security/gitlab!3725))
+- [Smartcard auth: encrypt client cert in params](gitlab-org/security/gitlab@3c1d11225878573e9de0803f0484e17764bce8ee) ([merge request](gitlab-org/security/gitlab!3731))
+
## 16.4.3 (2023-11-30)
### Fixed (1 change)
diff --git a/Gemfile b/Gemfile
index a52c32f4278..69b37be36e2 100644
--- a/Gemfile
+++ b/Gemfile
@@ -434,7 +434,7 @@ group :development, :test do
gem 'gitlab-styles', '~> 11.0.0', require: false # rubocop:todo Gemfile/MissingFeatureCategory
- gem 'haml_lint', '~> 0.51', require: false # rubocop:todo Gemfile/MissingFeatureCategory
+ gem 'haml_lint', '~> 0.52', require: false # rubocop:todo Gemfile/MissingFeatureCategory
gem 'bundler-audit', '~> 0.9.1', require: false # rubocop:todo Gemfile/MissingFeatureCategory
# Benchmarking & profiling
diff --git a/Gemfile.checksum b/Gemfile.checksum
index 87b717922bc..b0c2169d5d2 100644
--- a/Gemfile.checksum
+++ b/Gemfile.checksum
@@ -282,7 +282,7 @@
{"name":"guard-compat","version":"1.2.1","platform":"ruby","checksum":"3ad21ab0070107f92edfd82610b5cdc2fb8e368851e72362ada9703443d646fe"},
{"name":"guard-rspec","version":"4.7.3","platform":"ruby","checksum":"a47ba03cbd1e3c71e6ae8645cea97e203098a248aede507461a43e906e2f75ca"},
{"name":"haml","version":"5.2.2","platform":"ruby","checksum":"6e759246556145642ef832d670fc06f9bd8539159a0e600847a00291dd7aae0c"},
-{"name":"haml_lint","version":"0.51.0","platform":"ruby","checksum":"6c5e73b979dcd806ddf0043971bfc2076f832c24722314503ebb1087c361a8e7"},
+{"name":"haml_lint","version":"0.52.0","platform":"ruby","checksum":"76326b0f1a412558303bca983bd1bbb6e46555386589174502d263b9918114ea"},
{"name":"hamlit","version":"2.15.0","platform":"java","checksum":"fda165464e59337ab7cda6304a66bfdb607bb7155f25566da19c9ee7b98e03d1"},
{"name":"hamlit","version":"2.15.0","platform":"ruby","checksum":"d2e8505362338945fa309c68b2b8be07ebdc181200ec6021223567bf66dac38e"},
{"name":"hana","version":"1.3.7","platform":"ruby","checksum":"5425db42d651fea08859811c29d20446f16af196308162894db208cac5ce9b0d"},
diff --git a/Gemfile.lock b/Gemfile.lock
index 4aee89105d2..05912d8b098 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -872,7 +872,7 @@ GEM
haml (5.2.2)
temple (>= 0.8.0)
tilt
- haml_lint (0.51.0)
+ haml_lint (0.52.0)
haml (>= 4.0)
parallel (~> 1.10)
rainbow
@@ -1923,7 +1923,7 @@ DEPENDENCIES
grpc (~> 1.58.0)
gssapi (~> 1.3.1)
guard-rspec
- haml_lint (~> 0.51)
+ haml_lint (~> 0.52)
hamlit (~> 2.15.0)
hashie (~> 5.0.0)
health_check (~> 3.0)
diff --git a/app/assets/javascripts/emoji/components/category.vue b/app/assets/javascripts/emoji/components/category.vue
index 80850475b96..d8607cbc60b 100644
--- a/app/assets/javascripts/emoji/components/category.vue
+++ b/app/assets/javascripts/emoji/components/category.vue
@@ -52,7 +52,7 @@ export default {
:key="index"
:emojis="emojiGroup"
:render-group="renderGroup"
- @emoji-click="onClick"
+ :click-emoji="(emoji) => onClick(emoji)"
/>
</template>
<p v-else>
diff --git a/app/assets/javascripts/emoji/components/emoji_group.vue b/app/assets/javascripts/emoji/components/emoji_group.vue
index bb0c3b0a694..bbac6866636 100644
--- a/app/assets/javascripts/emoji/components/emoji_group.vue
+++ b/app/assets/javascripts/emoji/components/emoji_group.vue
@@ -1,10 +1,10 @@
<script>
-import { GlButton } from '@gitlab/ui';
+import { compatFunctionalMixin } from '~/lib/utils/vue3compat/compat_functional_mixin';
export default {
- components: {
- GlButton,
- },
+ // Temporary mixin for migration from Vue.js 2 to @vue/compat
+ mixins: [compatFunctionalMixin],
+
props: {
emojis: {
type: Array,
@@ -14,33 +14,28 @@ export default {
type: Boolean,
required: true,
},
- },
- methods: {
- clickEmoji(emoji) {
- this.$emit('emoji-click', emoji);
+ clickEmoji: {
+ type: Function,
+ required: true,
},
},
};
</script>
-<template>
+<!-- eslint-disable-next-line vue/no-deprecated-functional-template -->
+<template functional>
<div class="gl-display-flex gl-flex-wrap gl-mb-2">
- <template v-if="renderGroup">
- <gl-button
- v-for="emoji in emojis"
+ <template v-if="props.renderGroup">
+ <button
+ v-for="emoji in props.emojis"
:key="emoji"
type="button"
- category="tertiary"
- class="emoji-picker-emoji"
- :aria-label="emoji"
+ class="gl-border-0 gl-bg-transparent gl-px-0 gl-py-2 gl-text-center emoji-picker-emoji"
data-testid="emoji-button"
- button-text-classes="gl-display-none!"
- @click="clickEmoji(emoji)"
+ @click="props.clickEmoji(emoji)"
>
- <template #emoji>
- <gl-emoji :data-name="emoji" class="gl-mr-0!" />
- </template>
- </gl-button>
+ <gl-emoji :data-name="emoji" />
+ </button>
</template>
</div>
</template>
diff --git a/app/assets/javascripts/repository/components/table/row.vue b/app/assets/javascripts/repository/components/table/row.vue
index 6a81f11eb51..bb2b8ae54b6 100644
--- a/app/assets/javascripts/repository/components/table/row.vue
+++ b/app/assets/javascripts/repository/components/table/row.vue
@@ -120,13 +120,13 @@ export default {
routerLinkTo() {
if (this.isBlob) {
return buildURLwithRefType({
- path: joinPaths('/-/blob', this.escapedRef, this.path),
+ path: joinPaths('/-/blob', this.escapedRef, encodeURI(this.path)),
refType: this.refType,
});
}
if (this.isFolder) {
return buildURLwithRefType({
- path: joinPaths('/-/tree', this.escapedRef, this.path),
+ path: joinPaths('/-/tree', this.escapedRef, encodeURI(this.path)),
refType: this.refType,
});
}
diff --git a/app/assets/stylesheets/framework/emojis.scss b/app/assets/stylesheets/framework/emojis.scss
index a06cf84b5b4..92cb509148f 100644
--- a/app/assets/stylesheets/framework/emojis.scss
+++ b/app/assets/stylesheets/framework/emojis.scss
@@ -41,16 +41,6 @@ gl-emoji {
&:focus {
transform: scale(1.3);
}
-
- &:focus {
- @include gl-z-index-2;
- mix-blend-mode: normal !important;
- }
-
- gl-emoji {
- width: px-to-rem($gl-padding);
- top: -1px;
- }
}
.emoji-picker .gl-dropdown .dropdown-menu {
diff --git a/app/controllers/jwt_controller.rb b/app/controllers/jwt_controller.rb
index 83409c7e096..e6e232cfbc3 100644
--- a/app/controllers/jwt_controller.rb
+++ b/app/controllers/jwt_controller.rb
@@ -33,6 +33,7 @@ class JwtController < ApplicationController
@authentication_result = Gitlab::Auth::Result.new(nil, nil, :none, Gitlab::Auth.read_only_authentication_abilities)
authenticate_with_http_basic do |login, password|
+ @raw_token = password
@authentication_result = Gitlab::Auth.find_for_git_client(login, password, project: nil, request: request)
if @authentication_result.failed?
@@ -80,6 +81,7 @@ class JwtController < ApplicationController
def additional_params
{
scopes: scopes_param,
+ raw_token: @raw_token,
deploy_token: @authentication_result.deploy_token,
auth_type: @authentication_result.type
}.compact
diff --git a/app/graphql/mutations/work_items/delete_task.rb b/app/graphql/mutations/work_items/delete_task.rb
deleted file mode 100644
index b13d7e2e3bf..00000000000
--- a/app/graphql/mutations/work_items/delete_task.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-# frozen_string_literal: true
-
-module Mutations
- module WorkItems
- class DeleteTask < BaseMutation
- graphql_name 'WorkItemDeleteTask'
-
- description "Deletes a task in a work item's description."
-
- authorize :update_work_item
-
- argument :id, ::Types::GlobalIDType[::WorkItem],
- required: true,
- description: 'Global ID of the work item.'
- argument :lock_version, GraphQL::Types::Int,
- required: true,
- description: 'Current lock version of the work item containing the task in the description.'
- argument :task_data, ::Types::WorkItems::DeletedTaskInputType,
- required: true,
- description: 'Arguments necessary to delete a task from a work item\'s description.',
- prepare: ->(attributes, _ctx) { attributes.to_h }
-
- field :work_item, Types::WorkItemType,
- null: true,
- description: 'Updated work item.'
-
- def resolve(id:, lock_version:, task_data:)
- work_item = authorized_find!(id: id)
- task_data[:task] = authorized_find_task!(task_data[:id])
-
- result = ::WorkItems::DeleteTaskService.new(
- work_item: work_item,
- current_user: current_user,
- lock_version: lock_version,
- task_params: task_data
- ).execute
-
- response = { errors: result.errors }
- response[:work_item] = work_item if result.success?
-
- response
- end
-
- private
-
- def authorized_find_task!(task_id)
- task = ::Gitlab::Graphql::Lazy.force(GitlabSchema.find_by_gid(task_id))
-
- if current_user.can?(:delete_work_item, task)
- task
- else
- # Fail early if user cannot delete task
- raise_resource_not_available_error!
- end
- end
- end
- end
-end
diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb
index 2c1c9e5a3bd..76590f95687 100644
--- a/app/graphql/types/issue_type.rb
+++ b/app/graphql/types/issue_type.rb
@@ -111,7 +111,7 @@ module Types
field :time_estimate, GraphQL::Types::Int, null: false,
description: 'Time estimate of the issue.'
field :total_time_spent, GraphQL::Types::Int, null: false,
- description: 'Total time reported as spent on the issue.'
+ description: 'Total time (in seconds) reported as spent on the issue.'
field :closed_at, Types::TimeType, null: true,
description: 'Timestamp of when the issue was closed.'
diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb
index 9dca82f1750..d7c3b313f84 100644
--- a/app/graphql/types/merge_request_type.rb
+++ b/app/graphql/types/merge_request_type.rb
@@ -199,7 +199,7 @@ module Types
field :time_estimate, GraphQL::Types::Int, null: false,
description: 'Time estimate of the merge request.'
field :total_time_spent, GraphQL::Types::Int, null: false,
- description: 'Total time reported as spent on the merge request.'
+ description: 'Total time (in seconds) reported as spent on the merge request.'
field :approved, GraphQL::Types::Boolean,
method: :approved?,
diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb
index 5593911d1fb..d6c064f6882 100644
--- a/app/graphql/types/mutation_type.rb
+++ b/app/graphql/types/mutation_type.rb
@@ -188,7 +188,6 @@ module Types
mount_mutation Mutations::WorkItems::Create, alpha: { milestone: '15.1' }
mount_mutation Mutations::WorkItems::CreateFromTask, alpha: { milestone: '15.1' }
mount_mutation Mutations::WorkItems::Delete, alpha: { milestone: '15.1' }
- mount_mutation Mutations::WorkItems::DeleteTask, alpha: { milestone: '15.1' }
mount_mutation Mutations::WorkItems::Update, alpha: { milestone: '15.1' }
mount_mutation Mutations::WorkItems::UpdateTask, alpha: { milestone: '15.1' }
mount_mutation Mutations::WorkItems::Export, alpha: { milestone: '15.10' }
diff --git a/app/graphql/types/work_items/deleted_task_input_type.rb b/app/graphql/types/work_items/deleted_task_input_type.rb
deleted file mode 100644
index 92297876c89..00000000000
--- a/app/graphql/types/work_items/deleted_task_input_type.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-module Types
- module WorkItems
- class DeletedTaskInputType < BaseInputObject
- graphql_name 'WorkItemDeletedTaskInput'
-
- argument :id, ::Types::GlobalIDType[::WorkItem],
- required: true,
- description: 'Global ID of the task referenced in the work item\'s description.'
- argument :line_number_end, GraphQL::Types::Int,
- required: true,
- description: 'Last line in the Markdown source that defines the list item task.'
- argument :line_number_start, GraphQL::Types::Int,
- required: true,
- description: 'First line in the Markdown source that defines the list item task.'
- end
- end
-end
diff --git a/app/models/concerns/time_trackable.rb b/app/models/concerns/time_trackable.rb
index 0f361e70a91..70bc45b382a 100644
--- a/app/models/concerns/time_trackable.rb
+++ b/app/models/concerns/time_trackable.rb
@@ -45,7 +45,13 @@ module TimeTrackable
# rubocop:enable Gitlab/ModuleWithInstanceVariables
def total_time_spent
- timelogs.sum(:time_spent)
+ sum = timelogs.sum(:time_spent)
+
+ # A new restriction has been introduced to limit total time spent to -
+ # Timelog::MAX_TOTAL_TIME_SPENT or 3.154e+7 seconds (approximately a year, a generous limit)
+ # Since there could be existing records that breach the limit, check and return the maximum/minimum allowed value.
+ # (some issuable might have total time spent that's negative because a validation was missing.)
+ sum.clamp(-Timelog::MAX_TOTAL_TIME_SPENT, Timelog::MAX_TOTAL_TIME_SPENT)
end
def human_total_time_spent
diff --git a/app/models/deploy_token.rb b/app/models/deploy_token.rb
index 1ab603b5ddf..60ecdf6c367 100644
--- a/app/models/deploy_token.rb
+++ b/app/models/deploy_token.rb
@@ -10,7 +10,6 @@ class DeployToken < ApplicationRecord
read_package_registry write_package_registry].freeze
GITLAB_DEPLOY_TOKEN_NAME = 'gitlab-deploy-token'
DEPLOY_TOKEN_PREFIX = 'gldt-'
- REQUIRED_DEPENDENCY_PROXY_SCOPES = %i[read_registry write_registry].freeze
add_authentication_token_field :token, encrypted: :required, format_with_prefix: :prefix_for_deploy_token
@@ -58,7 +57,7 @@ class DeployToken < ApplicationRecord
def valid_for_dependency_proxy?
group_type? &&
active? &&
- REQUIRED_DEPENDENCY_PROXY_SCOPES.all? { |scope| scope.in?(scopes) }
+ (Gitlab::Auth::REGISTRY_SCOPES & scopes).size == Gitlab::Auth::REGISTRY_SCOPES.size
end
def revoke!
diff --git a/app/models/timelog.rb b/app/models/timelog.rb
index c7f96f550d5..0ae7790eef9 100644
--- a/app/models/timelog.rb
+++ b/app/models/timelog.rb
@@ -1,6 +1,10 @@
# frozen_string_literal: true
class Timelog < ApplicationRecord
+ # Gitlab::TimeTrackingFormatter.parse("1y") == 31557600 seconds
+ # 31557600 slightly deviates from (365 days * 24 hours/day * 60 minutes/hour * 60 seconds/minute)
+ MAX_TOTAL_TIME_SPENT = 31557600.seconds.to_i # a year
+
include Importable
include Sortable
@@ -9,6 +13,7 @@ class Timelog < ApplicationRecord
validates :time_spent, :user, presence: true
validates :summary, length: { maximum: 255 }
validate :issuable_id_is_present, unless: :importing?
+ validate :check_total_time_spent_is_within_range, on: :create, unless: :importing?, if: :time_spent
belongs_to :issue, touch: true
belongs_to :merge_request, touch: true
@@ -55,6 +60,13 @@ class Timelog < ApplicationRecord
private
+ def check_total_time_spent_is_within_range
+ total_time_spent = issuable.timelogs.sum(:time_spent) + time_spent
+
+ errors.add(:base, _("Total time spent cannot be negative.")) if total_time_spent < 0
+ errors.add(:base, _("Total time spent cannot exceed a year.")) if total_time_spent > MAX_TOTAL_TIME_SPENT
+ end
+
def issuable_id_is_present
if issue_id && merge_request_id
errors.add(:base, _('Only Issue ID or merge request ID is required'))
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb
index 15bab8ab007..255538c538a 100644
--- a/app/policies/project_policy.rb
+++ b/app/policies/project_policy.rb
@@ -191,7 +191,9 @@ class ProjectPolicy < BasePolicy
end
with_scope :subject
- condition(:model_registry_enabled) { Feature.enabled?(:model_registry, @subject) }
+ condition(:model_registry_enabled) do
+ Feature.enabled?(:model_registry, @subject) && @subject.feature_available?(:model_registry, @user)
+ end
with_scope :subject
condition(:resource_access_token_feature_available) do
diff --git a/app/services/auth/dependency_proxy_authentication_service.rb b/app/services/auth/dependency_proxy_authentication_service.rb
index 164594d6f6c..29f5a50d809 100644
--- a/app/services/auth/dependency_proxy_authentication_service.rb
+++ b/app/services/auth/dependency_proxy_authentication_service.rb
@@ -5,10 +5,11 @@ module Auth
AUDIENCE = 'dependency_proxy'
HMAC_KEY = 'gitlab-dependency-proxy'
DEFAULT_EXPIRE_TIME = 1.minute
+ REQUIRED_ABILITIES = %i[read_container_image create_container_image].freeze
def execute(authentication_abilities:)
return error('dependency proxy not enabled', 404) unless ::Gitlab.config.dependency_proxy.enabled
- return error('access forbidden', 403) unless valid_user_actor?
+ return error('access forbidden', 403) unless valid_user_actor?(authentication_abilities)
{ token: authorized_token.encoded }
end
@@ -33,8 +34,27 @@ module Auth
private
- def valid_user_actor?
- current_user || valid_deploy_token?
+ def valid_user_actor?(authentication_abilities)
+ feature_user = deploy_token&.user || current_user
+ if Feature.enabled?(:packages_dependency_proxy_containers_scope_check, feature_user)
+ if deploy_token
+ deploy_token.valid_for_dependency_proxy?
+ elsif current_user&.project_bot?
+ group_access_token&.active? && has_required_abilities?(authentication_abilities)
+ else
+ current_user
+ end
+ else
+ current_user || valid_deploy_token?
+ end
+ end
+
+ def has_required_abilities?(authentication_abilities)
+ (REQUIRED_ABILITIES & authentication_abilities).size == REQUIRED_ABILITIES.size
+ end
+
+ def group_access_token
+ PersonalAccessTokensFinder.new(state: 'active').find_by_token(raw_token)
end
def valid_deploy_token?
@@ -52,5 +72,9 @@ module Auth
def deploy_token
params[:deploy_token]
end
+
+ def raw_token
+ params[:raw_token]
+ end
end
end
diff --git a/app/services/ci/pipeline_schedules/variables_base_save_service.rb b/app/services/ci/pipeline_schedules/variables_base_save_service.rb
new file mode 100644
index 00000000000..fb3ba52b36e
--- /dev/null
+++ b/app/services/ci/pipeline_schedules/variables_base_save_service.rb
@@ -0,0 +1,52 @@
+# frozen_string_literal: true
+
+module Ci
+ module PipelineSchedules
+ class VariablesBaseSaveService
+ include Gitlab::Utils::StrongMemoize
+
+ def execute
+ variable.assign_attributes(params)
+
+ return forbidden_to_update_pipeline_schedule unless allowed_to_update_pipeline_schedule?
+ return forbidden_to_save_variables unless allowed_to_save_variables?
+
+ if variable.save
+ ServiceResponse.success(payload: variable)
+ else
+ ServiceResponse.error(payload: variable, message: variable.errors.full_messages)
+ end
+ end
+
+ private
+
+ attr_reader :project, :user, :params, :variable, :pipeline_schedule
+
+ def allowed_to_update_pipeline_schedule?
+ user.can?(:update_pipeline_schedule, pipeline_schedule)
+ end
+
+ def forbidden_to_update_pipeline_schedule
+ # We add the error to the base object too
+ # because model errors are used in the API responses and the `form_errors` helper.
+ pipeline_schedule.errors.add(:base, authorize_message)
+
+ ServiceResponse.error(payload: pipeline_schedule, message: [authorize_message], reason: :forbidden)
+ end
+
+ def allowed_to_save_variables?
+ user.can?(:set_pipeline_variables, project)
+ end
+
+ def forbidden_to_save_variables
+ message = _('The current user is not authorized to set pipeline schedule variables')
+
+ # We add the error to the base object too
+ # because model errors are used in the API responses and the `form_errors` helper.
+ pipeline_schedule.errors.add(:base, message)
+
+ ServiceResponse.error(payload: pipeline_schedule, message: [message], reason: :forbidden)
+ end
+ end
+ end
+end
diff --git a/app/services/ci/pipeline_schedules/variables_create_service.rb b/app/services/ci/pipeline_schedules/variables_create_service.rb
new file mode 100644
index 00000000000..7d81b0771dc
--- /dev/null
+++ b/app/services/ci/pipeline_schedules/variables_create_service.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+module Ci
+ module PipelineSchedules
+ class VariablesCreateService < VariablesBaseSaveService
+ AUTHORIZE = :update_pipeline_schedule
+
+ def initialize(pipeline_schedule, user, params)
+ @variable = pipeline_schedule.variables.new
+ @user = user
+ @pipeline_schedule = pipeline_schedule
+ @project = pipeline_schedule.project
+ @params = params
+ end
+
+ private
+
+ def authorize_message
+ _('The current user is not authorized to create the pipeline schedule variables')
+ end
+ strong_memoize_attr :authorize_message
+ end
+ end
+end
diff --git a/app/services/ci/pipeline_schedules/variables_update_service.rb b/app/services/ci/pipeline_schedules/variables_update_service.rb
new file mode 100644
index 00000000000..f0e3a03c37a
--- /dev/null
+++ b/app/services/ci/pipeline_schedules/variables_update_service.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+module Ci
+ module PipelineSchedules
+ class VariablesUpdateService < VariablesBaseSaveService
+ AUTHORIZE = :update_pipeline_schedule
+
+ def initialize(pipeline_schedule_variable, user, params)
+ @variable = pipeline_schedule_variable
+ @user = user
+ @pipeline_schedule = pipeline_schedule_variable.pipeline_schedule
+ @project = pipeline_schedule.project
+ @params = params
+ end
+
+ private
+
+ def authorize_message
+ _('The current user is not authorized to update the pipeline schedule variables')
+ end
+ strong_memoize_attr :authorize_message
+ end
+ end
+end
diff --git a/app/services/personal_access_tokens/rotate_service.rb b/app/services/personal_access_tokens/rotate_service.rb
index 55eff1e69aa..e381d86fbed 100644
--- a/app/services/personal_access_tokens/rotate_service.rb
+++ b/app/services/personal_access_tokens/rotate_service.rb
@@ -10,27 +10,19 @@ module PersonalAccessTokens
end
def execute(params = {})
- return error_response(message: _('token already revoked')) if token.revoked?
+ return error_response(_('token already revoked')) if token.revoked?
response = ServiceResponse.success
PersonalAccessToken.transaction do
unless token.revoke!
- response = error_response
+ response = error_response(_('failed to revoke token'))
raise ActiveRecord::Rollback
end
- target_user = token.user
- new_token = target_user.personal_access_tokens.create(create_token_params(token, params))
+ response = create_access_token(params)
- if new_token.persisted?
- response = error_response unless update_bot_membership(target_user, new_token.expires_at)
- response = success_response(new_token)
- else
- response = error_response(message: new_token.errors.full_messages.to_sentence)
-
- raise ActiveRecord::Rollback
- end
+ raise ActiveRecord::Rollback unless response.success?
end
response
@@ -40,6 +32,16 @@ module PersonalAccessTokens
attr_reader :current_user, :token
+ def create_access_token(params)
+ target_user = token.user
+
+ new_token = target_user.personal_access_tokens.create(create_token_params(token, params))
+
+ return success_response(new_token) if new_token.persisted?
+
+ error_response(new_token.errors.full_messages.to_sentence)
+ end
+
def expires_at(params)
return params[:expires_at] if params[:expires_at]
@@ -50,22 +52,16 @@ module PersonalAccessTokens
ServiceResponse.success(payload: { personal_access_token: new_token })
end
- def error_response(message: _('failed to revoke token'))
+ def error_response(message)
ServiceResponse.error(message: message)
end
def create_token_params(token, params)
- { name: token.name,
- previous_personal_access_token_id: token.id,
- impersonation: token.impersonation,
- scopes: token.scopes,
- expires_at: expires_at(params) }
- end
-
- def update_bot_membership(target_user, expires_at)
- return unless target_user.project_bot?
-
- target_user.members.first.update(expires_at: expires_at)
+ { name: token.name,
+ previous_personal_access_token_id: token.id,
+ impersonation: token.impersonation,
+ scopes: token.scopes,
+ expires_at: expires_at(params) }
end
end
end
diff --git a/app/services/project_access_tokens/rotate_service.rb b/app/services/project_access_tokens/rotate_service.rb
new file mode 100644
index 00000000000..63d8d2a82cc
--- /dev/null
+++ b/app/services/project_access_tokens/rotate_service.rb
@@ -0,0 +1,58 @@
+# frozen_string_literal: true
+
+module ProjectAccessTokens
+ class RotateService < ::PersonalAccessTokens::RotateService
+ extend ::Gitlab::Utils::Override
+
+ def initialize(current_user, token, resource = nil)
+ @current_user = current_user
+ @token = token
+ @project = resource
+ end
+
+ def execute(params = {})
+ super
+ end
+
+ attr_reader :project
+
+ private
+
+ override :create_access_token
+ def create_access_token(params)
+ target_user = token.user
+
+ unless valid_access_level?
+ return error_response(
+ _("Not eligible to rotate token with access level higher than the user")
+ )
+ end
+
+ new_token = target_user.personal_access_tokens.create(create_token_params(token, params))
+
+ if new_token.persisted?
+ update_bot_membership(target_user, new_token.expires_at)
+
+ return success_response(new_token)
+ end
+
+ error_response(new_token.errors.full_messages.to_sentence)
+ end
+
+ def update_bot_membership(target_user, expires_at)
+ target_user.members.update(expires_at: expires_at)
+ end
+
+ def valid_access_level?
+ return true if current_user.can_admin_all_resources?
+ return false unless current_user.can?(:manage_resource_access_tokens, project)
+
+ token_access_level = project.team.max_member_access(token.user.id).to_i
+ current_user_access_level = project.team.max_member_access(current_user.id).to_i
+
+ return true if token_access_level.to_i <= current_user_access_level
+
+ false
+ end
+ end
+end
diff --git a/app/services/work_items/delete_task_service.rb b/app/services/work_items/delete_task_service.rb
deleted file mode 100644
index 4c0ee2f827d..00000000000
--- a/app/services/work_items/delete_task_service.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# frozen_string_literal: true
-
-module WorkItems
- class DeleteTaskService
- def initialize(work_item:, lock_version:, current_user: nil, task_params: {})
- @work_item = work_item
- @current_user = current_user
- @task_params = task_params
- @lock_version = lock_version
- @task = task_params[:task]
- @errors = []
- end
-
- def execute
- transaction_result = ::WorkItem.transaction do
- replacement_result = TaskListReferenceRemovalService.new(
- work_item: @work_item,
- task: @task,
- line_number_start: @task_params[:line_number_start],
- line_number_end: @task_params[:line_number_end],
- lock_version: @lock_version,
- current_user: @current_user
- ).execute
-
- next ::ServiceResponse.error(message: replacement_result.errors, http_status: 422) if replacement_result.error?
-
- delete_result = ::WorkItems::DeleteService.new(
- container: @task.project,
- current_user: @current_user
- ).execute(@task)
-
- if delete_result.error?
- @errors += delete_result.errors
- raise ActiveRecord::Rollback
- end
-
- delete_result
- end
-
- return transaction_result if transaction_result
-
- ::ServiceResponse.error(message: @errors, http_status: 422)
- end
- end
-end
diff --git a/app/services/work_items/task_list_reference_removal_service.rb b/app/services/work_items/task_list_reference_removal_service.rb
deleted file mode 100644
index 843b03906ac..00000000000
--- a/app/services/work_items/task_list_reference_removal_service.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# frozen_string_literal: true
-
-module WorkItems
- class TaskListReferenceRemovalService
- STALE_OBJECT_MESSAGE = 'Stale work item. Check lock version'
-
- def initialize(work_item:, task:, line_number_start:, line_number_end:, lock_version:, current_user:)
- @work_item = work_item
- @task = task
- @line_number_start = line_number_start
- @line_number_end = line_number_end
- @lock_version = lock_version
- @current_user = current_user
- @task_reference = /#{Regexp.escape(@task.to_reference)}(?!\d)\+/
- end
-
- def execute
- return ::ServiceResponse.error(message: 'line_number_start must be greater than 0') if @line_number_start < 1
- return ::ServiceResponse.error(message: "Work item description can't be blank") if @work_item.description.blank?
-
- if @line_number_end < @line_number_start
- return ::ServiceResponse.error(message: 'line_number_end must be greater or equal to line_number_start')
- end
-
- source_lines = @work_item.description.split("\n")
-
- line_matches_reference = (@line_number_start..@line_number_end).any? do |line_number|
- markdown_line = source_lines[line_number - 1]
-
- if @task_reference.match?(markdown_line)
- markdown_line.sub!(@task_reference, @task.title)
- end
- end
-
- unless line_matches_reference
- return ::ServiceResponse.error(
- message: "Unable to detect a task on lines #{@line_number_start}-#{@line_number_end}"
- )
- end
-
- ::WorkItems::UpdateService.new(
- container: @work_item.project,
- current_user: @current_user,
- params: { description: source_lines.join("\n"), lock_version: @lock_version }
- ).execute(@work_item)
-
- if @work_item.valid?
- ::ServiceResponse.success
- else
- ::ServiceResponse.error(message: @work_item.errors.full_messages)
- end
- rescue ActiveRecord::StaleObjectError
- ::ServiceResponse.error(message: STALE_OBJECT_MESSAGE)
- end
- end
-end
diff --git a/app/validators/json_schemas/cyclonedx_report.json b/app/validators/json_schemas/cyclonedx/bom-1.4.schema.json
index 7b24c05a039..e12594b6e88 100644
--- a/app/validators/json_schemas/cyclonedx_report.json
+++ b/app/validators/json_schemas/cyclonedx/bom-1.4.schema.json
@@ -2611,4 +2611,4 @@
]
}
}
-} \ No newline at end of file
+}
diff --git a/app/validators/json_schemas/cyclonedx/bom-1.5.schema.json b/app/validators/json_schemas/cyclonedx/bom-1.5.schema.json
new file mode 100644
index 00000000000..0bb9fee766f
--- /dev/null
+++ b/app/validators/json_schemas/cyclonedx/bom-1.5.schema.json
@@ -0,0 +1,4895 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "http://cyclonedx.org/schema/bom-1.5.schema.json",
+ "type": "object",
+ "title": "CycloneDX Software Bill of Materials Standard",
+ "$comment": "CycloneDX JSON schema is published under the terms of the Apache License 2.0.",
+ "required": [
+ "bomFormat",
+ "specVersion",
+ "version"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "$schema": {
+ "type": "string",
+ "enum": [
+ "http://cyclonedx.org/schema/bom-1.5.schema.json"
+ ]
+ },
+ "bomFormat": {
+ "type": "string",
+ "title": "BOM Format",
+ "description": "Specifies the format of the BOM. This helps to identify the file as CycloneDX since BOMs do not have a filename convention nor does JSON schema support namespaces. This value MUST be \"CycloneDX\".",
+ "enum": [
+ "CycloneDX"
+ ]
+ },
+ "specVersion": {
+ "type": "string",
+ "title": "CycloneDX Specification Version",
+ "description": "The version of the CycloneDX specification a BOM conforms to (starting at version 1.2).",
+ "examples": [
+ "1.5"
+ ]
+ },
+ "serialNumber": {
+ "type": "string",
+ "title": "BOM Serial Number",
+ "description": "Every BOM generated SHOULD have a unique serial number, even if the contents of the BOM have not changed over time. If specified, the serial number MUST conform to RFC-4122. Use of serial numbers are RECOMMENDED.",
+ "examples": [
+ "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79"
+ ],
+ "pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
+ },
+ "version": {
+ "type": "integer",
+ "title": "BOM Version",
+ "description": "Whenever an existing BOM is modified, either manually or through automated processes, the version of the BOM SHOULD be incremented by 1. When a system is presented with multiple BOMs with identical serial numbers, the system SHOULD use the most recent version of the BOM. The default version is '1'.",
+ "minimum": 1,
+ "default": 1,
+ "examples": [
+ 1
+ ]
+ },
+ "metadata": {
+ "$ref": "#/definitions/metadata",
+ "title": "BOM Metadata",
+ "description": "Provides additional information about a BOM."
+ },
+ "components": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/component"
+ },
+ "uniqueItems": true,
+ "title": "Components",
+ "description": "A list of software and hardware components."
+ },
+ "services": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/service"
+ },
+ "uniqueItems": true,
+ "title": "Services",
+ "description": "A list of services. This may include microservices, function-as-a-service, and other types of network or intra-process services."
+ },
+ "externalReferences": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/externalReference"
+ },
+ "title": "External References",
+ "description": "External references provide a way to document systems, sites, and information that may be relevant, but are not included with the BOM. They may also establish specific relationships within or external to the BOM."
+ },
+ "dependencies": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/dependency"
+ },
+ "uniqueItems": true,
+ "title": "Dependencies",
+ "description": "Provides the ability to document dependency relationships."
+ },
+ "compositions": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/compositions"
+ },
+ "uniqueItems": true,
+ "title": "Compositions",
+ "description": "Compositions describe constituent parts (including components, services, and dependency relationships) and their completeness. The completeness of vulnerabilities expressed in a BOM may also be described."
+ },
+ "vulnerabilities": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/vulnerability"
+ },
+ "uniqueItems": true,
+ "title": "Vulnerabilities",
+ "description": "Vulnerabilities identified in components or services."
+ },
+ "annotations": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/annotations"
+ },
+ "uniqueItems": true,
+ "title": "Annotations",
+ "description": "Comments made by people, organizations, or tools about any object with a bom-ref, such as components, services, vulnerabilities, or the BOM itself. Unlike inventory information, annotations may contain opinion or commentary from various stakeholders. Annotations may be inline (with inventory) or externalized via BOM-Link, and may optionally be signed."
+ },
+ "formulation": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/formula"
+ },
+ "uniqueItems": true,
+ "title": "Formulation",
+ "description": "Describes how a component or service was manufactured or deployed. This is achieved through the use of formulas, workflows, tasks, and steps, which declare the precise steps to reproduce along with the observed formulas describing the steps which transpired in the manufacturing process."
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is OPTIONAL.",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ },
+ "signature": {
+ "$ref": "#/definitions/signature",
+ "title": "Signature",
+ "description": "Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html)."
+ }
+ },
+ "definitions": {
+ "refType": {
+ "description": "Identifier for referable and therefore interlink-able elements.",
+ "type": "string",
+ "minLength": 1,
+ "$comment": "value SHOULD not start with the BOM-Link intro 'urn:cdx:'"
+ },
+ "refLinkType": {
+ "description": "Descriptor for an element identified by the attribute 'bom-ref' in the same BOM document.\nIn contrast to `bomLinkElementType`.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/refType"
+ }
+ ]
+ },
+ "bomLinkDocumentType": {
+ "title": "BOM-Link Document",
+ "description": "Descriptor for another BOM document. See https://cyclonedx.org/capabilities/bomlink/",
+ "type": "string",
+ "format": "iri-reference",
+ "pattern": "^urn:cdx:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/[1-9][0-9]*$",
+ "$comment": "part of the pattern is based on `bom.serialNumber`'s pattern"
+ },
+ "bomLinkElementType": {
+ "title": "BOM-Link Element",
+ "description": "Descriptor for an element in a BOM document. See https://cyclonedx.org/capabilities/bomlink/",
+ "type": "string",
+ "format": "iri-reference",
+ "pattern": "^urn:cdx:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/[1-9][0-9]*#.+$",
+ "$comment": "part of the pattern is based on `bom.serialNumber`'s pattern"
+ },
+ "bomLink": {
+ "anyOf": [
+ {
+ "title": "BOM-Link Document",
+ "$ref": "#/definitions/bomLinkDocumentType"
+ },
+ {
+ "title": "BOM-Link Element",
+ "$ref": "#/definitions/bomLinkElementType"
+ }
+ ]
+ },
+ "metadata": {
+ "type": "object",
+ "title": "BOM Metadata Object",
+ "additionalProperties": false,
+ "properties": {
+ "timestamp": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Timestamp",
+ "description": "The date and time (timestamp) when the BOM was created."
+ },
+ "lifecycles": {
+ "type": "array",
+ "title": "Lifecycles",
+ "description": "",
+ "items": {
+ "type": "object",
+ "title": "Lifecycle",
+ "description": "The product lifecycle(s) that this BOM represents.",
+ "oneOf": [
+ {
+ "required": [
+ "phase"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "phase": {
+ "type": "string",
+ "title": "Phase",
+ "description": "A pre-defined phase in the product lifecycle.\n\n* __design__ = BOM produced early in the development lifecycle containing inventory of components and services that are proposed or planned to be used. The inventory may need to be procured, retrieved, or resourced prior to use.\n* __pre-build__ = BOM consisting of information obtained prior to a build process and may contain source files and development artifacts and manifests. The inventory may need to be resolved and retrieved prior to use.\n* __build__ = BOM consisting of information obtained during a build process where component inventory is available for use. The precise versions of resolved components are usually available at this time as well as the provenance of where the components were retrieved from.\n* __post-build__ = BOM consisting of information obtained after a build process has completed and the resulting components(s) are available for further analysis. Built components may exist as the result of a CI/CD process, may have been installed or deployed to a system or device, and may need to be retrieved or extracted from the system or device.\n* __operations__ = BOM produced that represents inventory that is running and operational. This may include staging or production environments and will generally encompass multiple SBOMs describing the applications and operating system, along with HBOMs describing the hardware that makes up the system. Operations Bill of Materials (OBOM) can provide full-stack inventory of runtime environments, configurations, and additional dependencies.\n* __discovery__ = BOM consisting of information observed through network discovery providing point-in-time enumeration of embedded, on-premise, and cloud-native services such as server applications, connected devices, microservices, and serverless functions.\n* __decommission__ = BOM containing inventory that will be, or has been retired from operations.",
+ "enum": [
+ "design",
+ "pre-build",
+ "build",
+ "post-build",
+ "operations",
+ "discovery",
+ "decommission"
+ ]
+ }
+ }
+ },
+ {
+ "required": [
+ "name"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "The name of the lifecycle phase"
+ },
+ "description": {
+ "type": "string",
+ "title": "Description",
+ "description": "The description of the lifecycle phase"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "tools": {
+ "oneOf": [
+ {
+ "type": "object",
+ "title": "Creation Tools",
+ "description": "The tool(s) used in the creation of the BOM.",
+ "additionalProperties": false,
+ "properties": {
+ "components": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/component"
+ },
+ "uniqueItems": true,
+ "title": "Components",
+ "description": "A list of software and hardware components used as tools"
+ },
+ "services": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/service"
+ },
+ "uniqueItems": true,
+ "title": "Services",
+ "description": "A list of services used as tools. This may include microservices, function-as-a-service, and other types of network or intra-process services."
+ }
+ }
+ },
+ {
+ "type": "array",
+ "title": "Creation Tools (legacy)",
+ "description": "[Deprecated] The tool(s) used in the creation of the BOM.",
+ "items": {
+ "$ref": "#/definitions/tool"
+ }
+ }
+ ]
+ },
+ "authors": {
+ "type": "array",
+ "title": "Authors",
+ "description": "The person(s) who created the BOM. Authors are common in BOMs created through manual processes. BOMs created through automated means may not have authors.",
+ "items": {
+ "$ref": "#/definitions/organizationalContact"
+ }
+ },
+ "component": {
+ "title": "Component",
+ "description": "The component that the BOM describes.",
+ "$ref": "#/definitions/component"
+ },
+ "manufacture": {
+ "title": "Manufacture",
+ "description": "The organization that manufactured the component that the BOM describes.",
+ "$ref": "#/definitions/organizationalEntity"
+ },
+ "supplier": {
+ "title": "Supplier",
+ "description": " The organization that supplied the component that the BOM describes. The supplier may often be the manufacturer, but may also be a distributor or repackager.",
+ "$ref": "#/definitions/organizationalEntity"
+ },
+ "licenses": {
+ "title": "BOM License(s)",
+ "$ref": "#/definitions/licenseChoice"
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is OPTIONAL.",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "tool": {
+ "type": "object",
+ "title": "Tool",
+ "description": "[Deprecated] - DO NOT USE. This will be removed in a future version. This will be removed in a future version. Use component or service instead. Information about the automated or manual tool used",
+ "additionalProperties": false,
+ "properties": {
+ "vendor": {
+ "type": "string",
+ "title": "Tool Vendor",
+ "description": "The name of the vendor who created the tool"
+ },
+ "name": {
+ "type": "string",
+ "title": "Tool Name",
+ "description": "The name of the tool"
+ },
+ "version": {
+ "type": "string",
+ "title": "Tool Version",
+ "description": "The version of the tool"
+ },
+ "hashes": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/hash"
+ },
+ "title": "Hashes",
+ "description": "The hashes of the tool (if applicable)."
+ },
+ "externalReferences": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/externalReference"
+ },
+ "title": "External References",
+ "description": "External references provide a way to document systems, sites, and information that may be relevant, but are not included with the BOM. They may also establish specific relationships within or external to the BOM."
+ }
+ }
+ },
+ "organizationalEntity": {
+ "type": "object",
+ "title": "Organizational Entity Object",
+ "description": "",
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the object elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "The name of the organization",
+ "examples": [
+ "Example Inc."
+ ]
+ },
+ "url": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "format": "iri-reference"
+ },
+ "title": "URL",
+ "description": "The URL of the organization. Multiple URLs are allowed.",
+ "examples": [
+ "https://example.com"
+ ]
+ },
+ "contact": {
+ "type": "array",
+ "title": "Contact",
+ "description": "A contact at the organization. Multiple contacts are allowed.",
+ "items": {
+ "$ref": "#/definitions/organizationalContact"
+ }
+ }
+ }
+ },
+ "organizationalContact": {
+ "type": "object",
+ "title": "Organizational Contact Object",
+ "description": "",
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the object elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "The name of a contact",
+ "examples": [
+ "Contact name"
+ ]
+ },
+ "email": {
+ "type": "string",
+ "format": "idn-email",
+ "title": "Email Address",
+ "description": "The email address of the contact.",
+ "examples": [
+ "firstname.lastname@example.com"
+ ]
+ },
+ "phone": {
+ "type": "string",
+ "title": "Phone",
+ "description": "The phone number of the contact.",
+ "examples": [
+ "800-555-1212"
+ ]
+ }
+ }
+ },
+ "component": {
+ "type": "object",
+ "title": "Component Object",
+ "required": [
+ "type",
+ "name"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "application",
+ "framework",
+ "library",
+ "container",
+ "platform",
+ "operating-system",
+ "device",
+ "device-driver",
+ "firmware",
+ "file",
+ "machine-learning-model",
+ "data"
+ ],
+ "title": "Component Type",
+ "description": "Specifies the type of component. For software components, classify as application if no more specific appropriate classification is available or cannot be determined for the component. Types include:\n\n* __application__ = A software application. Refer to [https://en.wikipedia.org/wiki/Application_software](https://en.wikipedia.org/wiki/Application_software) for information about applications.\n* __framework__ = A software framework. Refer to [https://en.wikipedia.org/wiki/Software_framework](https://en.wikipedia.org/wiki/Software_framework) for information on how frameworks vary slightly from libraries.\n* __library__ = A software library. Refer to [https://en.wikipedia.org/wiki/Library_(computing)](https://en.wikipedia.org/wiki/Library_(computing))\n for information about libraries. All third-party and open source reusable components will likely be a library. If the library also has key features of a framework, then it should be classified as a framework. If not, or is unknown, then specifying library is RECOMMENDED.\n* __container__ = A packaging and/or runtime format, not specific to any particular technology, which isolates software inside the container from software outside of a container through virtualization technology. Refer to [https://en.wikipedia.org/wiki/OS-level_virtualization](https://en.wikipedia.org/wiki/OS-level_virtualization)\n* __platform__ = A runtime environment which interprets or executes software. This may include runtimes such as those that execute bytecode or low-code/no-code application platforms.\n* __operating-system__ = A software operating system without regard to deployment model (i.e. installed on physical hardware, virtual machine, image, etc) Refer to [https://en.wikipedia.org/wiki/Operating_system](https://en.wikipedia.org/wiki/Operating_system)\n* __device__ = A hardware device such as a processor, or chip-set. A hardware device containing firmware SHOULD include a component for the physical hardware itself, and another component of type 'firmware' or 'operating-system' (whichever is relevant), describing information about the software running on the device.\n See also the list of [known device properties](https://github.com/CycloneDX/cyclonedx-property-taxonomy/blob/main/cdx/device.md).\n* __device-driver__ = A special type of software that operates or controls a particular type of device. Refer to [https://en.wikipedia.org/wiki/Device_driver](https://en.wikipedia.org/wiki/Device_driver)\n* __firmware__ = A special type of software that provides low-level control over a devices hardware. Refer to [https://en.wikipedia.org/wiki/Firmware](https://en.wikipedia.org/wiki/Firmware)\n* __file__ = A computer file. Refer to [https://en.wikipedia.org/wiki/Computer_file](https://en.wikipedia.org/wiki/Computer_file) for information about files.\n* __machine-learning-model__ = A model based on training data that can make predictions or decisions without being explicitly programmed to do so.\n* __data__ = A collection of discrete values that convey information.",
+ "examples": [
+ "library"
+ ]
+ },
+ "mime-type": {
+ "type": "string",
+ "title": "Mime-Type",
+ "description": "The optional mime-type of the component. When used on file components, the mime-type can provide additional context about the kind of file being represented such as an image, font, or executable. Some library or framework components may also have an associated mime-type.",
+ "examples": [
+ "image/jpeg"
+ ],
+ "pattern": "^[-+a-z0-9.]+/[-+a-z0-9.]+$"
+ },
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the component elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "supplier": {
+ "title": "Component Supplier",
+ "description": " The organization that supplied the component. The supplier may often be the manufacturer, but may also be a distributor or repackager.",
+ "$ref": "#/definitions/organizationalEntity"
+ },
+ "author": {
+ "type": "string",
+ "title": "Component Author",
+ "description": "The person(s) or organization(s) that authored the component",
+ "examples": [
+ "Acme Inc"
+ ]
+ },
+ "publisher": {
+ "type": "string",
+ "title": "Component Publisher",
+ "description": "The person(s) or organization(s) that published the component",
+ "examples": [
+ "Acme Inc"
+ ]
+ },
+ "group": {
+ "type": "string",
+ "title": "Component Group",
+ "description": "The grouping name or identifier. This will often be a shortened, single name of the company or project that produced the component, or the source package or domain name. Whitespace and special characters should be avoided. Examples include: apache, org.apache.commons, and apache.org.",
+ "examples": [
+ "com.acme"
+ ]
+ },
+ "name": {
+ "type": "string",
+ "title": "Component Name",
+ "description": "The name of the component. This will often be a shortened, single name of the component. Examples: commons-lang3 and jquery",
+ "examples": [
+ "tomcat-catalina"
+ ]
+ },
+ "version": {
+ "type": "string",
+ "title": "Component Version",
+ "description": "The component version. The version should ideally comply with semantic versioning but is not enforced.",
+ "examples": [
+ "9.0.14"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "title": "Component Description",
+ "description": "Specifies a description for the component"
+ },
+ "scope": {
+ "type": "string",
+ "enum": [
+ "required",
+ "optional",
+ "excluded"
+ ],
+ "title": "Component Scope",
+ "description": "Specifies the scope of the component. If scope is not specified, 'required' scope SHOULD be assumed by the consumer of the BOM.",
+ "default": "required"
+ },
+ "hashes": {
+ "type": "array",
+ "title": "Component Hashes",
+ "items": {
+ "$ref": "#/definitions/hash"
+ }
+ },
+ "licenses": {
+ "$ref": "#/definitions/licenseChoice",
+ "title": "Component License(s)"
+ },
+ "copyright": {
+ "type": "string",
+ "title": "Component Copyright",
+ "description": "A copyright notice informing users of the underlying claims to copyright ownership in a published work.",
+ "examples": [
+ "Acme Inc"
+ ]
+ },
+ "cpe": {
+ "type": "string",
+ "title": "Component Common Platform Enumeration (CPE)",
+ "description": "Specifies a well-formed CPE name that conforms to the CPE 2.2 or 2.3 specification. See [https://nvd.nist.gov/products/cpe](https://nvd.nist.gov/products/cpe)",
+ "examples": [
+ "cpe:2.3:a:acme:component_framework:-:*:*:*:*:*:*:*"
+ ]
+ },
+ "purl": {
+ "type": "string",
+ "title": "Component Package URL (purl)",
+ "description": "Specifies the package-url (purl). The purl, if specified, MUST be valid and conform to the specification defined at: [https://github.com/package-url/purl-spec](https://github.com/package-url/purl-spec)",
+ "examples": [
+ "pkg:maven/com.acme/tomcat-catalina@9.0.14?packaging=jar"
+ ]
+ },
+ "swid": {
+ "$ref": "#/definitions/swid",
+ "title": "SWID Tag",
+ "description": "Specifies metadata and content for [ISO-IEC 19770-2 Software Identification (SWID) Tags](https://www.iso.org/standard/65666.html)."
+ },
+ "modified": {
+ "type": "boolean",
+ "title": "Component Modified From Original",
+ "description": "[Deprecated] - DO NOT USE. This will be removed in a future version. Use the pedigree element instead to supply information on exactly how the component was modified. A boolean value indicating if the component has been modified from the original. A value of true indicates the component is a derivative of the original. A value of false indicates the component has not been modified from the original."
+ },
+ "pedigree": {
+ "type": "object",
+ "title": "Component Pedigree",
+ "description": "Component pedigree is a way to document complex supply chain scenarios where components are created, distributed, modified, redistributed, combined with other components, etc. Pedigree supports viewing this complex chain from the beginning, the end, or anywhere in the middle. It also provides a way to document variants where the exact relation may not be known.",
+ "additionalProperties": false,
+ "properties": {
+ "ancestors": {
+ "type": "array",
+ "title": "Ancestors",
+ "description": "Describes zero or more components in which a component is derived from. This is commonly used to describe forks from existing projects where the forked version contains a ancestor node containing the original component it was forked from. For example, Component A is the original component. Component B is the component being used and documented in the BOM. However, Component B contains a pedigree node with a single ancestor documenting Component A - the original component from which Component B is derived from.",
+ "items": {
+ "$ref": "#/definitions/component"
+ }
+ },
+ "descendants": {
+ "type": "array",
+ "title": "Descendants",
+ "description": "Descendants are the exact opposite of ancestors. This provides a way to document all forks (and their forks) of an original or root component.",
+ "items": {
+ "$ref": "#/definitions/component"
+ }
+ },
+ "variants": {
+ "type": "array",
+ "title": "Variants",
+ "description": "Variants describe relations where the relationship between the components are not known. For example, if Component A contains nearly identical code to Component B. They are both related, but it is unclear if one is derived from the other, or if they share a common ancestor.",
+ "items": {
+ "$ref": "#/definitions/component"
+ }
+ },
+ "commits": {
+ "type": "array",
+ "title": "Commits",
+ "description": "A list of zero or more commits which provide a trail describing how the component deviates from an ancestor, descendant, or variant.",
+ "items": {
+ "$ref": "#/definitions/commit"
+ }
+ },
+ "patches": {
+ "type": "array",
+ "title": "Patches",
+ "description": ">A list of zero or more patches describing how the component deviates from an ancestor, descendant, or variant. Patches may be complimentary to commits or may be used in place of commits.",
+ "items": {
+ "$ref": "#/definitions/patch"
+ }
+ },
+ "notes": {
+ "type": "string",
+ "title": "Notes",
+ "description": "Notes, observations, and other non-structured commentary describing the components pedigree."
+ }
+ }
+ },
+ "externalReferences": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/externalReference"
+ },
+ "title": "External References",
+ "description": "External references provide a way to document systems, sites, and information that may be relevant, but are not included with the BOM. They may also establish specific relationships within or external to the BOM."
+ },
+ "components": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/component"
+ },
+ "uniqueItems": true,
+ "title": "Components",
+ "description": "A list of software and hardware components included in the parent component. This is not a dependency tree. It provides a way to specify a hierarchical representation of component assemblies, similar to system &#8594; subsystem &#8594; parts assembly in physical supply chains."
+ },
+ "evidence": {
+ "$ref": "#/definitions/componentEvidence",
+ "title": "Evidence",
+ "description": "Provides the ability to document evidence collected through various forms of extraction or analysis."
+ },
+ "releaseNotes": {
+ "$ref": "#/definitions/releaseNotes",
+ "title": "Release notes",
+ "description": "Specifies optional release notes."
+ },
+ "modelCard": {
+ "$ref": "#/definitions/modelCard",
+ "title": "Machine Learning Model Card"
+ },
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/componentData"
+ },
+ "title": "Data",
+ "description": "This object SHOULD be specified for any component of type `data` and MUST NOT be specified for other component types."
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is OPTIONAL.",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ },
+ "signature": {
+ "$ref": "#/definitions/signature",
+ "title": "Signature",
+ "description": "Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html)."
+ }
+ }
+ },
+ "swid": {
+ "type": "object",
+ "title": "SWID Tag",
+ "description": "Specifies metadata and content for ISO-IEC 19770-2 Software Identification (SWID) Tags.",
+ "required": [
+ "tagId",
+ "name"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "tagId": {
+ "type": "string",
+ "title": "Tag ID",
+ "description": "Maps to the tagId of a SoftwareIdentity."
+ },
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "Maps to the name of a SoftwareIdentity."
+ },
+ "version": {
+ "type": "string",
+ "title": "Version",
+ "default": "0.0",
+ "description": "Maps to the version of a SoftwareIdentity."
+ },
+ "tagVersion": {
+ "type": "integer",
+ "title": "Tag Version",
+ "default": 0,
+ "description": "Maps to the tagVersion of a SoftwareIdentity."
+ },
+ "patch": {
+ "type": "boolean",
+ "title": "Patch",
+ "default": false,
+ "description": "Maps to the patch of a SoftwareIdentity."
+ },
+ "text": {
+ "title": "Attachment text",
+ "description": "Specifies the metadata and content of the SWID tag.",
+ "$ref": "#/definitions/attachment"
+ },
+ "url": {
+ "type": "string",
+ "title": "URL",
+ "description": "The URL to the SWID file.",
+ "format": "iri-reference"
+ }
+ }
+ },
+ "attachment": {
+ "type": "object",
+ "title": "Attachment",
+ "description": "Specifies the metadata and content for an attachment.",
+ "required": [
+ "content"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "contentType": {
+ "type": "string",
+ "title": "Content-Type",
+ "description": "Specifies the content type of the text. Defaults to text/plain if not specified.",
+ "default": "text/plain"
+ },
+ "encoding": {
+ "type": "string",
+ "title": "Encoding",
+ "description": "Specifies the optional encoding the text is represented in.",
+ "enum": [
+ "base64"
+ ]
+ },
+ "content": {
+ "type": "string",
+ "title": "Attachment Text",
+ "description": "The attachment data. Proactive controls such as input validation and sanitization should be employed to prevent misuse of attachment text."
+ }
+ }
+ },
+ "hash": {
+ "type": "object",
+ "title": "Hash Objects",
+ "required": [
+ "alg",
+ "content"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "alg": {
+ "$ref": "#/definitions/hash-alg"
+ },
+ "content": {
+ "$ref": "#/definitions/hash-content"
+ }
+ }
+ },
+ "hash-alg": {
+ "type": "string",
+ "enum": [
+ "MD5",
+ "SHA-1",
+ "SHA-256",
+ "SHA-384",
+ "SHA-512",
+ "SHA3-256",
+ "SHA3-384",
+ "SHA3-512",
+ "BLAKE2b-256",
+ "BLAKE2b-384",
+ "BLAKE2b-512",
+ "BLAKE3"
+ ],
+ "title": "Hash Algorithm"
+ },
+ "hash-content": {
+ "type": "string",
+ "title": "Hash Content (value)",
+ "examples": [
+ "3942447fac867ae5cdb3229b658f4d48"
+ ],
+ "pattern": "^([a-fA-F0-9]{32}|[a-fA-F0-9]{40}|[a-fA-F0-9]{64}|[a-fA-F0-9]{96}|[a-fA-F0-9]{128})$"
+ },
+ "license": {
+ "type": "object",
+ "title": "License Object",
+ "oneOf": [
+ {
+ "required": [
+ "id"
+ ]
+ },
+ {
+ "required": [
+ "name"
+ ]
+ }
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the license elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "id": {
+ "title": "License ID (SPDX)",
+ "description": "A valid SPDX license ID",
+ "examples": [
+ "Apache-2.0"
+ ],
+ "type": "string",
+ "enum": [
+ "0BSD",
+ "AAL",
+ "Abstyles",
+ "AdaCore-doc",
+ "Adobe-2006",
+ "Adobe-Glyph",
+ "ADSL",
+ "AFL-1.1",
+ "AFL-1.2",
+ "AFL-2.0",
+ "AFL-2.1",
+ "AFL-3.0",
+ "Afmparse",
+ "AGPL-1.0",
+ "AGPL-1.0-only",
+ "AGPL-1.0-or-later",
+ "AGPL-3.0",
+ "AGPL-3.0-only",
+ "AGPL-3.0-or-later",
+ "Aladdin",
+ "AMDPLPA",
+ "AML",
+ "AMPAS",
+ "ANTLR-PD",
+ "ANTLR-PD-fallback",
+ "Apache-1.0",
+ "Apache-1.1",
+ "Apache-2.0",
+ "APAFML",
+ "APL-1.0",
+ "App-s2p",
+ "APSL-1.0",
+ "APSL-1.1",
+ "APSL-1.2",
+ "APSL-2.0",
+ "Arphic-1999",
+ "Artistic-1.0",
+ "Artistic-1.0-cl8",
+ "Artistic-1.0-Perl",
+ "Artistic-2.0",
+ "ASWF-Digital-Assets-1.0",
+ "ASWF-Digital-Assets-1.1",
+ "Baekmuk",
+ "Bahyph",
+ "Barr",
+ "Beerware",
+ "Bitstream-Charter",
+ "Bitstream-Vera",
+ "BitTorrent-1.0",
+ "BitTorrent-1.1",
+ "blessing",
+ "BlueOak-1.0.0",
+ "Boehm-GC",
+ "Borceux",
+ "Brian-Gladman-3-Clause",
+ "BSD-1-Clause",
+ "BSD-2-Clause",
+ "BSD-2-Clause-FreeBSD",
+ "BSD-2-Clause-NetBSD",
+ "BSD-2-Clause-Patent",
+ "BSD-2-Clause-Views",
+ "BSD-3-Clause",
+ "BSD-3-Clause-Attribution",
+ "BSD-3-Clause-Clear",
+ "BSD-3-Clause-LBNL",
+ "BSD-3-Clause-Modification",
+ "BSD-3-Clause-No-Military-License",
+ "BSD-3-Clause-No-Nuclear-License",
+ "BSD-3-Clause-No-Nuclear-License-2014",
+ "BSD-3-Clause-No-Nuclear-Warranty",
+ "BSD-3-Clause-Open-MPI",
+ "BSD-4-Clause",
+ "BSD-4-Clause-Shortened",
+ "BSD-4-Clause-UC",
+ "BSD-4.3RENO",
+ "BSD-4.3TAHOE",
+ "BSD-Advertising-Acknowledgement",
+ "BSD-Attribution-HPND-disclaimer",
+ "BSD-Protection",
+ "BSD-Source-Code",
+ "BSL-1.0",
+ "BUSL-1.1",
+ "bzip2-1.0.5",
+ "bzip2-1.0.6",
+ "C-UDA-1.0",
+ "CAL-1.0",
+ "CAL-1.0-Combined-Work-Exception",
+ "Caldera",
+ "CATOSL-1.1",
+ "CC-BY-1.0",
+ "CC-BY-2.0",
+ "CC-BY-2.5",
+ "CC-BY-2.5-AU",
+ "CC-BY-3.0",
+ "CC-BY-3.0-AT",
+ "CC-BY-3.0-DE",
+ "CC-BY-3.0-IGO",
+ "CC-BY-3.0-NL",
+ "CC-BY-3.0-US",
+ "CC-BY-4.0",
+ "CC-BY-NC-1.0",
+ "CC-BY-NC-2.0",
+ "CC-BY-NC-2.5",
+ "CC-BY-NC-3.0",
+ "CC-BY-NC-3.0-DE",
+ "CC-BY-NC-4.0",
+ "CC-BY-NC-ND-1.0",
+ "CC-BY-NC-ND-2.0",
+ "CC-BY-NC-ND-2.5",
+ "CC-BY-NC-ND-3.0",
+ "CC-BY-NC-ND-3.0-DE",
+ "CC-BY-NC-ND-3.0-IGO",
+ "CC-BY-NC-ND-4.0",
+ "CC-BY-NC-SA-1.0",
+ "CC-BY-NC-SA-2.0",
+ "CC-BY-NC-SA-2.0-DE",
+ "CC-BY-NC-SA-2.0-FR",
+ "CC-BY-NC-SA-2.0-UK",
+ "CC-BY-NC-SA-2.5",
+ "CC-BY-NC-SA-3.0",
+ "CC-BY-NC-SA-3.0-DE",
+ "CC-BY-NC-SA-3.0-IGO",
+ "CC-BY-NC-SA-4.0",
+ "CC-BY-ND-1.0",
+ "CC-BY-ND-2.0",
+ "CC-BY-ND-2.5",
+ "CC-BY-ND-3.0",
+ "CC-BY-ND-3.0-DE",
+ "CC-BY-ND-4.0",
+ "CC-BY-SA-1.0",
+ "CC-BY-SA-2.0",
+ "CC-BY-SA-2.0-UK",
+ "CC-BY-SA-2.1-JP",
+ "CC-BY-SA-2.5",
+ "CC-BY-SA-3.0",
+ "CC-BY-SA-3.0-AT",
+ "CC-BY-SA-3.0-DE",
+ "CC-BY-SA-3.0-IGO",
+ "CC-BY-SA-4.0",
+ "CC-PDDC",
+ "CC0-1.0",
+ "CDDL-1.0",
+ "CDDL-1.1",
+ "CDL-1.0",
+ "CDLA-Permissive-1.0",
+ "CDLA-Permissive-2.0",
+ "CDLA-Sharing-1.0",
+ "CECILL-1.0",
+ "CECILL-1.1",
+ "CECILL-2.0",
+ "CECILL-2.1",
+ "CECILL-B",
+ "CECILL-C",
+ "CERN-OHL-1.1",
+ "CERN-OHL-1.2",
+ "CERN-OHL-P-2.0",
+ "CERN-OHL-S-2.0",
+ "CERN-OHL-W-2.0",
+ "CFITSIO",
+ "checkmk",
+ "ClArtistic",
+ "Clips",
+ "CMU-Mach",
+ "CNRI-Jython",
+ "CNRI-Python",
+ "CNRI-Python-GPL-Compatible",
+ "COIL-1.0",
+ "Community-Spec-1.0",
+ "Condor-1.1",
+ "copyleft-next-0.3.0",
+ "copyleft-next-0.3.1",
+ "Cornell-Lossless-JPEG",
+ "CPAL-1.0",
+ "CPL-1.0",
+ "CPOL-1.02",
+ "Crossword",
+ "CrystalStacker",
+ "CUA-OPL-1.0",
+ "Cube",
+ "curl",
+ "D-FSL-1.0",
+ "diffmark",
+ "DL-DE-BY-2.0",
+ "DOC",
+ "Dotseqn",
+ "DRL-1.0",
+ "DSDP",
+ "dtoa",
+ "dvipdfm",
+ "ECL-1.0",
+ "ECL-2.0",
+ "eCos-2.0",
+ "EFL-1.0",
+ "EFL-2.0",
+ "eGenix",
+ "Elastic-2.0",
+ "Entessa",
+ "EPICS",
+ "EPL-1.0",
+ "EPL-2.0",
+ "ErlPL-1.1",
+ "etalab-2.0",
+ "EUDatagrid",
+ "EUPL-1.0",
+ "EUPL-1.1",
+ "EUPL-1.2",
+ "Eurosym",
+ "Fair",
+ "FDK-AAC",
+ "Frameworx-1.0",
+ "FreeBSD-DOC",
+ "FreeImage",
+ "FSFAP",
+ "FSFUL",
+ "FSFULLR",
+ "FSFULLRWD",
+ "FTL",
+ "GD",
+ "GFDL-1.1",
+ "GFDL-1.1-invariants-only",
+ "GFDL-1.1-invariants-or-later",
+ "GFDL-1.1-no-invariants-only",
+ "GFDL-1.1-no-invariants-or-later",
+ "GFDL-1.1-only",
+ "GFDL-1.1-or-later",
+ "GFDL-1.2",
+ "GFDL-1.2-invariants-only",
+ "GFDL-1.2-invariants-or-later",
+ "GFDL-1.2-no-invariants-only",
+ "GFDL-1.2-no-invariants-or-later",
+ "GFDL-1.2-only",
+ "GFDL-1.2-or-later",
+ "GFDL-1.3",
+ "GFDL-1.3-invariants-only",
+ "GFDL-1.3-invariants-or-later",
+ "GFDL-1.3-no-invariants-only",
+ "GFDL-1.3-no-invariants-or-later",
+ "GFDL-1.3-only",
+ "GFDL-1.3-or-later",
+ "Giftware",
+ "GL2PS",
+ "Glide",
+ "Glulxe",
+ "GLWTPL",
+ "gnuplot",
+ "GPL-1.0",
+ "GPL-1.0+",
+ "GPL-1.0-only",
+ "GPL-1.0-or-later",
+ "GPL-2.0",
+ "GPL-2.0+",
+ "GPL-2.0-only",
+ "GPL-2.0-or-later",
+ "GPL-2.0-with-autoconf-exception",
+ "GPL-2.0-with-bison-exception",
+ "GPL-2.0-with-classpath-exception",
+ "GPL-2.0-with-font-exception",
+ "GPL-2.0-with-GCC-exception",
+ "GPL-3.0",
+ "GPL-3.0+",
+ "GPL-3.0-only",
+ "GPL-3.0-or-later",
+ "GPL-3.0-with-autoconf-exception",
+ "GPL-3.0-with-GCC-exception",
+ "Graphics-Gems",
+ "gSOAP-1.3b",
+ "HaskellReport",
+ "Hippocratic-2.1",
+ "HP-1986",
+ "HPND",
+ "HPND-export-US",
+ "HPND-Markus-Kuhn",
+ "HPND-sell-variant",
+ "HPND-sell-variant-MIT-disclaimer",
+ "HTMLTIDY",
+ "IBM-pibs",
+ "ICU",
+ "IEC-Code-Components-EULA",
+ "IJG",
+ "IJG-short",
+ "ImageMagick",
+ "iMatix",
+ "Imlib2",
+ "Info-ZIP",
+ "Inner-Net-2.0",
+ "Intel",
+ "Intel-ACPI",
+ "Interbase-1.0",
+ "IPA",
+ "IPL-1.0",
+ "ISC",
+ "Jam",
+ "JasPer-2.0",
+ "JPL-image",
+ "JPNIC",
+ "JSON",
+ "Kazlib",
+ "Knuth-CTAN",
+ "LAL-1.2",
+ "LAL-1.3",
+ "Latex2e",
+ "Latex2e-translated-notice",
+ "Leptonica",
+ "LGPL-2.0",
+ "LGPL-2.0+",
+ "LGPL-2.0-only",
+ "LGPL-2.0-or-later",
+ "LGPL-2.1",
+ "LGPL-2.1+",
+ "LGPL-2.1-only",
+ "LGPL-2.1-or-later",
+ "LGPL-3.0",
+ "LGPL-3.0+",
+ "LGPL-3.0-only",
+ "LGPL-3.0-or-later",
+ "LGPLLR",
+ "Libpng",
+ "libpng-2.0",
+ "libselinux-1.0",
+ "libtiff",
+ "libutil-David-Nugent",
+ "LiLiQ-P-1.1",
+ "LiLiQ-R-1.1",
+ "LiLiQ-Rplus-1.1",
+ "Linux-man-pages-1-para",
+ "Linux-man-pages-copyleft",
+ "Linux-man-pages-copyleft-2-para",
+ "Linux-man-pages-copyleft-var",
+ "Linux-OpenIB",
+ "LOOP",
+ "LPL-1.0",
+ "LPL-1.02",
+ "LPPL-1.0",
+ "LPPL-1.1",
+ "LPPL-1.2",
+ "LPPL-1.3a",
+ "LPPL-1.3c",
+ "LZMA-SDK-9.11-to-9.20",
+ "LZMA-SDK-9.22",
+ "MakeIndex",
+ "Martin-Birgmeier",
+ "metamail",
+ "Minpack",
+ "MirOS",
+ "MIT",
+ "MIT-0",
+ "MIT-advertising",
+ "MIT-CMU",
+ "MIT-enna",
+ "MIT-feh",
+ "MIT-Festival",
+ "MIT-Modern-Variant",
+ "MIT-open-group",
+ "MIT-Wu",
+ "MITNFA",
+ "Motosoto",
+ "mpi-permissive",
+ "mpich2",
+ "MPL-1.0",
+ "MPL-1.1",
+ "MPL-2.0",
+ "MPL-2.0-no-copyleft-exception",
+ "mplus",
+ "MS-LPL",
+ "MS-PL",
+ "MS-RL",
+ "MTLL",
+ "MulanPSL-1.0",
+ "MulanPSL-2.0",
+ "Multics",
+ "Mup",
+ "NAIST-2003",
+ "NASA-1.3",
+ "Naumen",
+ "NBPL-1.0",
+ "NCGL-UK-2.0",
+ "NCSA",
+ "Net-SNMP",
+ "NetCDF",
+ "Newsletr",
+ "NGPL",
+ "NICTA-1.0",
+ "NIST-PD",
+ "NIST-PD-fallback",
+ "NIST-Software",
+ "NLOD-1.0",
+ "NLOD-2.0",
+ "NLPL",
+ "Nokia",
+ "NOSL",
+ "Noweb",
+ "NPL-1.0",
+ "NPL-1.1",
+ "NPOSL-3.0",
+ "NRL",
+ "NTP",
+ "NTP-0",
+ "Nunit",
+ "O-UDA-1.0",
+ "OCCT-PL",
+ "OCLC-2.0",
+ "ODbL-1.0",
+ "ODC-By-1.0",
+ "OFFIS",
+ "OFL-1.0",
+ "OFL-1.0-no-RFN",
+ "OFL-1.0-RFN",
+ "OFL-1.1",
+ "OFL-1.1-no-RFN",
+ "OFL-1.1-RFN",
+ "OGC-1.0",
+ "OGDL-Taiwan-1.0",
+ "OGL-Canada-2.0",
+ "OGL-UK-1.0",
+ "OGL-UK-2.0",
+ "OGL-UK-3.0",
+ "OGTSL",
+ "OLDAP-1.1",
+ "OLDAP-1.2",
+ "OLDAP-1.3",
+ "OLDAP-1.4",
+ "OLDAP-2.0",
+ "OLDAP-2.0.1",
+ "OLDAP-2.1",
+ "OLDAP-2.2",
+ "OLDAP-2.2.1",
+ "OLDAP-2.2.2",
+ "OLDAP-2.3",
+ "OLDAP-2.4",
+ "OLDAP-2.5",
+ "OLDAP-2.6",
+ "OLDAP-2.7",
+ "OLDAP-2.8",
+ "OLFL-1.3",
+ "OML",
+ "OpenPBS-2.3",
+ "OpenSSL",
+ "OPL-1.0",
+ "OPL-UK-3.0",
+ "OPUBL-1.0",
+ "OSET-PL-2.1",
+ "OSL-1.0",
+ "OSL-1.1",
+ "OSL-2.0",
+ "OSL-2.1",
+ "OSL-3.0",
+ "Parity-6.0.0",
+ "Parity-7.0.0",
+ "PDDL-1.0",
+ "PHP-3.0",
+ "PHP-3.01",
+ "Plexus",
+ "PolyForm-Noncommercial-1.0.0",
+ "PolyForm-Small-Business-1.0.0",
+ "PostgreSQL",
+ "PSF-2.0",
+ "psfrag",
+ "psutils",
+ "Python-2.0",
+ "Python-2.0.1",
+ "Qhull",
+ "QPL-1.0",
+ "QPL-1.0-INRIA-2004",
+ "Rdisc",
+ "RHeCos-1.1",
+ "RPL-1.1",
+ "RPL-1.5",
+ "RPSL-1.0",
+ "RSA-MD",
+ "RSCPL",
+ "Ruby",
+ "SAX-PD",
+ "Saxpath",
+ "SCEA",
+ "SchemeReport",
+ "Sendmail",
+ "Sendmail-8.23",
+ "SGI-B-1.0",
+ "SGI-B-1.1",
+ "SGI-B-2.0",
+ "SGP4",
+ "SHL-0.5",
+ "SHL-0.51",
+ "SimPL-2.0",
+ "SISSL",
+ "SISSL-1.2",
+ "Sleepycat",
+ "SMLNJ",
+ "SMPPL",
+ "SNIA",
+ "snprintf",
+ "Spencer-86",
+ "Spencer-94",
+ "Spencer-99",
+ "SPL-1.0",
+ "SSH-OpenSSH",
+ "SSH-short",
+ "SSPL-1.0",
+ "StandardML-NJ",
+ "SugarCRM-1.1.3",
+ "SunPro",
+ "SWL",
+ "Symlinks",
+ "TAPR-OHL-1.0",
+ "TCL",
+ "TCP-wrappers",
+ "TermReadKey",
+ "TMate",
+ "TORQUE-1.1",
+ "TOSL",
+ "TPDL",
+ "TPL-1.0",
+ "TTWL",
+ "TU-Berlin-1.0",
+ "TU-Berlin-2.0",
+ "UCAR",
+ "UCL-1.0",
+ "Unicode-DFS-2015",
+ "Unicode-DFS-2016",
+ "Unicode-TOU",
+ "UnixCrypt",
+ "Unlicense",
+ "UPL-1.0",
+ "Vim",
+ "VOSTROM",
+ "VSL-1.0",
+ "W3C",
+ "W3C-19980720",
+ "W3C-20150513",
+ "w3m",
+ "Watcom-1.0",
+ "Widget-Workshop",
+ "Wsuipa",
+ "WTFPL",
+ "wxWindows",
+ "X11",
+ "X11-distribute-modifications-variant",
+ "Xdebug-1.03",
+ "Xerox",
+ "Xfig",
+ "XFree86-1.1",
+ "xinetd",
+ "xlock",
+ "Xnet",
+ "xpp",
+ "XSkat",
+ "YPL-1.0",
+ "YPL-1.1",
+ "Zed",
+ "Zend-2.0",
+ "Zimbra-1.3",
+ "Zimbra-1.4",
+ "Zlib",
+ "zlib-acknowledgement",
+ "ZPL-1.1",
+ "ZPL-2.0",
+ "ZPL-2.1",
+ "389-exception",
+ "Asterisk-exception",
+ "Autoconf-exception-2.0",
+ "Autoconf-exception-3.0",
+ "Autoconf-exception-generic",
+ "Autoconf-exception-macro",
+ "Bison-exception-2.2",
+ "Bootloader-exception",
+ "Classpath-exception-2.0",
+ "CLISP-exception-2.0",
+ "cryptsetup-OpenSSL-exception",
+ "DigiRule-FOSS-exception",
+ "eCos-exception-2.0",
+ "Fawkes-Runtime-exception",
+ "FLTK-exception",
+ "Font-exception-2.0",
+ "freertos-exception-2.0",
+ "GCC-exception-2.0",
+ "GCC-exception-3.1",
+ "GNAT-exception",
+ "gnu-javamail-exception",
+ "GPL-3.0-interface-exception",
+ "GPL-3.0-linking-exception",
+ "GPL-3.0-linking-source-exception",
+ "GPL-CC-1.0",
+ "GStreamer-exception-2005",
+ "GStreamer-exception-2008",
+ "i2p-gpl-java-exception",
+ "KiCad-libraries-exception",
+ "LGPL-3.0-linking-exception",
+ "libpri-OpenH323-exception",
+ "Libtool-exception",
+ "Linux-syscall-note",
+ "LLGPL",
+ "LLVM-exception",
+ "LZMA-exception",
+ "mif-exception",
+ "Nokia-Qt-exception-1.1",
+ "OCaml-LGPL-linking-exception",
+ "OCCT-exception-1.0",
+ "OpenJDK-assembly-exception-1.0",
+ "openvpn-openssl-exception",
+ "PS-or-PDF-font-exception-20170817",
+ "QPL-1.0-INRIA-2004-exception",
+ "Qt-GPL-exception-1.0",
+ "Qt-LGPL-exception-1.1",
+ "Qwt-exception-1.0",
+ "SHL-2.0",
+ "SHL-2.1",
+ "SWI-exception",
+ "Swift-exception",
+ "u-boot-exception-2.0",
+ "Universal-FOSS-exception-1.0",
+ "vsftpd-openssl-exception",
+ "WxWindows-exception-3.1",
+ "x11vnc-openssl-exception"
+ ]
+ },
+ "name": {
+ "type": "string",
+ "title": "License Name",
+ "description": "If SPDX does not define the license used, this field may be used to provide the license name",
+ "examples": [
+ "Acme Software License"
+ ]
+ },
+ "text": {
+ "title": "License text",
+ "description": "An optional way to include the textual content of a license.",
+ "$ref": "#/definitions/attachment"
+ },
+ "url": {
+ "type": "string",
+ "title": "License URL",
+ "description": "The URL to the license file. If specified, a 'license' externalReference should also be specified for completeness",
+ "examples": [
+ "https://www.apache.org/licenses/LICENSE-2.0.txt"
+ ],
+ "format": "iri-reference"
+ },
+ "licensing": {
+ "type": "object",
+ "title": "Licensing information",
+ "description": "Licensing details describing the licensor/licensee, license type, renewal and expiration dates, and other important metadata",
+ "additionalProperties": false,
+ "properties": {
+ "altIds": {
+ "type": "array",
+ "title": "Alternate License Identifiers",
+ "description": "License identifiers that may be used to manage licenses and their lifecycle",
+ "items": {
+ "type": "string"
+ }
+ },
+ "licensor": {
+ "title": "Licensor",
+ "description": "The individual or organization that grants a license to another individual or organization",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "organization": {
+ "title": "Licensor (Organization)",
+ "description": "The organization that granted the license",
+ "$ref": "#/definitions/organizationalEntity"
+ },
+ "individual": {
+ "title": "Licensor (Individual)",
+ "description": "The individual, not associated with an organization, that granted the license",
+ "$ref": "#/definitions/organizationalContact"
+ }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "organization"
+ ]
+ },
+ {
+ "required": [
+ "individual"
+ ]
+ }
+ ]
+ },
+ "licensee": {
+ "title": "Licensee",
+ "description": "The individual or organization for which a license was granted to",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "organization": {
+ "title": "Licensee (Organization)",
+ "description": "The organization that was granted the license",
+ "$ref": "#/definitions/organizationalEntity"
+ },
+ "individual": {
+ "title": "Licensee (Individual)",
+ "description": "The individual, not associated with an organization, that was granted the license",
+ "$ref": "#/definitions/organizationalContact"
+ }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "organization"
+ ]
+ },
+ {
+ "required": [
+ "individual"
+ ]
+ }
+ ]
+ },
+ "purchaser": {
+ "title": "Purchaser",
+ "description": "The individual or organization that purchased the license",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "organization": {
+ "title": "Purchaser (Organization)",
+ "description": "The organization that purchased the license",
+ "$ref": "#/definitions/organizationalEntity"
+ },
+ "individual": {
+ "title": "Purchaser (Individual)",
+ "description": "The individual, not associated with an organization, that purchased the license",
+ "$ref": "#/definitions/organizationalContact"
+ }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "organization"
+ ]
+ },
+ {
+ "required": [
+ "individual"
+ ]
+ }
+ ]
+ },
+ "purchaseOrder": {
+ "type": "string",
+ "title": "Purchase Order",
+ "description": "The purchase order identifier the purchaser sent to a supplier or vendor to authorize a purchase"
+ },
+ "licenseTypes": {
+ "type": "array",
+ "title": "License Type",
+ "description": "The type of license(s) that was granted to the licensee\n\n* __academic__ = A license that grants use of software solely for the purpose of education or research.\n* __appliance__ = A license covering use of software embedded in a specific piece of hardware.\n* __client-access__ = A Client Access License (CAL) allows client computers to access services provided by server software.\n* __concurrent-user__ = A Concurrent User license (aka floating license) limits the number of licenses for a software application and licenses are shared among a larger number of users.\n* __core-points__ = A license where the core of a computer's processor is assigned a specific number of points.\n* __custom-metric__ = A license for which consumption is measured by non-standard metrics.\n* __device__ = A license that covers a defined number of installations on computers and other types of devices.\n* __evaluation__ = A license that grants permission to install and use software for trial purposes.\n* __named-user__ = A license that grants access to the software to one or more pre-defined users.\n* __node-locked__ = A license that grants access to the software on one or more pre-defined computers or devices.\n* __oem__ = An Original Equipment Manufacturer license that is delivered with hardware, cannot be transferred to other hardware, and is valid for the life of the hardware.\n* __perpetual__ = A license where the software is sold on a one-time basis and the licensee can use a copy of the software indefinitely.\n* __processor-points__ = A license where each installation consumes points per processor.\n* __subscription__ = A license where the licensee pays a fee to use the software or service.\n* __user__ = A license that grants access to the software or service by a specified number of users.\n* __other__ = Another license type.\n",
+ "items": {
+ "type": "string",
+ "enum": [
+ "academic",
+ "appliance",
+ "client-access",
+ "concurrent-user",
+ "core-points",
+ "custom-metric",
+ "device",
+ "evaluation",
+ "named-user",
+ "node-locked",
+ "oem",
+ "perpetual",
+ "processor-points",
+ "subscription",
+ "user",
+ "other"
+ ]
+ }
+ },
+ "lastRenewal": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Last Renewal",
+ "description": "The timestamp indicating when the license was last renewed. For new purchases, this is often the purchase or acquisition date. For non-perpetual licenses or subscriptions, this is the timestamp of when the license was last renewed."
+ },
+ "expiration": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Expiration",
+ "description": "The timestamp indicating when the current license expires (if applicable)."
+ }
+ }
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is OPTIONAL.",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "licenseChoice": {
+ "title": "License Choice",
+ "description": "EITHER (list of SPDX licenses and/or named licenses) OR (tuple of one SPDX License Expression)",
+ "type": "array",
+ "oneOf": [
+ {
+ "title": "Multiple licenses",
+ "description": "A list of SPDX licenses and/or named licenses.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": [
+ "license"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "license": {
+ "$ref": "#/definitions/license"
+ }
+ }
+ }
+ },
+ {
+ "title": "SPDX License Expression",
+ "description": "A tuple of exactly one SPDX License Expression.",
+ "type": "array",
+ "additionalItems": false,
+ "minItems": 1,
+ "maxItems": 1,
+ "items": [
+ {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "expression"
+ ],
+ "properties": {
+ "expression": {
+ "type": "string",
+ "title": "SPDX License Expression",
+ "examples": [
+ "Apache-2.0 AND (MIT OR GPL-2.0-only)",
+ "GPL-3.0-only WITH Classpath-exception-2.0"
+ ]
+ },
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the license elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ }
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "commit": {
+ "type": "object",
+ "title": "Commit",
+ "description": "Specifies an individual commit",
+ "additionalProperties": false,
+ "properties": {
+ "uid": {
+ "type": "string",
+ "title": "UID",
+ "description": "A unique identifier of the commit. This may be version control specific. For example, Subversion uses revision numbers whereas git uses commit hashes."
+ },
+ "url": {
+ "type": "string",
+ "title": "URL",
+ "description": "The URL to the commit. This URL will typically point to a commit in a version control system.",
+ "format": "iri-reference"
+ },
+ "author": {
+ "title": "Author",
+ "description": "The author who created the changes in the commit",
+ "$ref": "#/definitions/identifiableAction"
+ },
+ "committer": {
+ "title": "Committer",
+ "description": "The person who committed or pushed the commit",
+ "$ref": "#/definitions/identifiableAction"
+ },
+ "message": {
+ "type": "string",
+ "title": "Message",
+ "description": "The text description of the contents of the commit"
+ }
+ }
+ },
+ "patch": {
+ "type": "object",
+ "title": "Patch",
+ "description": "Specifies an individual patch",
+ "required": [
+ "type"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "unofficial",
+ "monkey",
+ "backport",
+ "cherry-pick"
+ ],
+ "title": "Type",
+ "description": "Specifies the purpose for the patch including the resolution of defects, security issues, or new behavior or functionality.\n\n* __unofficial__ = A patch which is not developed by the creators or maintainers of the software being patched. Refer to [https://en.wikipedia.org/wiki/Unofficial_patch](https://en.wikipedia.org/wiki/Unofficial_patch)\n* __monkey__ = A patch which dynamically modifies runtime behavior. Refer to [https://en.wikipedia.org/wiki/Monkey_patch](https://en.wikipedia.org/wiki/Monkey_patch)\n* __backport__ = A patch which takes code from a newer version of software and applies it to older versions of the same software. Refer to [https://en.wikipedia.org/wiki/Backporting](https://en.wikipedia.org/wiki/Backporting)\n* __cherry-pick__ = A patch created by selectively applying commits from other versions or branches of the same software."
+ },
+ "diff": {
+ "title": "Diff",
+ "description": "The patch file (or diff) that show changes. Refer to [https://en.wikipedia.org/wiki/Diff](https://en.wikipedia.org/wiki/Diff)",
+ "$ref": "#/definitions/diff"
+ },
+ "resolves": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/issue"
+ },
+ "title": "Resolves",
+ "description": "A collection of issues the patch resolves"
+ }
+ }
+ },
+ "diff": {
+ "type": "object",
+ "title": "Diff",
+ "description": "The patch file (or diff) that show changes. Refer to https://en.wikipedia.org/wiki/Diff",
+ "additionalProperties": false,
+ "properties": {
+ "text": {
+ "title": "Diff text",
+ "description": "Specifies the optional text of the diff",
+ "$ref": "#/definitions/attachment"
+ },
+ "url": {
+ "type": "string",
+ "title": "URL",
+ "description": "Specifies the URL to the diff",
+ "format": "iri-reference"
+ }
+ }
+ },
+ "issue": {
+ "type": "object",
+ "title": "Diff",
+ "description": "An individual issue that has been resolved.",
+ "required": [
+ "type"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "defect",
+ "enhancement",
+ "security"
+ ],
+ "title": "Type",
+ "description": "Specifies the type of issue"
+ },
+ "id": {
+ "type": "string",
+ "title": "ID",
+ "description": "The identifier of the issue assigned by the source of the issue"
+ },
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "The name of the issue"
+ },
+ "description": {
+ "type": "string",
+ "title": "Description",
+ "description": "A description of the issue"
+ },
+ "source": {
+ "type": "object",
+ "title": "Source",
+ "description": "The source of the issue where it is documented",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "The name of the source. For example 'National Vulnerability Database', 'NVD', and 'Apache'"
+ },
+ "url": {
+ "type": "string",
+ "title": "URL",
+ "description": "The url of the issue documentation as provided by the source",
+ "format": "iri-reference"
+ }
+ }
+ },
+ "references": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "format": "iri-reference"
+ },
+ "title": "References",
+ "description": "A collection of URL's for reference. Multiple URLs are allowed.",
+ "examples": [
+ "https://example.com"
+ ]
+ }
+ }
+ },
+ "identifiableAction": {
+ "type": "object",
+ "title": "Identifiable Action",
+ "description": "Specifies an individual commit",
+ "additionalProperties": false,
+ "properties": {
+ "timestamp": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Timestamp",
+ "description": "The timestamp in which the action occurred"
+ },
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "The name of the individual who performed the action"
+ },
+ "email": {
+ "type": "string",
+ "format": "idn-email",
+ "title": "E-mail",
+ "description": "The email address of the individual who performed the action"
+ }
+ }
+ },
+ "externalReference": {
+ "type": "object",
+ "title": "External Reference",
+ "description": "External references provide a way to document systems, sites, and information that may be relevant, but are not included with the BOM. They may also establish specific relationships within or external to the BOM.",
+ "required": [
+ "url",
+ "type"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "url": {
+ "anyOf": [
+ {
+ "title": "URL",
+ "type": "string",
+ "format": "iri-reference"
+ },
+ {
+ "title": "BOM-Link",
+ "$ref": "#/definitions/bomLink"
+ }
+ ],
+ "title": "URL",
+ "description": "The URI (URL or URN) to the external reference. External references are URIs and therefore can accept any URL scheme including https ([RFC-7230](https://www.ietf.org/rfc/rfc7230.txt)), mailto ([RFC-2368](https://www.ietf.org/rfc/rfc2368.txt)), tel ([RFC-3966](https://www.ietf.org/rfc/rfc3966.txt)), and dns ([RFC-4501](https://www.ietf.org/rfc/rfc4501.txt)). External references may also include formally registered URNs such as [CycloneDX BOM-Link](https://cyclonedx.org/capabilities/bomlink/) to reference CycloneDX BOMs or any object within a BOM. BOM-Link transforms applicable external references into relationships that can be expressed in a BOM or across BOMs."
+ },
+ "comment": {
+ "type": "string",
+ "title": "Comment",
+ "description": "An optional comment describing the external reference"
+ },
+ "type": {
+ "type": "string",
+ "title": "Type",
+ "description": "Specifies the type of external reference.\n\n* __vcs__ = Version Control System\n* __issue-tracker__ = Issue or defect tracking system, or an Application Lifecycle Management (ALM) system\n* __website__ = Website\n* __advisories__ = Security advisories\n* __bom__ = Bill of Materials (SBOM, OBOM, HBOM, SaaSBOM, etc)\n* __mailing-list__ = Mailing list or discussion group\n* __social__ = Social media account\n* __chat__ = Real-time chat platform\n* __documentation__ = Documentation, guides, or how-to instructions\n* __support__ = Community or commercial support\n* __distribution__ = Direct or repository download location\n* __distribution-intake__ = The location where a component was published to. This is often the same as \"distribution\" but may also include specialized publishing processes that act as an intermediary\n* __license__ = The URL to the license file. If a license URL has been defined in the license node, it should also be defined as an external reference for completeness\n* __build-meta__ = Build-system specific meta file (i.e. pom.xml, package.json, .nuspec, etc)\n* __build-system__ = URL to an automated build system\n* __release-notes__ = URL to release notes\n* __security-contact__ = Specifies a way to contact the maintainer, supplier, or provider in the event of a security incident. Common URIs include links to a disclosure procedure, a mailto (RFC-2368) that specifies an email address, a tel (RFC-3966) that specifies a phone number, or dns (RFC-4501) that specifies the records containing DNS Security TXT\n* __model-card__ = A model card describes the intended uses of a machine learning model, potential limitations, biases, ethical considerations, training parameters, datasets used to train the model, performance metrics, and other relevant data useful for ML transparency\n* __log__ = A record of events that occurred in a computer system or application, such as problems, errors, or information on current operations\n* __configuration__ = Parameters or settings that may be used by other components or services\n* __evidence__ = Information used to substantiate a claim\n* __formulation__ = Describes how a component or service was manufactured or deployed\n* __attestation__ = Human or machine-readable statements containing facts, evidence, or testimony\n* __threat-model__ = An enumeration of identified weaknesses, threats, and countermeasures, dataflow diagram (DFD), attack tree, and other supporting documentation in human-readable or machine-readable format\n* __adversary-model__ = The defined assumptions, goals, and capabilities of an adversary.\n* __risk-assessment__ = Identifies and analyzes the potential of future events that may negatively impact individuals, assets, and/or the environment. Risk assessments may also include judgments on the tolerability of each risk.\n* __vulnerability-assertion__ = A Vulnerability Disclosure Report (VDR) which asserts the known and previously unknown vulnerabilities that affect a component, service, or product including the analysis and findings describing the impact (or lack of impact) that the reported vulnerability has on a component, service, or product.\n* __exploitability-statement__ = A Vulnerability Exploitability eXchange (VEX) which asserts the known vulnerabilities that do not affect a product, product family, or organization, and optionally the ones that do. The VEX should include the analysis and findings describing the impact (or lack of impact) that the reported vulnerability has on the product, product family, or organization.\n* __pentest-report__ = Results from an authorized simulated cyberattack on a component or service, otherwise known as a penetration test\n* __static-analysis-report__ = SARIF or proprietary machine or human-readable report for which static analysis has identified code quality, security, and other potential issues with the source code\n* __dynamic-analysis-report__ = Dynamic analysis report that has identified issues such as vulnerabilities and misconfigurations\n* __runtime-analysis-report__ = Report generated by analyzing the call stack of a running application\n* __component-analysis-report__ = Report generated by Software Composition Analysis (SCA), container analysis, or other forms of component analysis\n* __maturity-report__ = Report containing a formal assessment of an organization, business unit, or team against a maturity model\n* __certification-report__ = Industry, regulatory, or other certification from an accredited (if applicable) certification body\n* __quality-metrics__ = Report or system in which quality metrics can be obtained\n* __codified-infrastructure__ = Code or configuration that defines and provisions virtualized infrastructure, commonly referred to as Infrastructure as Code (IaC)\n* __poam__ = Plans of Action and Milestones (POAM) compliment an \"attestation\" external reference. POAM is defined by NIST as a \"document that identifies tasks needing to be accomplished. It details resources required to accomplish the elements of the plan, any milestones in meeting the tasks and scheduled completion dates for the milestones\".\n* __other__ = Use this if no other types accurately describe the purpose of the external reference",
+ "enum": [
+ "vcs",
+ "issue-tracker",
+ "website",
+ "advisories",
+ "bom",
+ "mailing-list",
+ "social",
+ "chat",
+ "documentation",
+ "support",
+ "distribution",
+ "distribution-intake",
+ "license",
+ "build-meta",
+ "build-system",
+ "release-notes",
+ "security-contact",
+ "model-card",
+ "log",
+ "configuration",
+ "evidence",
+ "formulation",
+ "attestation",
+ "threat-model",
+ "adversary-model",
+ "risk-assessment",
+ "vulnerability-assertion",
+ "exploitability-statement",
+ "pentest-report",
+ "static-analysis-report",
+ "dynamic-analysis-report",
+ "runtime-analysis-report",
+ "component-analysis-report",
+ "maturity-report",
+ "certification-report",
+ "codified-infrastructure",
+ "quality-metrics",
+ "poam",
+ "other"
+ ]
+ },
+ "hashes": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/hash"
+ },
+ "title": "Hashes",
+ "description": "The hashes of the external reference (if applicable)."
+ }
+ }
+ },
+ "dependency": {
+ "type": "object",
+ "title": "Dependency",
+ "description": "Defines the direct dependencies of a component or service. Components or services that do not have their own dependencies MUST be declared as empty elements within the graph. Components or services that are not represented in the dependency graph MAY have unknown dependencies. It is RECOMMENDED that implementations assume this to be opaque and not an indicator of a object being dependency-free. It is RECOMMENDED to leverage compositions to indicate unknown dependency graphs.",
+ "required": [
+ "ref"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "ref": {
+ "$ref": "#/definitions/refLinkType",
+ "title": "Reference",
+ "description": "References a component or service by its bom-ref attribute"
+ },
+ "dependsOn": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/refLinkType"
+ },
+ "title": "Depends On",
+ "description": "The bom-ref identifiers of the components or services that are dependencies of this dependency object."
+ }
+ }
+ },
+ "service": {
+ "type": "object",
+ "title": "Service Object",
+ "required": [
+ "name"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the service elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "provider": {
+ "title": "Provider",
+ "description": "The organization that provides the service.",
+ "$ref": "#/definitions/organizationalEntity"
+ },
+ "group": {
+ "type": "string",
+ "title": "Service Group",
+ "description": "The grouping name, namespace, or identifier. This will often be a shortened, single name of the company or project that produced the service or domain name. Whitespace and special characters should be avoided.",
+ "examples": [
+ "com.acme"
+ ]
+ },
+ "name": {
+ "type": "string",
+ "title": "Service Name",
+ "description": "The name of the service. This will often be a shortened, single name of the service.",
+ "examples": [
+ "ticker-service"
+ ]
+ },
+ "version": {
+ "type": "string",
+ "title": "Service Version",
+ "description": "The service version.",
+ "examples": [
+ "1.0.0"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "title": "Service Description",
+ "description": "Specifies a description for the service"
+ },
+ "endpoints": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "format": "iri-reference"
+ },
+ "title": "Endpoints",
+ "description": "The endpoint URIs of the service. Multiple endpoints are allowed.",
+ "examples": [
+ "https://example.com/api/v1/ticker"
+ ]
+ },
+ "authenticated": {
+ "type": "boolean",
+ "title": "Authentication Required",
+ "description": "A boolean value indicating if the service requires authentication. A value of true indicates the service requires authentication prior to use. A value of false indicates the service does not require authentication."
+ },
+ "x-trust-boundary": {
+ "type": "boolean",
+ "title": "Crosses Trust Boundary",
+ "description": "A boolean value indicating if use of the service crosses a trust zone or boundary. A value of true indicates that by using the service, a trust boundary is crossed. A value of false indicates that by using the service, a trust boundary is not crossed."
+ },
+ "trustZone": {
+ "type": "string",
+ "title": "Trust Zone",
+ "description": "The name of the trust zone the service resides in."
+ },
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/serviceData"
+ },
+ "title": "Data",
+ "description": "Specifies information about the data including the directional flow of data and the data classification."
+ },
+ "licenses": {
+ "$ref": "#/definitions/licenseChoice",
+ "title": "Component License(s)"
+ },
+ "externalReferences": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/externalReference"
+ },
+ "title": "External References",
+ "description": "External references provide a way to document systems, sites, and information that may be relevant, but are not included with the BOM. They may also establish specific relationships within or external to the BOM."
+ },
+ "services": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/service"
+ },
+ "uniqueItems": true,
+ "title": "Services",
+ "description": "A list of services included or deployed behind the parent service. This is not a dependency tree. It provides a way to specify a hierarchical representation of service assemblies."
+ },
+ "releaseNotes": {
+ "$ref": "#/definitions/releaseNotes",
+ "title": "Release notes",
+ "description": "Specifies optional release notes."
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is OPTIONAL.",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ },
+ "signature": {
+ "$ref": "#/definitions/signature",
+ "title": "Signature",
+ "description": "Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html)."
+ }
+ }
+ },
+ "serviceData": {
+ "type": "object",
+ "title": "Hash Objects",
+ "required": [
+ "flow",
+ "classification"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "flow": {
+ "$ref": "#/definitions/dataFlowDirection",
+ "title": "Directional Flow",
+ "description": "Specifies the flow direction of the data. Direction is relative to the service. Inbound flow states that data enters the service. Outbound flow states that data leaves the service. Bi-directional states that data flows both ways, and unknown states that the direction is not known."
+ },
+ "classification": {
+ "$ref": "#/definitions/dataClassification"
+ },
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "Name for the defined data",
+ "examples": [
+ "Credit card reporting"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "title": "Description",
+ "description": "Short description of the data content and usage",
+ "examples": [
+ "Credit card information being exchanged in between the web app and the database"
+ ]
+ },
+ "governance": {
+ "type": "object",
+ "title": "Data Governance",
+ "$ref": "#/definitions/dataGovernance"
+ },
+ "source": {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "title": "URL",
+ "type": "string",
+ "format": "iri-reference"
+ },
+ {
+ "title": "BOM-Link Element",
+ "$ref": "#/definitions/bomLinkElementType"
+ }
+ ]
+ },
+ "title": "Source",
+ "description": "The URI, URL, or BOM-Link of the components or services the data came in from"
+ },
+ "destination": {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "title": "URL",
+ "type": "string",
+ "format": "iri-reference"
+ },
+ {
+ "title": "BOM-Link Element",
+ "$ref": "#/definitions/bomLinkElementType"
+ }
+ ]
+ },
+ "title": "Destination",
+ "description": "The URI, URL, or BOM-Link of the components or services the data is sent to"
+ }
+ }
+ },
+ "dataFlowDirection": {
+ "type": "string",
+ "enum": [
+ "inbound",
+ "outbound",
+ "bi-directional",
+ "unknown"
+ ],
+ "title": "Data flow direction",
+ "description": "Specifies the flow direction of the data. Direction is relative to the service. Inbound flow states that data enters the service. Outbound flow states that data leaves the service. Bi-directional states that data flows both ways, and unknown states that the direction is not known."
+ },
+ "copyright": {
+ "type": "object",
+ "title": "Copyright",
+ "required": [
+ "text"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "text": {
+ "type": "string",
+ "title": "Copyright Text"
+ }
+ }
+ },
+ "componentEvidence": {
+ "type": "object",
+ "title": "Evidence",
+ "description": "Provides the ability to document evidence collected through various forms of extraction or analysis.",
+ "additionalProperties": false,
+ "properties": {
+ "identity": {
+ "type": "object",
+ "description": "Evidence that substantiates the identity of a component.",
+ "required": [
+ "field"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "field": {
+ "type": "string",
+ "enum": [
+ "group",
+ "name",
+ "version",
+ "purl",
+ "cpe",
+ "swid",
+ "hash"
+ ],
+ "title": "Field",
+ "description": "The identity field of the component which the evidence describes."
+ },
+ "confidence": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1,
+ "title": "Confidence",
+ "description": "The overall confidence of the evidence from 0 - 1, where 1 is 100% confidence."
+ },
+ "methods": {
+ "type": "array",
+ "title": "Methods",
+ "description": "The methods used to extract and/or analyze the evidence.",
+ "items": {
+ "type": "object",
+ "required": [
+ "technique",
+ "confidence"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "technique": {
+ "title": "Technique",
+ "description": "The technique used in this method of analysis.",
+ "type": "string",
+ "enum": [
+ "source-code-analysis",
+ "binary-analysis",
+ "manifest-analysis",
+ "ast-fingerprint",
+ "hash-comparison",
+ "instrumentation",
+ "dynamic-analysis",
+ "filename",
+ "attestation",
+ "other"
+ ]
+ },
+ "confidence": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1,
+ "title": "Confidence",
+ "description": "The confidence of the evidence from 0 - 1, where 1 is 100% confidence. Confidence is specific to the technique used. Each technique of analysis can have independent confidence."
+ },
+ "value": {
+ "type": "string",
+ "title": "Value",
+ "description": "The value or contents of the evidence."
+ }
+ }
+ }
+ },
+ "tools": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "anyOf": [
+ {
+ "title": "Ref",
+ "$ref": "#/definitions/refLinkType"
+ },
+ {
+ "title": "BOM-Link Element",
+ "$ref": "#/definitions/bomLinkElementType"
+ }
+ ]
+ },
+ "title": "BOM References",
+ "description": "The object in the BOM identified by its bom-ref. This is often a component or service, but may be any object type supporting bom-refs. Tools used for analysis should already be defined in the BOM, either in the metadata/tools, components, or formulation."
+ }
+ }
+ },
+ "occurrences": {
+ "type": "array",
+ "title": "Occurrences",
+ "description": "Evidence of individual instances of a component spread across multiple locations.",
+ "items": {
+ "type": "object",
+ "required": [
+ "location"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the occurrence elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "location": {
+ "type": "string",
+ "title": "Location",
+ "description": "The location or path to where the component was found."
+ }
+ }
+ }
+ },
+ "callstack": {
+ "type": "object",
+ "description": "Evidence of the components use through the callstack.",
+ "additionalProperties": false,
+ "properties": {
+ "frames": {
+ "type": "array",
+ "title": "Methods",
+ "items": {
+ "type": "object",
+ "required": [
+ "module"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "package": {
+ "title": "Package",
+ "description": "A package organizes modules into namespaces, providing a unique namespace for each type it contains.",
+ "type": "string"
+ },
+ "module": {
+ "title": "Module",
+ "description": "A module or class that encloses functions/methods and other code.",
+ "type": "string"
+ },
+ "function": {
+ "title": "Function",
+ "description": "A block of code designed to perform a particular task.",
+ "type": "string"
+ },
+ "parameters": {
+ "title": "Parameters",
+ "description": "Optional arguments that are passed to the module or function.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "line": {
+ "title": "Line",
+ "description": "The line number the code that is called resides on.",
+ "type": "integer"
+ },
+ "column": {
+ "title": "Column",
+ "description": "The column the code that is called resides.",
+ "type": "integer"
+ },
+ "fullFilename": {
+ "title": "Full Filename",
+ "description": "The full path and filename of the module.",
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "licenses": {
+ "$ref": "#/definitions/licenseChoice",
+ "title": "Component License(s)"
+ },
+ "copyright": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/copyright"
+ },
+ "title": "Copyright"
+ }
+ }
+ },
+ "compositions": {
+ "type": "object",
+ "title": "Compositions",
+ "required": [
+ "aggregate"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the composition elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "aggregate": {
+ "$ref": "#/definitions/aggregateType",
+ "title": "Aggregate",
+ "description": "Specifies an aggregate type that describe how complete a relationship is.\n\n* __complete__ = The relationship is complete. No further relationships including constituent components, services, or dependencies are known to exist.\n* __incomplete__ = The relationship is incomplete. Additional relationships exist and may include constituent components, services, or dependencies.\n* __incomplete&#95;first&#95;party&#95;only__ = The relationship is incomplete. Only relationships for first-party components, services, or their dependencies are represented.\n* __incomplete&#95;first&#95;party&#95;proprietary&#95;only__ = The relationship is incomplete. Only relationships for first-party components, services, or their dependencies are represented, limited specifically to those that are proprietary.\n* __incomplete&#95;first&#95;party&#95;opensource&#95;only__ = The relationship is incomplete. Only relationships for first-party components, services, or their dependencies are represented, limited specifically to those that are opensource.\n* __incomplete&#95;third&#95;party&#95;only__ = The relationship is incomplete. Only relationships for third-party components, services, or their dependencies are represented.\n* __incomplete&#95;third&#95;party&#95;proprietary&#95;only__ = The relationship is incomplete. Only relationships for third-party components, services, or their dependencies are represented, limited specifically to those that are proprietary.\n* __incomplete&#95;third&#95;party&#95;opensource&#95;only__ = The relationship is incomplete. Only relationships for third-party components, services, or their dependencies are represented, limited specifically to those that are opensource.\n* __unknown__ = The relationship may be complete or incomplete. This usually signifies a 'best-effort' to obtain constituent components, services, or dependencies but the completeness is inconclusive.\n* __not&#95;specified__ = The relationship completeness is not specified.\n"
+ },
+ "assemblies": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "anyOf": [
+ {
+ "title": "Ref",
+ "$ref": "#/definitions/refLinkType"
+ },
+ {
+ "title": "BOM-Link Element",
+ "$ref": "#/definitions/bomLinkElementType"
+ }
+ ]
+ },
+ "title": "BOM references",
+ "description": "The bom-ref identifiers of the components or services being described. Assemblies refer to nested relationships whereby a constituent part may include other constituent parts. References do not cascade to child parts. References are explicit for the specified constituent part only."
+ },
+ "dependencies": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "string"
+ },
+ "title": "BOM references",
+ "description": "The bom-ref identifiers of the components or services being described. Dependencies refer to a relationship whereby an independent constituent part requires another independent constituent part. References do not cascade to transitive dependencies. References are explicit for the specified dependency only."
+ },
+ "vulnerabilities": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "string"
+ },
+ "title": "BOM references",
+ "description": "The bom-ref identifiers of the vulnerabilities being described."
+ },
+ "signature": {
+ "$ref": "#/definitions/signature",
+ "title": "Signature",
+ "description": "Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html)."
+ }
+ }
+ },
+ "aggregateType": {
+ "type": "string",
+ "default": "not_specified",
+ "enum": [
+ "complete",
+ "incomplete",
+ "incomplete_first_party_only",
+ "incomplete_first_party_proprietary_only",
+ "incomplete_first_party_opensource_only",
+ "incomplete_third_party_only",
+ "incomplete_third_party_proprietary_only",
+ "incomplete_third_party_opensource_only",
+ "unknown",
+ "not_specified"
+ ]
+ },
+ "property": {
+ "type": "object",
+ "title": "Lightweight name-value pair",
+ "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is OPTIONAL.",
+ "properties": {
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "The name of the property. Duplicate names are allowed, each potentially having a different value."
+ },
+ "value": {
+ "type": "string",
+ "title": "Value",
+ "description": "The value of the property."
+ }
+ }
+ },
+ "localeType": {
+ "type": "string",
+ "pattern": "^([a-z]{2})(-[A-Z]{2})?$",
+ "title": "Locale",
+ "description": "Defines a syntax for representing two character language code (ISO-639) followed by an optional two character country code. The language code MUST be lower case. If the country code is specified, the country code MUST be upper case. The language code and country code MUST be separated by a minus sign. Examples: en, en-US, fr, fr-CA"
+ },
+ "releaseType": {
+ "type": "string",
+ "examples": [
+ "major",
+ "minor",
+ "patch",
+ "pre-release",
+ "internal"
+ ],
+ "description": "The software versioning type. It is RECOMMENDED that the release type use one of 'major', 'minor', 'patch', 'pre-release', or 'internal'. Representing all possible software release types is not practical, so standardizing on the recommended values, whenever possible, is strongly encouraged.\n\n* __major__ = A major release may contain significant changes or may introduce breaking changes.\n* __minor__ = A minor release, also known as an update, may contain a smaller number of changes than major releases.\n* __patch__ = Patch releases are typically unplanned and may resolve defects or important security issues.\n* __pre-release__ = A pre-release may include alpha, beta, or release candidates and typically have limited support. They provide the ability to preview a release prior to its general availability.\n* __internal__ = Internal releases are not for public consumption and are intended to be used exclusively by the project or manufacturer that produced it."
+ },
+ "note": {
+ "type": "object",
+ "title": "Note",
+ "description": "A note containing the locale and content.",
+ "required": [
+ "text"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "locale": {
+ "$ref": "#/definitions/localeType",
+ "title": "Locale",
+ "description": "The ISO-639 (or higher) language code and optional ISO-3166 (or higher) country code. Examples include: \"en\", \"en-US\", \"fr\" and \"fr-CA\""
+ },
+ "text": {
+ "title": "Release note content",
+ "description": "Specifies the full content of the release note.",
+ "$ref": "#/definitions/attachment"
+ }
+ }
+ },
+ "releaseNotes": {
+ "type": "object",
+ "title": "Release notes",
+ "required": [
+ "type"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "$ref": "#/definitions/releaseType",
+ "title": "Type",
+ "description": "The software versioning type the release note describes."
+ },
+ "title": {
+ "type": "string",
+ "title": "Title",
+ "description": "The title of the release."
+ },
+ "featuredImage": {
+ "type": "string",
+ "format": "iri-reference",
+ "title": "Featured image",
+ "description": "The URL to an image that may be prominently displayed with the release note."
+ },
+ "socialImage": {
+ "type": "string",
+ "format": "iri-reference",
+ "title": "Social image",
+ "description": "The URL to an image that may be used in messaging on social media platforms."
+ },
+ "description": {
+ "type": "string",
+ "title": "Description",
+ "description": "A short description of the release."
+ },
+ "timestamp": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Timestamp",
+ "description": "The date and time (timestamp) when the release note was created."
+ },
+ "aliases": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "title": "Aliases",
+ "description": "One or more alternate names the release may be referred to. This may include unofficial terms used by development and marketing teams (e.g. code names)."
+ },
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "title": "Tags",
+ "description": "One or more tags that may aid in search or retrieval of the release note."
+ },
+ "resolves": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/issue"
+ },
+ "title": "Resolves",
+ "description": "A collection of issues that have been resolved."
+ },
+ "notes": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/note"
+ },
+ "title": "Notes",
+ "description": "Zero or more release notes containing the locale and content. Multiple note objects may be specified to support release notes in a wide variety of languages."
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is OPTIONAL.",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "advisory": {
+ "type": "object",
+ "title": "Advisory",
+ "description": "Title and location where advisory information can be obtained. An advisory is a notification of a threat to a component, service, or system.",
+ "required": [
+ "url"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "title": {
+ "type": "string",
+ "title": "Title",
+ "description": "An optional name of the advisory."
+ },
+ "url": {
+ "type": "string",
+ "title": "URL",
+ "format": "iri-reference",
+ "description": "Location where the advisory can be obtained."
+ }
+ }
+ },
+ "cwe": {
+ "type": "integer",
+ "minimum": 1,
+ "title": "CWE",
+ "description": "Integer representation of a Common Weaknesses Enumerations (CWE). For example 399 (of https://cwe.mitre.org/data/definitions/399.html)"
+ },
+ "severity": {
+ "type": "string",
+ "title": "Severity",
+ "description": "Textual representation of the severity of the vulnerability adopted by the analysis method. If the analysis method uses values other than what is provided, the user is expected to translate appropriately.",
+ "enum": [
+ "critical",
+ "high",
+ "medium",
+ "low",
+ "info",
+ "none",
+ "unknown"
+ ]
+ },
+ "scoreMethod": {
+ "type": "string",
+ "title": "Method",
+ "description": "Specifies the severity or risk scoring methodology or standard used.\n\n* CVSSv2 - [Common Vulnerability Scoring System v2](https://www.first.org/cvss/v2/)\n* CVSSv3 - [Common Vulnerability Scoring System v3](https://www.first.org/cvss/v3-0/)\n* CVSSv31 - [Common Vulnerability Scoring System v3.1](https://www.first.org/cvss/v3-1/)\n* CVSSv4 - [Common Vulnerability Scoring System v4](https://www.first.org/cvss/v4-0/)\n* OWASP - [OWASP Risk Rating Methodology](https://owasp.org/www-community/OWASP_Risk_Rating_Methodology)\n* SSVC - [Stakeholder Specific Vulnerability Categorization](https://github.com/CERTCC/SSVC) (all versions)",
+ "enum": [
+ "CVSSv2",
+ "CVSSv3",
+ "CVSSv31",
+ "CVSSv4",
+ "OWASP",
+ "SSVC",
+ "other"
+ ]
+ },
+ "impactAnalysisState": {
+ "type": "string",
+ "title": "Impact Analysis State",
+ "description": "Declares the current state of an occurrence of a vulnerability, after automated or manual analysis. \n\n* __resolved__ = the vulnerability has been remediated. \n* __resolved\\_with\\_pedigree__ = the vulnerability has been remediated and evidence of the changes are provided in the affected components pedigree containing verifiable commit history and/or diff(s). \n* __exploitable__ = the vulnerability may be directly or indirectly exploitable. \n* __in\\_triage__ = the vulnerability is being investigated. \n* __false\\_positive__ = the vulnerability is not specific to the component or service and was falsely identified or associated. \n* __not\\_affected__ = the component or service is not affected by the vulnerability. Justification should be specified for all not_affected cases.",
+ "enum": [
+ "resolved",
+ "resolved_with_pedigree",
+ "exploitable",
+ "in_triage",
+ "false_positive",
+ "not_affected"
+ ]
+ },
+ "impactAnalysisJustification": {
+ "type": "string",
+ "title": "Impact Analysis Justification",
+ "description": "The rationale of why the impact analysis state was asserted. \n\n* __code\\_not\\_present__ = the code has been removed or tree-shaked. \n* __code\\_not\\_reachable__ = the vulnerable code is not invoked at runtime. \n* __requires\\_configuration__ = exploitability requires a configurable option to be set/unset. \n* __requires\\_dependency__ = exploitability requires a dependency that is not present. \n* __requires\\_environment__ = exploitability requires a certain environment which is not present. \n* __protected\\_by\\_compiler__ = exploitability requires a compiler flag to be set/unset. \n* __protected\\_at\\_runtime__ = exploits are prevented at runtime. \n* __protected\\_at\\_perimeter__ = attacks are blocked at physical, logical, or network perimeter. \n* __protected\\_by\\_mitigating\\_control__ = preventative measures have been implemented that reduce the likelihood and/or impact of the vulnerability.",
+ "enum": [
+ "code_not_present",
+ "code_not_reachable",
+ "requires_configuration",
+ "requires_dependency",
+ "requires_environment",
+ "protected_by_compiler",
+ "protected_at_runtime",
+ "protected_at_perimeter",
+ "protected_by_mitigating_control"
+ ]
+ },
+ "rating": {
+ "type": "object",
+ "title": "Rating",
+ "description": "Defines the severity or risk ratings of a vulnerability.",
+ "additionalProperties": false,
+ "properties": {
+ "source": {
+ "$ref": "#/definitions/vulnerabilitySource",
+ "description": "The source that calculated the severity or risk rating of the vulnerability."
+ },
+ "score": {
+ "type": "number",
+ "title": "Score",
+ "description": "The numerical score of the rating."
+ },
+ "severity": {
+ "$ref": "#/definitions/severity",
+ "description": "Textual representation of the severity that corresponds to the numerical score of the rating."
+ },
+ "method": {
+ "$ref": "#/definitions/scoreMethod"
+ },
+ "vector": {
+ "type": "string",
+ "title": "Vector",
+ "description": "Textual representation of the metric values used to score the vulnerability"
+ },
+ "justification": {
+ "type": "string",
+ "title": "Justification",
+ "description": "An optional reason for rating the vulnerability as it was"
+ }
+ }
+ },
+ "vulnerabilitySource": {
+ "type": "object",
+ "title": "Source",
+ "description": "The source of vulnerability information. This is often the organization that published the vulnerability.",
+ "additionalProperties": false,
+ "properties": {
+ "url": {
+ "type": "string",
+ "title": "URL",
+ "description": "The url of the vulnerability documentation as provided by the source.",
+ "examples": [
+ "https://nvd.nist.gov/vuln/detail/CVE-2021-39182"
+ ]
+ },
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "The name of the source.",
+ "examples": [
+ "NVD",
+ "National Vulnerability Database",
+ "OSS Index",
+ "VulnDB",
+ "GitHub Advisories"
+ ]
+ }
+ }
+ },
+ "vulnerability": {
+ "type": "object",
+ "title": "Vulnerability",
+ "description": "Defines a weakness in a component or service that could be exploited or triggered by a threat source.",
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the vulnerability elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "id": {
+ "type": "string",
+ "title": "ID",
+ "description": "The identifier that uniquely identifies the vulnerability.",
+ "examples": [
+ "CVE-2021-39182",
+ "GHSA-35m5-8cvj-8783",
+ "SNYK-PYTHON-ENROCRYPT-1912876"
+ ]
+ },
+ "source": {
+ "$ref": "#/definitions/vulnerabilitySource",
+ "description": "The source that published the vulnerability."
+ },
+ "references": {
+ "type": "array",
+ "title": "References",
+ "description": "Zero or more pointers to vulnerabilities that are the equivalent of the vulnerability specified. Often times, the same vulnerability may exist in multiple sources of vulnerability intelligence, but have different identifiers. References provide a way to correlate vulnerabilities across multiple sources of vulnerability intelligence.",
+ "items": {
+ "type": "object",
+ "required": [
+ "id",
+ "source"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "type": "string",
+ "title": "ID",
+ "description": "An identifier that uniquely identifies the vulnerability.",
+ "examples": [
+ "CVE-2021-39182",
+ "GHSA-35m5-8cvj-8783",
+ "SNYK-PYTHON-ENROCRYPT-1912876"
+ ]
+ },
+ "source": {
+ "$ref": "#/definitions/vulnerabilitySource",
+ "description": "The source that published the vulnerability."
+ }
+ }
+ }
+ },
+ "ratings": {
+ "type": "array",
+ "title": "Ratings",
+ "description": "List of vulnerability ratings",
+ "items": {
+ "$ref": "#/definitions/rating"
+ }
+ },
+ "cwes": {
+ "type": "array",
+ "title": "CWEs",
+ "description": "List of Common Weaknesses Enumerations (CWEs) codes that describes this vulnerability. For example 399 (of https://cwe.mitre.org/data/definitions/399.html)",
+ "examples": [
+ 399
+ ],
+ "items": {
+ "$ref": "#/definitions/cwe"
+ }
+ },
+ "description": {
+ "type": "string",
+ "title": "Description",
+ "description": "A description of the vulnerability as provided by the source."
+ },
+ "detail": {
+ "type": "string",
+ "title": "Details",
+ "description": "If available, an in-depth description of the vulnerability as provided by the source organization. Details often include information useful in understanding root cause."
+ },
+ "recommendation": {
+ "type": "string",
+ "title": "Recommendation",
+ "description": "Recommendations of how the vulnerability can be remediated or mitigated."
+ },
+ "workaround": {
+ "type": "string",
+ "title": "Workarounds",
+ "description": "A bypass, usually temporary, of the vulnerability that reduces its likelihood and/or impact. Workarounds often involve changes to configuration or deployments."
+ },
+ "proofOfConcept": {
+ "type": "object",
+ "title": "Proof of Concept",
+ "description": "Evidence used to reproduce the vulnerability.",
+ "properties": {
+ "reproductionSteps": {
+ "type": "string",
+ "title": "Steps to Reproduce",
+ "description": "Precise steps to reproduce the vulnerability."
+ },
+ "environment": {
+ "type": "string",
+ "title": "Environment",
+ "description": "A description of the environment in which reproduction was possible."
+ },
+ "supportingMaterial": {
+ "type": "array",
+ "title": "Supporting Material",
+ "description": "Supporting material that helps in reproducing or understanding how reproduction is possible. This may include screenshots, payloads, and PoC exploit code.",
+ "items": {
+ "$ref": "#/definitions/attachment"
+ }
+ }
+ }
+ },
+ "advisories": {
+ "type": "array",
+ "title": "Advisories",
+ "description": "Published advisories of the vulnerability if provided.",
+ "items": {
+ "$ref": "#/definitions/advisory"
+ }
+ },
+ "created": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Created",
+ "description": "The date and time (timestamp) when the vulnerability record was created in the vulnerability database."
+ },
+ "published": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Published",
+ "description": "The date and time (timestamp) when the vulnerability record was first published."
+ },
+ "updated": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Updated",
+ "description": "The date and time (timestamp) when the vulnerability record was last updated."
+ },
+ "rejected": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Rejected",
+ "description": "The date and time (timestamp) when the vulnerability record was rejected (if applicable)."
+ },
+ "credits": {
+ "type": "object",
+ "title": "Credits",
+ "description": "Individuals or organizations credited with the discovery of the vulnerability.",
+ "additionalProperties": false,
+ "properties": {
+ "organizations": {
+ "type": "array",
+ "title": "Organizations",
+ "description": "The organizations credited with vulnerability discovery.",
+ "items": {
+ "$ref": "#/definitions/organizationalEntity"
+ }
+ },
+ "individuals": {
+ "type": "array",
+ "title": "Individuals",
+ "description": "The individuals, not associated with organizations, that are credited with vulnerability discovery.",
+ "items": {
+ "$ref": "#/definitions/organizationalContact"
+ }
+ }
+ }
+ },
+ "tools": {
+ "oneOf": [
+ {
+ "type": "object",
+ "title": "Tools",
+ "description": "The tool(s) used to identify, confirm, or score the vulnerability.",
+ "additionalProperties": false,
+ "properties": {
+ "components": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/component"
+ },
+ "uniqueItems": true,
+ "title": "Components",
+ "description": "A list of software and hardware components used as tools"
+ },
+ "services": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/service"
+ },
+ "uniqueItems": true,
+ "title": "Services",
+ "description": "A list of services used as tools. This may include microservices, function-as-a-service, and other types of network or intra-process services."
+ }
+ }
+ },
+ {
+ "type": "array",
+ "title": "Tools (legacy)",
+ "description": "[Deprecated] The tool(s) used to identify, confirm, or score the vulnerability.",
+ "items": {
+ "$ref": "#/definitions/tool"
+ }
+ }
+ ]
+ },
+ "analysis": {
+ "type": "object",
+ "title": "Impact Analysis",
+ "description": "An assessment of the impact and exploitability of the vulnerability.",
+ "additionalProperties": false,
+ "properties": {
+ "state": {
+ "$ref": "#/definitions/impactAnalysisState"
+ },
+ "justification": {
+ "$ref": "#/definitions/impactAnalysisJustification"
+ },
+ "response": {
+ "type": "array",
+ "title": "Response",
+ "description": "A response to the vulnerability by the manufacturer, supplier, or project responsible for the affected component or service. More than one response is allowed. Responses are strongly encouraged for vulnerabilities where the analysis state is exploitable.",
+ "items": {
+ "type": "string",
+ "enum": [
+ "can_not_fix",
+ "will_not_fix",
+ "update",
+ "rollback",
+ "workaround_available"
+ ]
+ }
+ },
+ "detail": {
+ "type": "string",
+ "title": "Detail",
+ "description": "Detailed description of the impact including methods used during assessment. If a vulnerability is not exploitable, this field should include specific details on why the component or service is not impacted by this vulnerability."
+ },
+ "firstIssued": {
+ "type": "string",
+ "format": "date-time",
+ "title": "First Issued",
+ "description": "The date and time (timestamp) when the analysis was first issued."
+ },
+ "lastUpdated": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Last Updated",
+ "description": "The date and time (timestamp) when the analysis was last updated."
+ }
+ }
+ },
+ "affects": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "required": [
+ "ref"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "ref": {
+ "anyOf": [
+ {
+ "title": "Ref",
+ "$ref": "#/definitions/refLinkType"
+ },
+ {
+ "title": "BOM-Link Element",
+ "$ref": "#/definitions/bomLinkElementType"
+ }
+ ],
+ "title": "Reference",
+ "description": "References a component or service by the objects bom-ref"
+ },
+ "versions": {
+ "type": "array",
+ "title": "Versions",
+ "description": "Zero or more individual versions or range of versions.",
+ "items": {
+ "type": "object",
+ "oneOf": [
+ {
+ "required": [
+ "version"
+ ]
+ },
+ {
+ "required": [
+ "range"
+ ]
+ }
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "version": {
+ "description": "A single version of a component or service.",
+ "$ref": "#/definitions/version"
+ },
+ "range": {
+ "description": "A version range specified in Package URL Version Range syntax (vers) which is defined at https://github.com/package-url/purl-spec/VERSION-RANGE-SPEC.rst",
+ "$ref": "#/definitions/range"
+ },
+ "status": {
+ "description": "The vulnerability status for the version or range of versions.",
+ "$ref": "#/definitions/affectedStatus",
+ "default": "affected"
+ }
+ }
+ }
+ }
+ }
+ },
+ "title": "Affects",
+ "description": "The components or services that are affected by the vulnerability."
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is OPTIONAL.",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "affectedStatus": {
+ "description": "The vulnerability status of a given version or range of versions of a product. The statuses 'affected' and 'unaffected' indicate that the version is affected or unaffected by the vulnerability. The status 'unknown' indicates that it is unknown or unspecified whether the given version is affected. There can be many reasons for an 'unknown' status, including that an investigation has not been undertaken or that a vendor has not disclosed the status.",
+ "type": "string",
+ "enum": [
+ "affected",
+ "unaffected",
+ "unknown"
+ ]
+ },
+ "version": {
+ "description": "A single version of a component or service.",
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 1024
+ },
+ "range": {
+ "description": "A version range specified in Package URL Version Range syntax (vers) which is defined at https://github.com/package-url/purl-spec/VERSION-RANGE-SPEC.rst",
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 1024
+ },
+ "annotations": {
+ "type": "object",
+ "title": "Annotations",
+ "description": "A comment, note, explanation, or similar textual content which provides additional context to the object(s) being annotated.",
+ "required": [
+ "subjects",
+ "annotator",
+ "timestamp",
+ "text"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the annotation elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "subjects": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "anyOf": [
+ {
+ "title": "Ref",
+ "$ref": "#/definitions/refLinkType"
+ },
+ {
+ "title": "BOM-Link Element",
+ "$ref": "#/definitions/bomLinkElementType"
+ }
+ ]
+ },
+ "title": "BOM References",
+ "description": "The object in the BOM identified by its bom-ref. This is often a component or service, but may be any object type supporting bom-refs."
+ },
+ "annotator": {
+ "type": "object",
+ "title": "Annotator",
+ "description": "The organization, person, component, or service which created the textual content of the annotation.",
+ "oneOf": [
+ {
+ "required": [
+ "organization"
+ ]
+ },
+ {
+ "required": [
+ "individual"
+ ]
+ },
+ {
+ "required": [
+ "component"
+ ]
+ },
+ {
+ "required": [
+ "service"
+ ]
+ }
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "organization": {
+ "description": "The organization that created the annotation",
+ "$ref": "#/definitions/organizationalEntity"
+ },
+ "individual": {
+ "description": "The person that created the annotation",
+ "$ref": "#/definitions/organizationalContact"
+ },
+ "component": {
+ "description": "The tool or component that created the annotation",
+ "$ref": "#/definitions/component"
+ },
+ "service": {
+ "description": "The service that created the annotation",
+ "$ref": "#/definitions/service"
+ }
+ }
+ },
+ "timestamp": {
+ "type": "string",
+ "format": "date-time",
+ "title": "Timestamp",
+ "description": "The date and time (timestamp) when the annotation was created."
+ },
+ "text": {
+ "type": "string",
+ "title": "Text",
+ "description": "The textual content of the annotation."
+ },
+ "signature": {
+ "$ref": "#/definitions/signature",
+ "title": "Signature",
+ "description": "Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html)."
+ }
+ }
+ },
+ "modelCard": {
+ "$comment": "Model card support in CycloneDX is derived from TensorFlow Model Card Toolkit released under the Apache 2.0 license and available from https://github.com/tensorflow/model-card-toolkit/blob/main/model_card_toolkit/schema/v0.0.2/model_card.schema.json. In addition, CycloneDX model card support includes portions of VerifyML, also released under the Apache 2.0 license and available from https://github.com/cylynx/verifyml/blob/main/verifyml/model_card_toolkit/schema/v0.0.4/model_card.schema.json.",
+ "type": "object",
+ "title": "Model Card",
+ "description": "A model card describes the intended uses of a machine learning model and potential limitations, including biases and ethical considerations. Model cards typically contain the training parameters, which datasets were used to train the model, performance metrics, and other relevant data useful for ML transparency. This object SHOULD be specified for any component of type `machine-learning-model` and MUST NOT be specified for other component types.",
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the model card elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "modelParameters": {
+ "type": "object",
+ "title": "Model Parameters",
+ "description": "Hyper-parameters for construction of the model.",
+ "additionalProperties": false,
+ "properties": {
+ "approach": {
+ "type": "object",
+ "title": "Approach",
+ "description": "The overall approach to learning used by the model for problem solving.",
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "type": "string",
+ "title": "Learning Type",
+ "description": "Learning types describing the learning problem or hybrid learning problem.",
+ "enum": [
+ "supervised",
+ "unsupervised",
+ "reinforcement-learning",
+ "semi-supervised",
+ "self-supervised"
+ ]
+ }
+ }
+ },
+ "task": {
+ "type": "string",
+ "title": "Task",
+ "description": "Directly influences the input and/or output. Examples include classification, regression, clustering, etc."
+ },
+ "architectureFamily": {
+ "type": "string",
+ "title": "Architecture Family",
+ "description": "The model architecture family such as transformer network, convolutional neural network, residual neural network, LSTM neural network, etc."
+ },
+ "modelArchitecture": {
+ "type": "string",
+ "title": "Model Architecture",
+ "description": "The specific architecture of the model such as GPT-1, ResNet-50, YOLOv3, etc."
+ },
+ "datasets": {
+ "type": "array",
+ "title": "Datasets",
+ "description": "The datasets used to train and evaluate the model.",
+ "items": {
+ "oneOf": [
+ {
+ "title": "Inline Component Data",
+ "$ref": "#/definitions/componentData"
+ },
+ {
+ "type": "object",
+ "title": "Data Component Reference",
+ "additionalProperties": false,
+ "properties": {
+ "ref": {
+ "anyOf": [
+ {
+ "title": "Ref",
+ "$ref": "#/definitions/refLinkType"
+ },
+ {
+ "title": "BOM-Link Element",
+ "$ref": "#/definitions/bomLinkElementType"
+ }
+ ],
+ "title": "Reference",
+ "description": "References a data component by the components bom-ref attribute"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "inputs": {
+ "type": "array",
+ "title": "Inputs",
+ "description": "The input format(s) of the model",
+ "items": {
+ "$ref": "#/definitions/inputOutputMLParameters"
+ }
+ },
+ "outputs": {
+ "type": "array",
+ "title": "Outputs",
+ "description": "The output format(s) from the model",
+ "items": {
+ "$ref": "#/definitions/inputOutputMLParameters"
+ }
+ }
+ }
+ },
+ "quantitativeAnalysis": {
+ "type": "object",
+ "title": "Quantitative Analysis",
+ "description": "A quantitative analysis of the model",
+ "additionalProperties": false,
+ "properties": {
+ "performanceMetrics": {
+ "type": "array",
+ "title": "Performance Metrics",
+ "description": "The model performance metrics being reported. Examples may include accuracy, F1 score, precision, top-3 error rates, MSC, etc.",
+ "items": {
+ "$ref": "#/definitions/performanceMetric"
+ }
+ },
+ "graphics": {
+ "$ref": "#/definitions/graphicsCollection"
+ }
+ }
+ },
+ "considerations": {
+ "type": "object",
+ "title": "Considerations",
+ "description": "What considerations should be taken into account regarding the model's construction, training, and application?",
+ "additionalProperties": false,
+ "properties": {
+ "users": {
+ "type": "array",
+ "title": "Users",
+ "description": "Who are the intended users of the model?",
+ "items": {
+ "type": "string"
+ }
+ },
+ "useCases": {
+ "type": "array",
+ "title": "Use Cases",
+ "description": "What are the intended use cases of the model?",
+ "items": {
+ "type": "string"
+ }
+ },
+ "technicalLimitations": {
+ "type": "array",
+ "title": "Technical Limitations",
+ "description": "What are the known technical limitations of the model? E.g. What kind(s) of data should the model be expected not to perform well on? What are the factors that might degrade model performance?",
+ "items": {
+ "type": "string"
+ }
+ },
+ "performanceTradeoffs": {
+ "type": "array",
+ "title": "Performance Tradeoffs",
+ "description": "What are the known tradeoffs in accuracy/performance of the model?",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ethicalConsiderations": {
+ "type": "array",
+ "title": "Ethical Considerations",
+ "description": "What are the ethical (or environmental) risks involved in the application of this model?",
+ "items": {
+ "$ref": "#/definitions/risk"
+ }
+ },
+ "fairnessAssessments": {
+ "type": "array",
+ "title": "Fairness Assessments",
+ "description": "How does the model affect groups at risk of being systematically disadvantaged? What are the harms and benefits to the various affected groups?",
+ "items": {
+ "$ref": "#/definitions/fairnessAssessment"
+ }
+ }
+ }
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is OPTIONAL.",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "inputOutputMLParameters": {
+ "type": "object",
+ "title": "Input and Output Parameters",
+ "additionalProperties": false,
+ "properties": {
+ "format": {
+ "description": "The data format for input/output to the model. Example formats include string, image, time-series",
+ "type": "string"
+ }
+ }
+ },
+ "componentData": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "bom-ref": {
+ "$ref": "#/definitions/refType",
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the dataset elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
+ },
+ "type": {
+ "type": "string",
+ "title": "Type of Data",
+ "description": "The general theme or subject matter of the data being specified.\n\n* __source-code__ = Any type of code, code snippet, or data-as-code.\n* __configuration__ = Parameters or settings that may be used by other components.\n* __dataset__ = A collection of data.\n* __definition__ = Data that can be used to create new instances of what the definition defines.\n* __other__ = Any other type of data that does not fit into existing definitions.",
+ "enum": [
+ "source-code",
+ "configuration",
+ "dataset",
+ "definition",
+ "other"
+ ]
+ },
+ "name": {
+ "description": "The name of the dataset.",
+ "type": "string"
+ },
+ "contents": {
+ "type": "object",
+ "title": "Data Contents",
+ "description": "The contents or references to the contents of the data being described.",
+ "additionalProperties": false,
+ "properties": {
+ "attachment": {
+ "title": "Data Attachment",
+ "description": "An optional way to include textual or encoded data.",
+ "$ref": "#/definitions/attachment"
+ },
+ "url": {
+ "type": "string",
+ "title": "Data URL",
+ "description": "The URL to where the data can be retrieved.",
+ "format": "iri-reference"
+ },
+ "properties": {
+ "type": "array",
+ "title": "Configuration Properties",
+ "description": "Provides the ability to document name-value parameters used for configuration.",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "classification": {
+ "$ref": "#/definitions/dataClassification"
+ },
+ "sensitiveData": {
+ "type": "array",
+ "description": "A description of any sensitive data in a dataset.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "graphics": {
+ "$ref": "#/definitions/graphicsCollection"
+ },
+ "description": {
+ "description": "A description of the dataset. Can describe size of dataset, whether it's used for source code, training, testing, or validation, etc.",
+ "type": "string"
+ },
+ "governance": {
+ "type": "object",
+ "title": "Data Governance",
+ "$ref": "#/definitions/dataGovernance"
+ }
+ }
+ },
+ "dataGovernance": {
+ "type": "object",
+ "title": "Data Governance",
+ "additionalProperties": false,
+ "properties": {
+ "custodians": {
+ "type": "array",
+ "title": "Data Custodians",
+ "description": "Data custodians are responsible for the safe custody, transport, and storage of data.",
+ "items": {
+ "$ref": "#/definitions/dataGovernanceResponsibleParty"
+ }
+ },
+ "stewards": {
+ "type": "array",
+ "title": "Data Stewards",
+ "description": "Data stewards are responsible for data content, context, and associated business rules.",
+ "items": {
+ "$ref": "#/definitions/dataGovernanceResponsibleParty"
+ }
+ },
+ "owners": {
+ "type": "array",
+ "title": "Data Owners",
+ "description": "Data owners are concerned with risk and appropriate access to data.",
+ "items": {
+ "$ref": "#/definitions/dataGovernanceResponsibleParty"
+ }
+ }
+ }
+ },
+ "dataGovernanceResponsibleParty": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "organization": {
+ "title": "Organization",
+ "$ref": "#/definitions/organizationalEntity"
+ },
+ "contact": {
+ "title": "Individual",
+ "$ref": "#/definitions/organizationalContact"
+ }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "organization"
+ ]
+ },
+ {
+ "required": [
+ "contact"
+ ]
+ }
+ ]
+ },
+ "graphicsCollection": {
+ "type": "object",
+ "title": "Graphics Collection",
+ "description": "A collection of graphics that represent various measurements.",
+ "additionalProperties": false,
+ "properties": {
+ "description": {
+ "description": "A description of this collection of graphics.",
+ "type": "string"
+ },
+ "collection": {
+ "description": "A collection of graphics.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/graphic"
+ }
+ }
+ }
+ },
+ "graphic": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "description": "The name of the graphic.",
+ "type": "string"
+ },
+ "image": {
+ "title": "Graphic Image",
+ "description": "The graphic (vector or raster). Base64 encoding MUST be specified for binary images.",
+ "$ref": "#/definitions/attachment"
+ }
+ }
+ },
+ "performanceMetric": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "description": "The type of performance metric.",
+ "type": "string"
+ },
+ "value": {
+ "description": "The value of the performance metric.",
+ "type": "string"
+ },
+ "slice": {
+ "description": "The name of the slice this metric was computed on. By default, assume this metric is not sliced.",
+ "type": "string"
+ },
+ "confidenceInterval": {
+ "description": "The confidence interval of the metric.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "lowerBound": {
+ "description": "The lower bound of the confidence interval.",
+ "type": "string"
+ },
+ "upperBound": {
+ "description": "The upper bound of the confidence interval.",
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "risk": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "description": "The name of the risk.",
+ "type": "string"
+ },
+ "mitigationStrategy": {
+ "description": "Strategy used to address this risk.",
+ "type": "string"
+ }
+ }
+ },
+ "fairnessAssessment": {
+ "type": "object",
+ "title": "Fairness Assessment",
+ "description": "Information about the benefits and harms of the model to an identified at risk group.",
+ "additionalProperties": false,
+ "properties": {
+ "groupAtRisk": {
+ "type": "string",
+ "description": "The groups or individuals at risk of being systematically disadvantaged by the model."
+ },
+ "benefits": {
+ "type": "string",
+ "description": "Expected benefits to the identified groups."
+ },
+ "harms": {
+ "type": "string",
+ "description": "Expected harms to the identified groups."
+ },
+ "mitigationStrategy": {
+ "type": "string",
+ "description": "With respect to the benefits and harms outlined, please describe any mitigation strategy implemented."
+ }
+ }
+ },
+ "dataClassification": {
+ "type": "string",
+ "title": "Data Classification",
+ "description": "Data classification tags data according to its type, sensitivity, and value if altered, stolen, or destroyed."
+ },
+ "formula": {
+ "title": "Formula",
+ "description": "Describes workflows and resources that captures rules and other aspects of how the associated BOM component or service was formed.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the formula elsewhere in the BOM. Every bom-ref MUST be unique within the BOM.",
+ "$ref": "#/definitions/refType"
+ },
+ "components": {
+ "title": "Components",
+ "description": "Transient components that are used in tasks that constitute one or more of this formula's workflows",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/component"
+ },
+ "uniqueItems": true
+ },
+ "services": {
+ "title": "Services",
+ "description": "Transient services that are used in tasks that constitute one or more of this formula's workflows",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/service"
+ },
+ "uniqueItems": true
+ },
+ "workflows": {
+ "title": "Workflows",
+ "description": "List of workflows that can be declared to accomplish specific orchestrated goals and independently triggered.",
+ "$comment": "Different workflows can be designed to work together to perform end-to-end CI/CD builds and deployments.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/workflow"
+ },
+ "uniqueItems": true
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "workflow": {
+ "title": "Workflow",
+ "description": "A specialized orchestration task.",
+ "$comment": "Workflow are as task themselves and can trigger other workflow tasks. These relationships can be modeled in the taskDependencies graph.",
+ "type": "object",
+ "required": [
+ "bom-ref",
+ "uid",
+ "taskTypes"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the workflow elsewhere in the BOM. Every bom-ref MUST be unique within the BOM.",
+ "$ref": "#/definitions/refType"
+ },
+ "uid": {
+ "title": "Unique Identifier (UID)",
+ "description": "The unique identifier for the resource instance within its deployment context.",
+ "type": "string"
+ },
+ "name": {
+ "title": "Name",
+ "description": "The name of the resource instance.",
+ "type": "string"
+ },
+ "description": {
+ "title": "Description",
+ "description": "A description of the resource instance.",
+ "type": "string"
+ },
+ "resourceReferences": {
+ "title": "Resource references",
+ "description": "References to component or service resources that are used to realize the resource instance.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/resourceReferenceChoice"
+ }
+ },
+ "tasks": {
+ "title": "Tasks",
+ "description": "The tasks that comprise the workflow.",
+ "$comment": "Note that tasks can appear more than once as different instances (by name or UID).",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/task"
+ }
+ },
+ "taskDependencies": {
+ "title": "Task dependency graph",
+ "description": "The graph of dependencies between tasks within the workflow.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/dependency"
+ }
+ },
+ "taskTypes": {
+ "title": "Task types",
+ "description": "Indicates the types of activities performed by the set of workflow tasks.",
+ "$comment": "Currently, these types reflect common CI/CD actions.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/taskType"
+ }
+ },
+ "trigger": {
+ "title": "Trigger",
+ "description": "The trigger that initiated the task.",
+ "$ref": "#/definitions/trigger"
+ },
+ "steps": {
+ "title": "Steps",
+ "description": "The sequence of steps for the task.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/step"
+ },
+ "uniqueItems": true
+ },
+ "inputs": {
+ "title": "Inputs",
+ "description": "Represents resources and data brought into a task at runtime by executor or task commands",
+ "examples": [
+ "a `configuration` file which was declared as a local `component` or `externalReference`"
+ ],
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/inputType"
+ },
+ "uniqueItems": true
+ },
+ "outputs": {
+ "title": "Outputs",
+ "description": "Represents resources and data output from a task at runtime by executor or task commands",
+ "examples": [
+ "a log file or metrics data produced by the task"
+ ],
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/outputType"
+ },
+ "uniqueItems": true
+ },
+ "timeStart": {
+ "title": "Time start",
+ "description": "The date and time (timestamp) when the task started.",
+ "type": "string",
+ "format": "date-time"
+ },
+ "timeEnd": {
+ "title": "Time end",
+ "description": "The date and time (timestamp) when the task ended.",
+ "type": "string",
+ "format": "date-time"
+ },
+ "workspaces": {
+ "title": "Workspaces",
+ "description": "A set of named filesystem or data resource shareable by workflow tasks.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/workspace"
+ }
+ },
+ "runtimeTopology": {
+ "title": "Runtime topology",
+ "description": "A graph of the component runtime topology for workflow's instance.",
+ "$comment": "A description of the runtime component and service topology. This can describe a partial or complete topology used to host and execute the task (e.g., hardware, operating systems, configurations, etc.),",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/dependency"
+ }
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "task": {
+ "title": "Task",
+ "description": "Describes the inputs, sequence of steps and resources used to accomplish a task and its output.",
+ "$comment": "Tasks are building blocks for constructing assemble CI/CD workflows or pipelines.",
+ "type": "object",
+ "required": [
+ "bom-ref",
+ "uid",
+ "taskTypes"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the task elsewhere in the BOM. Every bom-ref MUST be unique within the BOM.",
+ "$ref": "#/definitions/refType"
+ },
+ "uid": {
+ "title": "Unique Identifier (UID)",
+ "description": "The unique identifier for the resource instance within its deployment context.",
+ "type": "string"
+ },
+ "name": {
+ "title": "Name",
+ "description": "The name of the resource instance.",
+ "type": "string"
+ },
+ "description": {
+ "title": "Description",
+ "description": "A description of the resource instance.",
+ "type": "string"
+ },
+ "resourceReferences": {
+ "title": "Resource references",
+ "description": "References to component or service resources that are used to realize the resource instance.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/resourceReferenceChoice"
+ }
+ },
+ "taskTypes": {
+ "title": "Task types",
+ "description": "Indicates the types of activities performed by the set of workflow tasks.",
+ "$comment": "Currently, these types reflect common CI/CD actions.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/taskType"
+ }
+ },
+ "trigger": {
+ "title": "Trigger",
+ "description": "The trigger that initiated the task.",
+ "$ref": "#/definitions/trigger"
+ },
+ "steps": {
+ "title": "Steps",
+ "description": "The sequence of steps for the task.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/step"
+ },
+ "uniqueItems": true
+ },
+ "inputs": {
+ "title": "Inputs",
+ "description": "Represents resources and data brought into a task at runtime by executor or task commands",
+ "examples": [
+ "a `configuration` file which was declared as a local `component` or `externalReference`"
+ ],
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/inputType"
+ },
+ "uniqueItems": true
+ },
+ "outputs": {
+ "title": "Outputs",
+ "description": "Represents resources and data output from a task at runtime by executor or task commands",
+ "examples": [
+ "a log file or metrics data produced by the task"
+ ],
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/outputType"
+ },
+ "uniqueItems": true
+ },
+ "timeStart": {
+ "title": "Time start",
+ "description": "The date and time (timestamp) when the task started.",
+ "type": "string",
+ "format": "date-time"
+ },
+ "timeEnd": {
+ "title": "Time end",
+ "description": "The date and time (timestamp) when the task ended.",
+ "type": "string",
+ "format": "date-time"
+ },
+ "workspaces": {
+ "title": "Workspaces",
+ "description": "A set of named filesystem or data resource shareable by workflow tasks.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/workspace"
+ },
+ "uniqueItems": true
+ },
+ "runtimeTopology": {
+ "title": "Runtime topology",
+ "description": "A graph of the component runtime topology for task's instance.",
+ "$comment": "A description of the runtime component and service topology. This can describe a partial or complete topology used to host and execute the task (e.g., hardware, operating systems, configurations, etc.),",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/dependency"
+ },
+ "uniqueItems": true
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "step": {
+ "type": "object",
+ "description": "Executes specific commands or tools in order to accomplish its owning task as part of a sequence.",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "title": "Name",
+ "description": "A name for the step.",
+ "type": "string"
+ },
+ "description": {
+ "title": "Description",
+ "description": "A description of the step.",
+ "type": "string"
+ },
+ "commands": {
+ "title": "Commands",
+ "description": "Ordered list of commands or directives for the step",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/command"
+ }
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "command": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "executed": {
+ "title": "Executed",
+ "description": "A text representation of the executed command.",
+ "type": "string"
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "workspace": {
+ "title": "Workspace",
+ "description": "A named filesystem or data resource shareable by workflow tasks.",
+ "type": "object",
+ "required": [
+ "bom-ref",
+ "uid"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "bom-ref": {
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the workspace elsewhere in the BOM. Every bom-ref MUST be unique within the BOM.",
+ "$ref": "#/definitions/refType"
+ },
+ "uid": {
+ "title": "Unique Identifier (UID)",
+ "description": "The unique identifier for the resource instance within its deployment context.",
+ "type": "string"
+ },
+ "name": {
+ "title": "Name",
+ "description": "The name of the resource instance.",
+ "type": "string"
+ },
+ "aliases": {
+ "title": "Aliases",
+ "description": "The names for the workspace as referenced by other workflow tasks. Effectively, a name mapping so other tasks can use their own local name in their steps.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "description": {
+ "title": "Description",
+ "description": "A description of the resource instance.",
+ "type": "string"
+ },
+ "resourceReferences": {
+ "title": "Resource references",
+ "description": "References to component or service resources that are used to realize the resource instance.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/resourceReferenceChoice"
+ }
+ },
+ "accessMode": {
+ "title": "Access mode",
+ "description": "Describes the read-write access control for the workspace relative to the owning resource instance.",
+ "type": "string",
+ "enum": [
+ "read-only",
+ "read-write",
+ "read-write-once",
+ "write-once",
+ "write-only"
+ ]
+ },
+ "mountPath": {
+ "title": "Mount path",
+ "description": "A path to a location on disk where the workspace will be available to the associated task's steps.",
+ "type": "string"
+ },
+ "managedDataType": {
+ "title": "Managed data type",
+ "description": "The name of a domain-specific data type the workspace represents.",
+ "$comment": "This property is for CI/CD frameworks that are able to provide access to structured, managed data at a more granular level than a filesystem.",
+ "examples": [
+ "ConfigMap",
+ "Secret"
+ ],
+ "type": "string"
+ },
+ "volumeRequest": {
+ "title": "Volume request",
+ "description": "Identifies the reference to the request for a specific volume type and parameters.",
+ "examples": [
+ "a kubernetes Persistent Volume Claim (PVC) name"
+ ],
+ "type": "string"
+ },
+ "volume": {
+ "title": "Volume",
+ "description": "Information about the actual volume instance allocated to the workspace.",
+ "$comment": "The actual volume allocated may be different than the request.",
+ "examples": [
+ "see https://kubernetes.io/docs/concepts/storage/persistent-volumes/"
+ ],
+ "$ref": "#/definitions/volume"
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "volume": {
+ "title": "Volume",
+ "description": "An identifiable, logical unit of data storage tied to a physical device.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "uid": {
+ "title": "Unique Identifier (UID)",
+ "description": "The unique identifier for the volume instance within its deployment context.",
+ "type": "string"
+ },
+ "name": {
+ "title": "Name",
+ "description": "The name of the volume instance",
+ "type": "string"
+ },
+ "mode": {
+ "title": "Mode",
+ "description": "The mode for the volume instance.",
+ "type": "string",
+ "enum": [
+ "filesystem",
+ "block"
+ ],
+ "default": "filesystem"
+ },
+ "path": {
+ "title": "Path",
+ "description": "The underlying path created from the actual volume.",
+ "type": "string"
+ },
+ "sizeAllocated": {
+ "title": "Size allocated",
+ "description": "The allocated size of the volume accessible to the associated workspace. This should include the scalar size as well as IEC standard unit in either decimal or binary form.",
+ "examples": [
+ "10GB",
+ "2Ti",
+ "1Pi"
+ ],
+ "type": "string"
+ },
+ "persistent": {
+ "title": "Persistent",
+ "description": "Indicates if the volume persists beyond the life of the resource it is associated with.",
+ "type": "boolean"
+ },
+ "remote": {
+ "title": "Remote",
+ "description": "Indicates if the volume is remotely (i.e., network) attached.",
+ "type": "boolean"
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "trigger": {
+ "title": "Trigger",
+ "description": "Represents a resource that can conditionally activate (or fire) tasks based upon associated events and their data.",
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "bom-ref",
+ "uid"
+ ],
+ "properties": {
+ "bom-ref": {
+ "title": "BOM Reference",
+ "description": "An optional identifier which can be used to reference the trigger elsewhere in the BOM. Every bom-ref MUST be unique within the BOM.",
+ "$ref": "#/definitions/refType"
+ },
+ "uid": {
+ "title": "Unique Identifier (UID)",
+ "description": "The unique identifier for the resource instance within its deployment context.",
+ "type": "string"
+ },
+ "name": {
+ "title": "Name",
+ "description": "The name of the resource instance.",
+ "type": "string"
+ },
+ "description": {
+ "title": "Description",
+ "description": "A description of the resource instance.",
+ "type": "string"
+ },
+ "resourceReferences": {
+ "title": "Resource references",
+ "description": "References to component or service resources that are used to realize the resource instance.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/resourceReferenceChoice"
+ }
+ },
+ "type": {
+ "title": "Type",
+ "description": "The source type of event which caused the trigger to fire.",
+ "type": "string",
+ "enum": [
+ "manual",
+ "api",
+ "webhook",
+ "scheduled"
+ ]
+ },
+ "event": {
+ "title": "Event",
+ "description": "The event data that caused the associated trigger to activate.",
+ "$ref": "#/definitions/event"
+ },
+ "conditions": {
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/condition"
+ }
+ },
+ "timeActivated": {
+ "title": "Time activated",
+ "description": "The date and time (timestamp) when the trigger was activated.",
+ "type": "string",
+ "format": "date-time"
+ },
+ "inputs": {
+ "title": "Inputs",
+ "description": "Represents resources and data brought into a task at runtime by executor or task commands",
+ "examples": [
+ "a `configuration` file which was declared as a local `component` or `externalReference`"
+ ],
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/inputType"
+ },
+ "uniqueItems": true
+ },
+ "outputs": {
+ "title": "Outputs",
+ "description": "Represents resources and data output from a task at runtime by executor or task commands",
+ "examples": [
+ "a log file or metrics data produced by the task"
+ ],
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/outputType"
+ },
+ "uniqueItems": true
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "event": {
+ "title": "Event",
+ "description": "Represents something that happened that may trigger a response.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "uid": {
+ "title": "Unique Identifier (UID)",
+ "description": "The unique identifier of the event.",
+ "type": "string"
+ },
+ "description": {
+ "title": "Description",
+ "description": "A description of the event.",
+ "type": "string"
+ },
+ "timeReceived": {
+ "title": "Time Received",
+ "description": "The date and time (timestamp) when the event was received.",
+ "type": "string",
+ "format": "date-time"
+ },
+ "data": {
+ "title": "Data",
+ "description": "Encoding of the raw event data.",
+ "$ref": "#/definitions/attachment"
+ },
+ "source": {
+ "title": "Source",
+ "description": "References the component or service that was the source of the event",
+ "$ref": "#/definitions/resourceReferenceChoice"
+ },
+ "target": {
+ "title": "Target",
+ "description": "References the component or service that was the target of the event",
+ "$ref": "#/definitions/resourceReferenceChoice"
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "inputType": {
+ "title": "Input type",
+ "description": "Type that represents various input data types and formats.",
+ "type": "object",
+ "oneOf": [
+ {
+ "required": [
+ "resource"
+ ]
+ },
+ {
+ "required": [
+ "parameters"
+ ]
+ },
+ {
+ "required": [
+ "environmentVars"
+ ]
+ },
+ {
+ "required": [
+ "data"
+ ]
+ }
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "source": {
+ "title": "Source",
+ "description": "A references to the component or service that provided the input to the task (e.g., reference to a service with data flow value of `inbound`)",
+ "examples": [
+ "source code repository",
+ "database"
+ ],
+ "$ref": "#/definitions/resourceReferenceChoice"
+ },
+ "target": {
+ "title": "Target",
+ "description": "A reference to the component or service that received or stored the input if not the task itself (e.g., a local, named storage workspace)",
+ "examples": [
+ "workspace",
+ "directory"
+ ],
+ "$ref": "#/definitions/resourceReferenceChoice"
+ },
+ "resource": {
+ "title": "Resource",
+ "description": "A reference to an independent resource provided as an input to a task by the workflow runtime.",
+ "examples": [
+ "reference to a configuration file in a repository (i.e., a bom-ref)",
+ "reference to a scanning service used in a task (i.e., a bom-ref)"
+ ],
+ "$ref": "#/definitions/resourceReferenceChoice"
+ },
+ "parameters": {
+ "title": "Parameters",
+ "description": "Inputs that have the form of parameters with names and values.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/parameter"
+ }
+ },
+ "environmentVars": {
+ "title": "Environment variables",
+ "description": "Inputs that have the form of parameters with names and values.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/property"
+ },
+ {
+ "type": "string"
+ }
+ ]
+ }
+ },
+ "data": {
+ "title": "Data",
+ "description": "Inputs that have the form of data.",
+ "$ref": "#/definitions/attachment"
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "outputType": {
+ "type": "object",
+ "oneOf": [
+ {
+ "required": [
+ "resource"
+ ]
+ },
+ {
+ "required": [
+ "environmentVars"
+ ]
+ },
+ {
+ "required": [
+ "data"
+ ]
+ }
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "title": "Type",
+ "description": "Describes the type of data output.",
+ "type": "string",
+ "enum": [
+ "artifact",
+ "attestation",
+ "log",
+ "evidence",
+ "metrics",
+ "other"
+ ]
+ },
+ "source": {
+ "title": "Source",
+ "description": "Component or service that generated or provided the output from the task (e.g., a build tool)",
+ "$ref": "#/definitions/resourceReferenceChoice"
+ },
+ "target": {
+ "title": "Target",
+ "description": "Component or service that received the output from the task (e.g., reference to an artifactory service with data flow value of `outbound`)",
+ "examples": [
+ "a log file described as an `externalReference` within its target domain."
+ ],
+ "$ref": "#/definitions/resourceReferenceChoice"
+ },
+ "resource": {
+ "title": "Resource",
+ "description": "A reference to an independent resource generated as output by the task.",
+ "examples": [
+ "configuration file",
+ "source code",
+ "scanning service"
+ ],
+ "$ref": "#/definitions/resourceReferenceChoice"
+ },
+ "data": {
+ "title": "Data",
+ "description": "Outputs that have the form of data.",
+ "$ref": "#/definitions/attachment"
+ },
+ "environmentVars": {
+ "title": "Environment variables",
+ "description": "Outputs that have the form of environment variables.",
+ "type": "array",
+ "items": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/property"
+ },
+ {
+ "type": "string"
+ }
+ ]
+ },
+ "uniqueItems": true
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "resourceReferenceChoice": {
+ "title": "Resource reference choice",
+ "description": "A reference to a locally defined resource (e.g., a bom-ref) or an externally accessible resource.",
+ "$comment": "Enables reference to a resource that participates in a workflow; using either internal (bom-ref) or external (externalReference) types.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "ref": {
+ "title": "BOM Reference",
+ "description": "References an object by its bom-ref attribute",
+ "anyOf": [
+ {
+ "title": "Ref",
+ "$ref": "#/definitions/refLinkType"
+ },
+ {
+ "title": "BOM-Link Element",
+ "$ref": "#/definitions/bomLinkElementType"
+ }
+ ]
+ },
+ "externalReference": {
+ "title": "External reference",
+ "description": "Reference to an externally accessible resource.",
+ "$ref": "#/definitions/externalReference"
+ }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "ref"
+ ]
+ },
+ {
+ "required": [
+ "externalReference"
+ ]
+ }
+ ]
+ },
+ "condition": {
+ "title": "Condition",
+ "description": "A condition that was used to determine a trigger should be activated.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "description": {
+ "title": "Description",
+ "description": "Describes the set of conditions which cause the trigger to activate.",
+ "type": "string"
+ },
+ "expression": {
+ "title": "Expression",
+ "description": "The logical expression that was evaluated that determined the trigger should be fired.",
+ "type": "string"
+ },
+ "properties": {
+ "type": "array",
+ "title": "Properties",
+ "items": {
+ "$ref": "#/definitions/property"
+ }
+ }
+ }
+ },
+ "taskType": {
+ "type": "string",
+ "enum": [
+ "copy",
+ "clone",
+ "lint",
+ "scan",
+ "merge",
+ "build",
+ "test",
+ "deliver",
+ "deploy",
+ "release",
+ "clean",
+ "other"
+ ]
+ },
+ "parameter": {
+ "title": "Parameter",
+ "description": "A representation of a functional parameter.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "title": "Name",
+ "description": "The name of the parameter.",
+ "type": "string"
+ },
+ "value": {
+ "title": "Value",
+ "description": "The value of the parameter.",
+ "type": "string"
+ },
+ "dataType": {
+ "title": "Data type",
+ "description": "The data type of the parameter.",
+ "type": "string"
+ }
+ }
+ },
+ "signature": {
+ "title": "Signature",
+ "description": "Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html).",
+ "type": "object",
+ "oneOf": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "signers": {
+ "type": "array",
+ "title": "Signature",
+ "description": "Unique top level property for Multiple Signatures. (multisignature)",
+ "items": {
+ "$ref": "#/definitions/signer"
+ }
+ }
+ }
+ },
+ {
+ "additionalProperties": false,
+ "properties": {
+ "chain": {
+ "type": "array",
+ "title": "Signature",
+ "description": "Unique top level property for Signature Chains. (signaturechain)",
+ "items": {
+ "$ref": "#/definitions/signer"
+ }
+ }
+ }
+ },
+ {
+ "title": "Signature",
+ "description": "Unique top level property for simple signatures. (signaturecore)",
+ "$ref": "#/definitions/signer"
+ }
+ ]
+ },
+ "signer": {
+ "type": "object",
+ "title": "Signature",
+ "required": [
+ "algorithm",
+ "value"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "algorithm": {
+ "oneOf": [
+ {
+ "type": "string",
+ "title": "Algorithm",
+ "description": "Signature algorithm. The currently recognized JWA [RFC7518] and RFC8037 [RFC8037] asymmetric key algorithms. Note: Unlike RFC8037 [RFC8037] JSF requires explicit Ed* algorithm names instead of \"EdDSA\".",
+ "enum": [
+ "RS256",
+ "RS384",
+ "RS512",
+ "PS256",
+ "PS384",
+ "PS512",
+ "ES256",
+ "ES384",
+ "ES512",
+ "Ed25519",
+ "Ed448",
+ "HS256",
+ "HS384",
+ "HS512"
+ ]
+ },
+ {
+ "type": "string",
+ "title": "Algorithm",
+ "description": "Signature algorithm. Note: If proprietary signature algorithms are added, they must be expressed as URIs.",
+ "format": "uri"
+ }
+ ]
+ },
+ "keyId": {
+ "type": "string",
+ "title": "Key ID",
+ "description": "Optional. Application specific string identifying the signature key."
+ },
+ "publicKey": {
+ "title": "Public key",
+ "description": "Optional. Public key object.",
+ "$ref": "#/definitions/publicKey"
+ },
+ "certificatePath": {
+ "type": "array",
+ "title": "Certificate path",
+ "description": "Optional. Sorted array of X.509 [RFC5280] certificates, where the first element must contain the signature certificate. The certificate path must be contiguous but is not required to be complete.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "excludes": {
+ "type": "array",
+ "title": "Excludes",
+ "description": "Optional. Array holding the names of one or more application level properties that must be excluded from the signature process. Note that the \"excludes\" property itself, must also be excluded from the signature process. Since both the \"excludes\" property and the associated data it points to are unsigned, a conforming JSF implementation must provide options for specifying which properties to accept.",
+ "items": {
+ "type": "string"
+ }
+ },
+ "value": {
+ "type": "string",
+ "title": "Signature",
+ "description": "The signature data. Note that the binary representation must follow the JWA [RFC7518] specifications."
+ }
+ }
+ },
+ "keyType": {
+ "type": "string",
+ "title": "Key type",
+ "description": "Key type indicator.",
+ "enum": [
+ "EC",
+ "OKP",
+ "RSA"
+ ]
+ },
+ "publicKey": {
+ "title": "Public key",
+ "description": "Optional. Public key object.",
+ "type": "object",
+ "required": [
+ "kty"
+ ],
+ "additionalProperties": true,
+ "properties": {
+ "kty": {
+ "$ref": "#/definitions/keyType"
+ }
+ },
+ "allOf": [
+ {
+ "if": {
+ "properties": {
+ "kty": {
+ "const": "EC"
+ }
+ }
+ },
+ "then": {
+ "required": [
+ "kty",
+ "crv",
+ "x",
+ "y"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "kty": {
+ "$ref": "#/definitions/keyType"
+ },
+ "crv": {
+ "type": "string",
+ "title": "Curve name",
+ "description": "EC curve name.",
+ "enum": [
+ "P-256",
+ "P-384",
+ "P-521"
+ ]
+ },
+ "x": {
+ "type": "string",
+ "title": "Coordinate",
+ "description": "EC curve point X. The length of this field must be the full size of a coordinate for the curve specified in the \"crv\" parameter. For example, if the value of \"crv\" is \"P-521\", the decoded argument must be 66 bytes."
+ },
+ "y": {
+ "type": "string",
+ "title": "Coordinate",
+ "description": "EC curve point Y. The length of this field must be the full size of a coordinate for the curve specified in the \"crv\" parameter. For example, if the value of \"crv\" is \"P-256\", the decoded argument must be 32 bytes."
+ }
+ }
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "kty": {
+ "const": "OKP"
+ }
+ }
+ },
+ "then": {
+ "required": [
+ "kty",
+ "crv",
+ "x"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "kty": {
+ "$ref": "#/definitions/keyType"
+ },
+ "crv": {
+ "type": "string",
+ "title": "Curve name",
+ "description": "EdDSA curve name.",
+ "enum": [
+ "Ed25519",
+ "Ed448"
+ ]
+ },
+ "x": {
+ "type": "string",
+ "title": "Coordinate",
+ "description": "EdDSA curve point X. The length of this field must be the full size of a coordinate for the curve specified in the \"crv\" parameter. For example, if the value of \"crv\" is \"Ed25519\", the decoded argument must be 32 bytes."
+ }
+ }
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "kty": {
+ "const": "RSA"
+ }
+ }
+ },
+ "then": {
+ "required": [
+ "kty",
+ "n",
+ "e"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "kty": {
+ "$ref": "#/definitions/keyType"
+ },
+ "n": {
+ "type": "string",
+ "title": "Modulus",
+ "description": "RSA modulus."
+ },
+ "e": {
+ "type": "string",
+ "title": "Exponent",
+ "description": "RSA exponent."
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/app/views/admin/dashboard/stats.html.haml b/app/views/admin/dashboard/stats.html.haml
index 0a5a425397f..059460ae5b2 100644
--- a/app/views/admin/dashboard/stats.html.haml
+++ b/app/views/admin/dashboard/stats.html.haml
@@ -8,7 +8,7 @@
%p.gl-font-weight-bold.gl-mt-8
= s_('AdminArea|Totals')
-%table.table.gl-text-gray-500
+%table.gl-table.gl-text-gray-500
= render_if_exists 'admin/dashboard/stats_active_users_row', users_statistics: @users_statistics
%tr.bg-gray-light.gl-text-gray-900
diff --git a/app/views/projects/merge_requests/_nav_btns.html.haml b/app/views/projects/merge_requests/_nav_btns.html.haml
index 2c0a8d831e4..4607aebf121 100644
--- a/app/views/projects/merge_requests/_nav_btns.html.haml
+++ b/app/views/projects/merge_requests/_nav_btns.html.haml
@@ -4,7 +4,7 @@
- if @can_bulk_update
= render Pajamas::ButtonComponent.new(type: :submit, button_options: { class: 'gl-mr-3 js-bulk-update-toggle' }) do
= _("Bulk edit")
-- if merge_project
+- if merge_project && can?(@current_user, :create_merge_request_in, @project)
= render Pajamas::ButtonComponent.new(href: new_merge_request_path, variant: :confirm) do
= _("New merge request")
diff --git a/config/feature_flags/development/hide_unaccessible_saml_branches.yml b/config/feature_flags/development/ci_redirect_component_project.yml
index 27761e0e087..205805914a4 100644
--- a/config/feature_flags/development/hide_unaccessible_saml_branches.yml
+++ b/config/feature_flags/development/ci_redirect_component_project.yml
@@ -1,8 +1,8 @@
---
-name: hide_unaccessible_saml_branches
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122972
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/419594
-milestone: '16.2'
+name: ci_redirect_component_project
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139254
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/434511
+milestone: '16.8'
type: development
-group: group::code review
+group: group::pipeline authoring
default_enabled: false
diff --git a/config/feature_flags/experiment/skip_conflict_files_in_gitaly.yml b/config/feature_flags/development/duo_chat_current_resource_by_default.yml
index 30bc47d5a4e..714a59c983c 100644
--- a/config/feature_flags/experiment/skip_conflict_files_in_gitaly.yml
+++ b/config/feature_flags/development/duo_chat_current_resource_by_default.yml
@@ -1,8 +1,8 @@
---
-name: skip_conflict_files_in_gitaly
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/126191
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/418139
-milestone: '16.3'
-type: experiment
-group: group::code review
+name: duo_chat_current_resource_by_default
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138394
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/434419
+milestone: '16.7'
+type: development
+group: group::ai framework
default_enabled: false
diff --git a/config/feature_flags/development/graphql_git_blame.yml b/config/feature_flags/development/graphql_git_blame.yml
index c6aad748ef8..1f7a187f6f1 100644
--- a/config/feature_flags/development/graphql_git_blame.yml
+++ b/config/feature_flags/development/graphql_git_blame.yml
@@ -2,7 +2,7 @@
name: graphql_git_blame
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/128103
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/419808
-milestone: "16.3"
+milestone: '16.3'
type: development
group: group::source code
-default_enabled: false
+default_enabled: true
diff --git a/config/feature_flags/development/packages_dependency_proxy_containers_scope_check.yml b/config/feature_flags/development/packages_dependency_proxy_containers_scope_check.yml
new file mode 100644
index 00000000000..fc44a407d37
--- /dev/null
+++ b/config/feature_flags/development/packages_dependency_proxy_containers_scope_check.yml
@@ -0,0 +1,8 @@
+---
+name: packages_dependency_proxy_containers_scope_check
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136655
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/431386
+milestone: '16.7'
+type: development
+group: group::container registry
+default_enabled: false
diff --git a/data/deprecations/16-7-dependency-proxy-group-deploy-token.yml b/data/deprecations/16-7-dependency-proxy-group-deploy-token.yml
index d19159f36b8..bb86a53e382 100644
--- a/data/deprecations/16-7-dependency-proxy-group-deploy-token.yml
+++ b/data/deprecations/16-7-dependency-proxy-group-deploy-token.yml
@@ -1,4 +1,4 @@
-- title: "Dependency Proxy: group access tokens to have additional scope checks for service accounts"
+- title: "Dependency Proxy: Access tokens to have additional scope checks"
announcement_milestone: "16.7"
removal_milestone: "17.0"
breaking_change: true
@@ -6,8 +6,8 @@
stage: Package
issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/431386
body: |
- When using the Dependency Proxy for containers with a group access token, `docker login` and `docker pull` requests with insufficient scopes for Dependency Proxy are not rejected.
+ When using the Dependency Proxy for containers with a group access token or personal access token, `docker login` and `docker pull` requests with insufficient scopes for Dependency Proxy are not rejected.
- GitLab 16.7 adds checks for group access tokens authenticating for the dependency proxy for containers. This is a breaking change, because tokens without the required scopes will fail.
+ GitLab 17.0 adds checks for group or personal access tokens authenticating with the dependency proxy for containers. This is a breaking change, because tokens without the required scopes will fail.
- To help avoid being impacted by this breaking change, create new group access tokens with the [required scopes](https://docs.gitlab.com/ee/user/packages/dependency_proxy/#authenticate-with-the-dependency-proxy), and update your workflow variables and scripts with those new tokens.
+ To help avoid being impacted by this breaking change, create new access tokens with the [required scopes](https://docs.gitlab.com/ee/user/packages/dependency_proxy/#authenticate-with-the-dependency-proxy), and update your workflow variables and scripts with those new tokens.
diff --git a/db/click_house/migrate/20231211130023_drop_contribution_analytics_mv.rb b/db/click_house/migrate/20231211130023_drop_contribution_analytics_mv.rb
new file mode 100644
index 00000000000..b8b4f7fb5c0
--- /dev/null
+++ b/db/click_house/migrate/20231211130023_drop_contribution_analytics_mv.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class DropContributionAnalyticsMv < ClickHouse::Migration
+ def up
+ execute <<~SQL
+ DROP VIEW IF EXISTS contribution_analytics_events_mv
+ SQL
+ end
+
+ def down
+ execute <<~SQL
+ CREATE MATERIALIZED VIEW IF NOT EXISTS contribution_analytics_events_mv
+ TO contribution_analytics_events
+ AS
+ SELECT
+ id,
+ argMax(path, events.updated_at) as path,
+ argMax(author_id, events.updated_at) as author_id,
+ argMax(target_type, events.updated_at) as target_type,
+ argMax(action, events.updated_at) as action,
+ argMax(date(created_at), events.updated_at) as created_at,
+ max(events.updated_at) as updated_at
+ FROM events
+ WHERE (("events"."action" = 5 AND "events"."target_type" = '')
+ OR ("events"."action" IN (1, 3, 7, 12)
+ AND "events"."target_type" IN ('MergeRequest', 'Issue')))
+ GROUP BY id
+ SQL
+ end
+end
diff --git a/db/click_house/migrate/20231211143660_drop_contribution_analytics_table.rb b/db/click_house/migrate/20231211143660_drop_contribution_analytics_table.rb
new file mode 100644
index 00000000000..45d16ac50fe
--- /dev/null
+++ b/db/click_house/migrate/20231211143660_drop_contribution_analytics_table.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class DropContributionAnalyticsTable < ClickHouse::Migration
+ def up
+ execute <<~SQL
+ DROP TABLE IF EXISTS contribution_analytics_events
+ SQL
+ end
+
+ def down
+ execute <<~SQL
+ CREATE TABLE IF NOT EXISTS contribution_analytics_events
+ (
+ id UInt64 DEFAULT 0,
+ path String DEFAULT '',
+ author_id UInt64 DEFAULT 0,
+ target_type LowCardinality(String) DEFAULT '',
+ action UInt8 DEFAULT 0,
+ created_at Date DEFAULT toDate(now()),
+ updated_at DateTime64(6, 'UTC') DEFAULT now()
+ )
+ ENGINE = ReplacingMergeTree
+ ORDER BY (path, created_at, author_id, id)
+ PARTITION BY toYear(created_at);
+ SQL
+ end
+end
diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md
index d0e18259bb4..a96025b87dd 100644
--- a/doc/api/graphql/reference/index.md
+++ b/doc/api/graphql/reference/index.md
@@ -8457,33 +8457,6 @@ Input type: `WorkItemDeleteInput`
| <a id="mutationworkitemdeleteerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. |
| <a id="mutationworkitemdeleteproject"></a>`project` | [`Project`](#project) | Project the deleted work item belonged to. |
-### `Mutation.workItemDeleteTask`
-
-Deletes a task in a work item's description.
-
-WARNING:
-**Introduced** in 15.1.
-This feature is an Experiment. It can be changed or removed at any time.
-
-Input type: `WorkItemDeleteTaskInput`
-
-#### Arguments
-
-| Name | Type | Description |
-| ---- | ---- | ----------- |
-| <a id="mutationworkitemdeletetaskclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
-| <a id="mutationworkitemdeletetaskid"></a>`id` | [`WorkItemID!`](#workitemid) | Global ID of the work item. |
-| <a id="mutationworkitemdeletetasklockversion"></a>`lockVersion` | [`Int!`](#int) | Current lock version of the work item containing the task in the description. |
-| <a id="mutationworkitemdeletetasktaskdata"></a>`taskData` | [`WorkItemDeletedTaskInput!`](#workitemdeletedtaskinput) | Arguments necessary to delete a task from a work item's description. |
-
-#### Fields
-
-| Name | Type | Description |
-| ---- | ---- | ----------- |
-| <a id="mutationworkitemdeletetaskclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
-| <a id="mutationworkitemdeletetaskerrors"></a>`errors` | [`[String!]!`](#string) | Errors encountered during execution of the mutation. |
-| <a id="mutationworkitemdeletetaskworkitem"></a>`workItem` | [`WorkItem`](#workitem) | Updated work item. |
-
### `Mutation.workItemExport`
WARNING:
@@ -18419,7 +18392,7 @@ Relationship between an epic and an issue.
| <a id="epicissuetimelogs"></a>`timelogs` | [`TimelogConnection!`](#timelogconnection) | Timelogs on the issue. (see [Connections](#connections)) |
| <a id="epicissuetitle"></a>`title` | [`String!`](#string) | Title of the issue. |
| <a id="epicissuetitlehtml"></a>`titleHtml` | [`String`](#string) | GitLab Flavored Markdown rendering of `title`. |
-| <a id="epicissuetotaltimespent"></a>`totalTimeSpent` | [`Int!`](#int) | Total time reported as spent on the issue. |
+| <a id="epicissuetotaltimespent"></a>`totalTimeSpent` | [`Int!`](#int) | Total time (in seconds) reported as spent on the issue. |
| <a id="epicissuetype"></a>`type` | [`IssueType`](#issuetype) | Type of the issue. |
| <a id="epicissueupdatedat"></a>`updatedAt` | [`Time!`](#time) | Timestamp of when the issue was last updated. |
| <a id="epicissueupdatedby"></a>`updatedBy` | [`UserCore`](#usercore) | User that last updated the issue. |
@@ -19378,6 +19351,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="groupcomplianceframeworksid"></a>`id` | [`ComplianceManagementFrameworkID`](#compliancemanagementframeworkid) | Global ID of a specific compliance framework to return. |
+| <a id="groupcomplianceframeworksids"></a>`ids` | [`[ComplianceManagementFrameworkID!]`](#compliancemanagementframeworkid) | List of Global IDs of compliance frameworks to return. |
| <a id="groupcomplianceframeworkssearch"></a>`search` | [`String`](#string) | Search framework with most similar names. |
##### `Group.contactStateCounts`
@@ -20845,7 +20819,7 @@ Describes an issuable resource link for incident issues.
| <a id="issuetimelogs"></a>`timelogs` | [`TimelogConnection!`](#timelogconnection) | Timelogs on the issue. (see [Connections](#connections)) |
| <a id="issuetitle"></a>`title` | [`String!`](#string) | Title of the issue. |
| <a id="issuetitlehtml"></a>`titleHtml` | [`String`](#string) | GitLab Flavored Markdown rendering of `title`. |
-| <a id="issuetotaltimespent"></a>`totalTimeSpent` | [`Int!`](#int) | Total time reported as spent on the issue. |
+| <a id="issuetotaltimespent"></a>`totalTimeSpent` | [`Int!`](#int) | Total time (in seconds) reported as spent on the issue. |
| <a id="issuetype"></a>`type` | [`IssueType`](#issuetype) | Type of the issue. |
| <a id="issueupdatedat"></a>`updatedAt` | [`Time!`](#time) | Timestamp of when the issue was last updated. |
| <a id="issueupdatedby"></a>`updatedBy` | [`UserCore`](#usercore) | User that last updated the issue. |
@@ -21411,7 +21385,7 @@ Defines which user roles, users, or groups can merge into a protected branch.
| <a id="mergerequesttimelogs"></a>`timelogs` | [`TimelogConnection!`](#timelogconnection) | Timelogs on the merge request. (see [Connections](#connections)) |
| <a id="mergerequesttitle"></a>`title` | [`String!`](#string) | Title of the merge request. |
| <a id="mergerequesttitlehtml"></a>`titleHtml` | [`String`](#string) | GitLab Flavored Markdown rendering of `title`. |
-| <a id="mergerequesttotaltimespent"></a>`totalTimeSpent` | [`Int!`](#int) | Total time reported as spent on the merge request. |
+| <a id="mergerequesttotaltimespent"></a>`totalTimeSpent` | [`Int!`](#int) | Total time (in seconds) reported as spent on the merge request. |
| <a id="mergerequestupdatedat"></a>`updatedAt` | [`Time!`](#time) | Timestamp of when the merge request was last updated. |
| <a id="mergerequestupvotes"></a>`upvotes` | [`Int!`](#int) | Number of upvotes for the merge request. |
| <a id="mergerequestuserdiscussionscount"></a>`userDiscussionsCount` | [`Int`](#int) | Number of user discussions in the merge request. |
@@ -23020,6 +22994,7 @@ four standard [pagination arguments](#connection-pagination-arguments):
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="namespacecomplianceframeworksid"></a>`id` | [`ComplianceManagementFrameworkID`](#compliancemanagementframeworkid) | Global ID of a specific compliance framework to return. |
+| <a id="namespacecomplianceframeworksids"></a>`ids` | [`[ComplianceManagementFrameworkID!]`](#compliancemanagementframeworkid) | List of Global IDs of compliance frameworks to return. |
| <a id="namespacecomplianceframeworkssearch"></a>`search` | [`String`](#string) | Search framework with most similar names. |
##### `Namespace.projects`
@@ -30588,8 +30563,8 @@ Member role permission.
| Value | Description |
| ----- | ----------- |
-| <a id="memberrolepermissionadmin_group_member"></a>`ADMIN_GROUP_MEMBER` | Allows admin access to group members. |
-| <a id="memberrolepermissionadmin_merge_request"></a>`ADMIN_MERGE_REQUEST` | Allows admin access to the merge requests. |
+| <a id="memberrolepermissionadmin_group_member"></a>`ADMIN_GROUP_MEMBER` | Allows to admin group members. |
+| <a id="memberrolepermissionadmin_merge_request"></a>`ADMIN_MERGE_REQUEST` | Allows to approve merge requests. |
| <a id="memberrolepermissionadmin_vulnerability"></a>`ADMIN_VULNERABILITY` | Allows admin access to the vulnerability reports. |
| <a id="memberrolepermissionarchive_project"></a>`ARCHIVE_PROJECT` | Allows to archive projects. |
| <a id="memberrolepermissionmanage_project_access_tokens"></a>`MANAGE_PROJECT_ACCESS_TOKENS` | Allows manage access to the project access tokens. |
@@ -34321,16 +34296,6 @@ Attributes for value stream stage.
| <a id="workitemconverttaskinputtitle"></a>`title` | [`String!`](#string) | Full string of the task to be replaced. New title for the created work item. |
| <a id="workitemconverttaskinputworkitemtypeid"></a>`workItemTypeId` | [`WorkItemsTypeID!`](#workitemstypeid) | Global ID of the work item type used to create the new work item. |
-### `WorkItemDeletedTaskInput`
-
-#### Arguments
-
-| Name | Type | Description |
-| ---- | ---- | ----------- |
-| <a id="workitemdeletedtaskinputid"></a>`id` | [`WorkItemID!`](#workitemid) | Global ID of the task referenced in the work item's description. |
-| <a id="workitemdeletedtaskinputlinenumberend"></a>`lineNumberEnd` | [`Int!`](#int) | Last line in the Markdown source that defines the list item task. |
-| <a id="workitemdeletedtaskinputlinenumberstart"></a>`lineNumberStart` | [`Int!`](#int) | First line in the Markdown source that defines the list item task. |
-
### `WorkItemUpdatedTaskInput`
#### Arguments
diff --git a/doc/development/contributing/index.md b/doc/development/contributing/index.md
index 39414f9c298..2c8b5b2af20 100644
--- a/doc/development/contributing/index.md
+++ b/doc/development/contributing/index.md
@@ -142,7 +142,7 @@ Lastly, keep the following in mind when submitting merge requests:
## Contributing to Premium/Ultimate features with an Enterprise Edition license
If you would like to work on GitLab features that are within a paid tier, also known as the code that lives in the [EE folder](https://gitlab.com/gitlab-org/gitlab/-/tree/master/ee), it requires a GitLab Enterprise Edition license.
-Request an Enterprise Edition Developers License according to the [documented process](https://about.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows.html#contributing-to-the-gitlab-enterprise-edition-ee).
+Request an Enterprise Edition Developers License according to the [documented process](https://about.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows#contributing-to-the-gitlab-enterprise-edition-ee).
## Get help
diff --git a/doc/development/documentation/styleguide/word_list.md b/doc/development/documentation/styleguide/word_list.md
index c09f85134cf..598d95d3190 100644
--- a/doc/development/documentation/styleguide/word_list.md
+++ b/doc/development/documentation/styleguide/word_list.md
@@ -740,7 +740,8 @@ Do not use **Dedicated** by itself. Always use **GitLab Dedicated**.
Do not use **Duo** by itself. Always use **GitLab Duo**.
-On first use on a page, use **GitLab Duo `<featurename>`**. For example:
+On first use on a page, use **GitLab Duo `<featurename>`**. As of Dec, 2023,
+the following are the names of GitLab Duo features:
- GitLab Duo Chat
- GitLab Duo Code Suggestions
@@ -751,6 +752,7 @@ On first use on a page, use **GitLab Duo `<featurename>`**. For example:
- GitLab Duo Code review summary
- GitLab Duo Code explanation
- GitLab Duo Vulnerability summary
+- GitLab Duo Vulnerability resolution
- GitLab Duo Test generation
- GitLab Duo Git suggestions
- GitLab Duo Root cause analysis
@@ -1901,6 +1903,13 @@ Thereafter, use **Value stream forecasting** by itself.
Do not use Latin abbreviations. Use **with**, **through**, or **by using** instead. ([Vale](../testing.md#vale) rule: [`LatinTerms.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/LatinTerms.yml))
+## Vulnerability resolution
+
+Use sentence case for **Vulnerability resolution**.
+
+On first mention on a page, use **GitLab Duo Vulnerability resolution**.
+Thereafter, use **Vulnerability resolution** by itself.
+
## Vulnerability summary
Use sentence case for **Vulnerability summary**.
diff --git a/doc/development/documentation/topic_types/troubleshooting.md b/doc/development/documentation/topic_types/troubleshooting.md
index 842ef913fc3..aee5bd1377c 100644
--- a/doc/development/documentation/topic_types/troubleshooting.md
+++ b/doc/development/documentation/topic_types/troubleshooting.md
@@ -49,7 +49,7 @@ For example, "Run debug tools" or "Verify syntax."
### Troubleshooting reference
-This topic includes the error message. For example:
+This topic includes the error message. To be consistent, use **workaround** for temporary solutions and **resolution** and **resolve** for permanent solutions. For example:
```markdown
### The error message or a description of it
@@ -61,9 +61,11 @@ This issue occurs when...
The workaround is...
```
-If multiple causes or workarounds exist, consider putting them into a table format.
+If multiple causes or solutions exist, consider putting them into a table format.
If you use the exact error message, surround it in backticks so it's styled as code.
+For more guidance on solution types, see [workaround](../../documentation/styleguide/word_list.md#workaround) and [resolution, resolve](../../documentation/styleguide/word_list.md#resolution-resolve).
+
## Troubleshooting topic titles
For the title of a **Troubleshooting reference** topic:
diff --git a/doc/integration/advanced_search/elasticsearch_troubleshooting.md b/doc/integration/advanced_search/elasticsearch_troubleshooting.md
index 77ffc584606..7252b9b1b3d 100644
--- a/doc/integration/advanced_search/elasticsearch_troubleshooting.md
+++ b/doc/integration/advanced_search/elasticsearch_troubleshooting.md
@@ -223,10 +223,6 @@ See [Elasticsearch Index Scopes](elasticsearch.md#advanced-search-index-scopes)
You must re-run all the Rake tasks to reindex the database, repositories, and wikis.
-### The indexing process is taking a very long time
-
-The more data present in your GitLab instance, the longer the indexing process takes.
-
### There are some projects that weren't indexed, but you don't know which ones
You can run `sudo gitlab-rake gitlab:elastic:projects_not_indexed` to display projects that aren't indexed.
@@ -365,6 +361,33 @@ dig further into these.
Feel free to reach out to GitLab support, but this is likely to be something a skilled
Elasticsearch administrator has more experience with.
+### Slow initial indexing
+
+The more data your GitLab instance has, the longer the indexing takes.
+You can estimate cluster size with the Rake task `sudo gitlab-rake gitlab:elastic:estimate_cluster_size`.
+
+#### For code documents
+
+Ensure you have enough Sidekiq nodes and processes to efficiently index code, commits, and wikis.
+If your initial indexing is slow, consider [dedicated Sidekiq nodes or processes](../../integration/advanced_search/elasticsearch.md#index-large-instances-with-dedicated-sidekiq-nodes-or-processes).
+
+#### For non-code documents
+
+If the initial indexing is slow but Sidekiq has enough nodes and processes,
+you can adjust advanced search worker settings in GitLab.
+For **Requeue indexing workers**, the default value is `false`.
+For **Number of shards for non-code indexing**, the default value is `2`.
+These settings limit indexing to 2000 documents per minute.
+
+To adjust worker settings:
+
+1. On the left sidebar, at the bottom, select **Admin Area**.
+1. Select **Settings > Advanced Search**.
+1. Expand **Advanced Search**.
+1. Select the **Requeue indexing workers** checkbox.
+1. In the **Number of shards for non-code indexing** text box, enter a value higher than `2`.
+1. Select **Save changes**.
+
## Issues with migrations
Ensure you've read about [Elasticsearch Migrations](../advanced_search/elasticsearch.md#advanced-search-migrations).
diff --git a/doc/update/deprecations.md b/doc/update/deprecations.md
index 66b5d5be59a..cba85b1acd9 100644
--- a/doc/update/deprecations.md
+++ b/doc/update/deprecations.md
@@ -317,7 +317,7 @@ In 16.3, the names of these settings were changed to clarify their meanings: the
<div class="deprecation breaking-change" data-milestone="17.0">
-### Dependency Proxy: group access tokens to have additional scope checks for service accounts
+### Dependency Proxy: Access tokens to have additional scope checks
<div class="deprecation-notes">
- Announced in GitLab <span class="milestone">16.7</span>
@@ -325,11 +325,11 @@ In 16.3, the names of these settings were changed to clarify their meanings: the
- To discuss this change or learn more, see the [deprecation issue](https://gitlab.com/gitlab-org/gitlab/-/issues/431386).
</div>
-When using the Dependency Proxy for containers with a group access token, `docker login` and `docker pull` requests with insufficient scopes for Dependency Proxy are not rejected.
+When using the Dependency Proxy for containers with a group access token or personal access token, `docker login` and `docker pull` requests with insufficient scopes for Dependency Proxy are not rejected.
-GitLab 16.7 adds checks for group access tokens authenticating for the dependency proxy for containers. This is a breaking change, because tokens without the required scopes will fail.
+GitLab 17.0 adds checks for group or personal access tokens authenticating with the dependency proxy for containers. This is a breaking change, because tokens without the required scopes will fail.
-To help avoid being impacted by this breaking change, create new group access tokens with the [required scopes](https://docs.gitlab.com/ee/user/packages/dependency_proxy/#authenticate-with-the-dependency-proxy), and update your workflow variables and scripts with those new tokens.
+To help avoid being impacted by this breaking change, create new access tokens with the [required scopes](https://docs.gitlab.com/ee/user/packages/dependency_proxy/#authenticate-with-the-dependency-proxy), and update your workflow variables and scripts with those new tokens.
</div>
diff --git a/doc/user/application_security/policies/img/scan_results_evaluation_white-bg.png b/doc/user/application_security/policies/img/scan_results_evaluation_white-bg.png
new file mode 100644
index 00000000000..d2f5466e383
--- /dev/null
+++ b/doc/user/application_security/policies/img/scan_results_evaluation_white-bg.png
Binary files differ
diff --git a/doc/user/application_security/policies/scan-result-policies.md b/doc/user/application_security/policies/scan-result-policies.md
index 3db9c3db749..604de3a0c13 100644
--- a/doc/user/application_security/policies/scan-result-policies.md
+++ b/doc/user/application_security/policies/scan-result-policies.md
@@ -34,6 +34,7 @@ The following video gives you an overview of GitLab scan result policies:
- The maximum number of policies is five.
- Each policy can have a maximum of five rules.
- All configured scanners must be present in the merge request's latest pipeline. If not, approvals are required even if some vulnerability criteria have not been met.
+- Scan result policies evaluate findings and determine approval requirements based on the job artifact reports published in a completed pipeline. However, scan result policies do not check the integrity or authenticity of the scan results generated in the artifact reports.
## Merge request with multiple pipelines
@@ -333,6 +334,16 @@ There are several situations where the scan result policy requires an additional
- A job in a merge request fails and is configured with `allow_failure: false`. As a result, the pipeline is in a blocked state.
- A pipeline has a manual job that must run successfully for the entire pipeline to pass.
+### Managing scan findings used to evaluate approval requirements
+
+Scan result policies evaluate the artifact reports generated by scanners in your pipelines after the pipeline has completed. Scan result policies focus on evaluating the results and determining approvals based on the scan result findings to identify potential risks, block merge requests, and require approval.
+
+Scan result policies do not extend beyond that scope to reach into artifact files or scanners. Instead, we trust the results from artifact reports. This gives teams flexibility in managing their scan execution and supply chain, and customizing scan results generated in artifact reports (for example, to filter out false positives) if needed.
+
+Lock file tampering, for example, is outside of the scope of security policy management, but may be mitigated through use of [Code owners](../../project/codeowners/index.md#codeowners-file) or [external status checks](../../project/merge_requests/status_checks.md). For more information, see [issue 433029](https://gitlab.com/gitlab-org/gitlab/-/issues/433029).
+
+![Evaluating scan result findings](img/scan_results_evaluation_white-bg.png)
+
### Known issues
We have identified in [epic 11020](https://gitlab.com/groups/gitlab-org/-/epics/11020) common areas of confusion in scan result findings that need to be addressed. Below are a few of the known issues:
diff --git a/doc/user/okrs.md b/doc/user/okrs.md
index ff8051755ca..e3d634884be 100644
--- a/doc/user/okrs.md
+++ b/doc/user/okrs.md
@@ -67,10 +67,6 @@ To create a key result, [add it as a child](#add-a-child-key-result) to an exist
## View an objective
-Prerequisites:
-
-- You must have at least the Guest role for the project.
-
To view an objective:
1. On the left sidebar, select **Search or go to** and find your project.
@@ -81,10 +77,6 @@ for `Type = objective`.
## View a key result
-Prerequisites:
-
-- You must have at least the Guest role for the project.
-
To view a key result:
1. On the left sidebar, select **Search or go to** and find your project.
@@ -122,12 +114,12 @@ Prerequisites:
- You must have at least the Reporter role for the project.
-You can view all the system notes related to the task. By default they are sorted by **Oldest first**.
+You can view all the [system notes](project/system_notes.md) related to the OKR. By default they are sorted by **Oldest first**.
You can always change the sorting order to **Newest first**, which is remembered across sessions.
## Comments and threads
-You can add [comments](discussions/index.md) and reply to threads in tasks.
+You can add [comments](discussions/index.md) and reply to threads in OKRs.
## Assign users
@@ -427,6 +419,15 @@ leaking out.
By default, OKRs are public.
You can make an OKR confidential when you create or edit it.
+#### In a new OKR
+
+When you create a new objective, a checkbox right below the text area is available to mark the
+OKR as confidential.
+
+Select that checkbox and then select **Create objective** or **Create key result** to create the OKR.
+
+#### In an existing OKR
+
Prerequisites:
- You must have at least the Reporter role for the project.
@@ -439,20 +440,11 @@ Prerequisites:
- To add child objectives or key results to a confidential objective, you must first make them
confidential.
-#### In a new OKR
-
-When you create a new objective, a checkbox right below the text area is available to mark the
-OKR as confidential.
-
-Check that box and select **Create objective** or **Create key result** to create the OKR.
-
-#### In an existing OKR
-
To change the confidentiality of an existing OKR:
1. [Open the objective](#view-an-objective) or [key result](#view-a-key-result).
1. In the top right corner, select the vertical ellipsis (**{ellipsis_v}**).
-1. Select **Turn on confidentiality**.
+1. Select **Turn on confidentiality** or **Turn off confidentiality**.
### Who can see confidential OKRs
diff --git a/doc/user/permissions.md b/doc/user/permissions.md
index da4212ffcaf..4796c63566f 100644
--- a/doc/user/permissions.md
+++ b/doc/user/permissions.md
@@ -133,6 +133,12 @@ The following table lists project permissions available for each role:
| [Merge requests](project/merge_requests/index.md):<br>[Resolve a thread](project/merge_requests/index.md#resolve-a-thread) | | | ✓ | ✓ | ✓ |
| [Merge requests](project/merge_requests/index.md):<br>Manage [merge approval rules](project/merge_requests/approvals/settings.md) (project settings) | | | | ✓ | ✓ |
| [Merge requests](project/merge_requests/index.md):<br>Delete | | | | | ✓ |
+| [Objectives and key results](okrs.md):<br>Add a child OKR | ✓ | ✓ | ✓ | ✓ | ✓ |
+| [Objectives and key results](okrs.md):<br>Add a linked item | ✓ | ✓ | ✓ | ✓ | ✓ |
+| [Objectives and key results](okrs.md):<br>Create | ✓ | ✓ | ✓ | ✓ | ✓ |
+| [Objectives and key results](okrs.md):<br>View | ✓ | ✓ | ✓ | ✓ | ✓ |
+| [Objectives and key results](okrs.md):<br>Change confidentiality | | ✓ | ✓ | ✓ | ✓ |
+| [Objectives and key results](okrs.md):<br>Edit | | ✓ | ✓ | ✓ | ✓ |
| [Package registry](packages/index.md):<br>Pull a package | ✓ (1) | ✓ | ✓ | ✓ | ✓ |
| [Package registry](packages/index.md):<br>Publish a package | | | ✓ | ✓ | ✓ |
| [Package registry](packages/index.md):<br>Delete a package | | | | ✓ | ✓ |
@@ -208,6 +214,7 @@ The following table lists project permissions available for each role:
| [Security dashboard](application_security/security_dashboard/index.md):<br>Use security dashboard | | | ✓ | ✓ | ✓ |
| [Security dashboard](application_security/security_dashboard/index.md):<br>View vulnerability | | | ✓ | ✓ | ✓ |
| [Security dashboard](application_security/security_dashboard/index.md):<br>View vulnerability findings in [dependency list](application_security/dependency_list/index.md) | | | ✓ | ✓ | ✓ |
+| [Tasks](tasks.md):<br>Add a linked item | ✓ | ✓ | ✓ | ✓ | ✓ |
| [Tasks](tasks.md):<br>Create (17) | | ✓ | ✓ | ✓ | ✓ |
| [Tasks](tasks.md):<br>Edit | | ✓ | ✓ | ✓ | ✓ |
| [Tasks](tasks.md):<br>Remove from issue | | ✓ | ✓ | ✓ | ✓ |
diff --git a/doc/user/project/repository/index.md b/doc/user/project/repository/index.md
index 3640a54149a..dd8ee61f6ae 100644
--- a/doc/user/project/repository/index.md
+++ b/doc/user/project/repository/index.md
@@ -290,7 +290,7 @@ When you [rename a user](../../profile/index.md#change-your-username),
After you change a path, you must update the existing URL in the following resources,
because they can't follow redirects:
-- [Include statements](../../../ci/yaml/includes.md), otherwise pipelines fail with a syntax error.
+- [Include statements](../../../ci/yaml/includes.md) except [`include:component`](../../../ci/components/index.md), otherwise pipelines fail with a syntax error. CI/CD component references can follow redirects.
- Namespaced API calls that use the [encoded path](../../../api/rest/index.md#namespaced-path-encoding) instead of the numeric namespace and project IDs.
- [Docker image references](../../../ci/yaml/index.md#image).
- Variables that specify a project or namespace.
diff --git a/doc/user/project/repository/tags/index.md b/doc/user/project/repository/tags/index.md
index 1a96dd59df3..232f2e387d1 100644
--- a/doc/user/project/repository/tags/index.md
+++ b/doc/user/project/repository/tags/index.md
@@ -97,6 +97,19 @@ To create a tag from the GitLab UI:
create a lightweight tag.
1. Select **Create tag**.
+## Name your tag
+
+Git enforces [tag name rules](https://git-scm.com/docs/git-check-ref-format)
+to help ensure tag names remain compatible with other tools. GitLab
+adds extra requirements for tag names, and provides benefits for well-structured tag names.
+
+GitLab enforces these additional rules on all tags:
+
+- No spaces are allowed in tag names.
+- Tag names starting with 40 or 64 hexadecimal characters are prohibited, because they are similar to Git commit hashes.
+- Tag names cannot start with `-`, `refs/heads`, `refs/tags`, or `refs/remotes`
+- Tag names are case-sensitive.
+
## Prevent tag deletion **(PREMIUM ALL)**
To prevent users from removing a tag with `git push`, create a [push rule](../push_rules.md).
diff --git a/doc/user/project/service_desk/configure.md b/doc/user/project/service_desk/configure.md
index 681e41f35c0..60322edba7a 100644
--- a/doc/user/project/service_desk/configure.md
+++ b/doc/user/project/service_desk/configure.md
@@ -163,6 +163,9 @@ You can configure GitLab to reopen closed issues when an external participant ad
a new comment on an issue by email. This also adds an internal comment that mentions
the assignees of the issue and creates to-do items for them.
+<i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
+For a walkthrough, see [a short showcase video](https://youtu.be/163wDM1e43o).
+
Prerequisites:
- You must have at least the Maintainer role for the project.
diff --git a/doc/user/project/time_tracking.md b/doc/user/project/time_tracking.md
index c1d958a9244..c5c91e2a966 100644
--- a/doc/user/project/time_tracking.md
+++ b/doc/user/project/time_tracking.md
@@ -68,6 +68,8 @@ As you work, you can log the time you've spent.
Every new time spent entry is added to the current total time spent for the
issue or the merge request.
+The total amount of time spent on an issue or merge request cannot exceed a year.
+
### Add time spent
Prerequisites:
@@ -163,7 +165,7 @@ To view a time tracking report:
![Time tracking report](img/time_tracking_report_v15_1.png)
-The breakdown of spent time is limited to a maximum of 100 entries.
+The breakdown of spent time displayed is limited to a maximum of 100 entries.
## Available time units
diff --git a/lib/api/ci/pipeline_schedules.rb b/lib/api/ci/pipeline_schedules.rb
index 1087c734f98..48e9f6d879b 100644
--- a/lib/api/ci/pipeline_schedules.rb
+++ b/lib/api/ci/pipeline_schedules.rb
@@ -219,11 +219,16 @@ module API
documentation: { default: 'env_var' }
end
post ':id/pipeline_schedules/:pipeline_schedule_id/variables' do
+ authorize! :set_pipeline_variables, user_project
authorize! :update_pipeline_schedule, pipeline_schedule
- variable_params = declared_params(include_missing: false)
- variable = pipeline_schedule.variables.create(variable_params)
- if variable.persisted?
+ response = ::Ci::PipelineSchedules::VariablesCreateService
+ .new(pipeline_schedule, current_user, declared_params(include_missing: false))
+ .execute
+
+ variable = response.payload
+
+ if response.success?
present variable, with: Entities::Ci::Variable
else
render_validation_error!(variable)
@@ -247,9 +252,14 @@ module API
documentation: { default: 'env_var' }
end
put ':id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do
+ authorize! :set_pipeline_variables, user_project
authorize! :update_pipeline_schedule, pipeline_schedule
- if pipeline_schedule_variable.update(declared_params(include_missing: false))
+ response = ::Ci::PipelineSchedules::VariablesUpdateService
+ .new(pipeline_schedule_variable, current_user, declared_params(include_missing: false))
+ .execute
+
+ if response.success?
present pipeline_schedule_variable, with: Entities::Ci::Variable
else
render_validation_error!(pipeline_schedule_variable)
@@ -269,6 +279,7 @@ module API
requires :key, type: String, desc: 'The key of the variable', documentation: { example: 'NEW_VARIABLE' }
end
delete ':id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do
+ authorize! :set_pipeline_variables, user_project
authorize! :admin_pipeline_schedule, pipeline_schedule
status :accepted
diff --git a/lib/api/resource_access_tokens.rb b/lib/api/resource_access_tokens.rb
index 752feb1455f..1e1b5d77cfd 100644
--- a/lib/api/resource_access_tokens.rb
+++ b/lib/api/resource_access_tokens.rb
@@ -153,7 +153,13 @@ module API
token = find_token(resource, params[:token_id]) if resource_accessible
if token
- response = ::PersonalAccessTokens::RotateService.new(current_user, token).execute(declared_params)
+ response = if source_type == "project"
+ ::ProjectAccessTokens::RotateService.new(current_user, token, resource)
+ .execute(declared_params)
+ else
+ ::PersonalAccessTokens::RotateService.new(current_user, token)
+ .execute(declared_params)
+ end
if response.success?
status :ok
diff --git a/lib/api/search.rb b/lib/api/search.rb
index 5f78979ec8a..d5be2c12da0 100644
--- a/lib/api/search.rb
+++ b/lib/api/search.rb
@@ -119,7 +119,7 @@ module API
end
def search_type(additional_params = {})
- 'basic'
+ search_service(additional_params).search_type
end
def search_scope
diff --git a/lib/gitlab/checks/tag_check.rb b/lib/gitlab/checks/tag_check.rb
index 5684b897256..cb0e60a096a 100644
--- a/lib/gitlab/checks/tag_check.rb
+++ b/lib/gitlab/checks/tag_check.rb
@@ -12,6 +12,7 @@ module Gitlab
create_protected_tag: 'You are not allowed to create this tag as it is protected.',
default_branch_collision: 'You cannot use default branch name to create a tag',
prohibited_tag_name: 'You cannot create a tag with a prohibited pattern.',
+ prohibited_sha_tag_name: 'You cannot create a tag with a SHA-1 or SHA-256 tag name.',
prohibited_tag_name_encoding: 'Tag names must be valid when converted to UTF-8 encoding'
}.freeze
@@ -21,6 +22,8 @@ module Gitlab
protected_tag_checks: "Checking if you are creating, updating or deleting a protected tag..."
}.freeze
+ STARTS_WITH_SHA_REGEX = %r{\A#{Gitlab::Git::Commit::RAW_FULL_SHA_PATTERN}}o
+
def validate!
return unless tag_name
@@ -52,6 +55,7 @@ module Gitlab
validate_encoding!
validate_valid_tag_name!
validate_tag_name_not_fully_qualified!
+ validate_tag_name_not_sha_like!
end
def protected_tag_checks
@@ -104,6 +108,12 @@ module Gitlab
raise GitAccess::ForbiddenError, ERROR_MESSAGES[:create_protected_tag]
end
+
+ def validate_tag_name_not_sha_like!
+ return unless STARTS_WITH_SHA_REGEX.match?(tag_name)
+
+ raise GitAccess::ForbiddenError, ERROR_MESSAGES[:prohibited_sha_tag_name]
+ end
end
end
end
diff --git a/lib/gitlab/ci/components/instance_path.rb b/lib/gitlab/ci/components/instance_path.rb
index 5fc0d362218..607eff902ea 100644
--- a/lib/gitlab/ci/components/instance_path.rb
+++ b/lib/gitlab/ci/components/instance_path.rb
@@ -45,14 +45,31 @@ module Gitlab
private
- attr_reader :version
+ attr_reader :version, :component_name
- # Given a path like "my-org/sub-group/the-project/path/to/component"
- # find the project "my-org/sub-group/the-project" by looking at all possible paths.
def find_project_by_component_path(path)
+ if Feature.enabled?(:ci_redirect_component_project, Feature.current_request)
+ project_full_path = extract_project_path(path)
+
+ Project.find_by_full_path(project_full_path, follow_redirects: true).tap do |project|
+ next unless project
+
+ @component_name = extract_component_name(project_full_path)
+ end
+ else
+ legacy_finder(path).tap do |project|
+ next unless project
+
+ @component_name = extract_component_name(project.full_path)
+ end
+ end
+ end
+
+ def legacy_finder(path)
return if path.start_with?('/') # exit early if path starts with `/` or it will loop forever.
possible_paths = [path]
+
index = nil
loop_until(limit: 20) do
@@ -68,14 +85,25 @@ module Gitlab
::Project.where_full_path_in(possible_paths).take # rubocop: disable CodeReuse/ActiveRecord
end
+ # Given a path like "my-org/sub-group/the-project/the-component"
+ # we expect that the last `/` is the separator between the project full path and the
+ # component name.
+ def extract_project_path(path)
+ return if path.start_with?('/') # invalid project full path.
+
+ index = path.rindex('/') # find index of last `/` in the path
+ return unless index
+
+ path[0..index - 1]
+ end
+
def instance_path
@full_path.delete_prefix(host)
end
- def component_name
- instance_path.delete_prefix(project.full_path).delete_prefix('/')
+ def extract_component_name(project_path)
+ instance_path.delete_prefix(project_path).delete_prefix('/')
end
- strong_memoize_attr :component_name
def latest_version_sha
if project.catalog_resource
diff --git a/lib/gitlab/ci/parsers/sbom/cyclonedx.rb b/lib/gitlab/ci/parsers/sbom/cyclonedx.rb
index 1e5200e8682..79c1c14dc4e 100644
--- a/lib/gitlab/ci/parsers/sbom/cyclonedx.rb
+++ b/lib/gitlab/ci/parsers/sbom/cyclonedx.rb
@@ -5,8 +5,6 @@ module Gitlab
module Parsers
module Sbom
class Cyclonedx
- SUPPORTED_SPEC_VERSIONS = %w[1.4].freeze
-
def parse!(blob, sbom_report)
@report = sbom_report
@data = Gitlab::Json.parse(blob)
@@ -27,18 +25,7 @@ module Gitlab
end
def valid?
- valid_schema? && supported_spec_version?
- end
-
- def supported_spec_version?
- return true if SUPPORTED_SPEC_VERSIONS.include?(data['specVersion'])
-
- report.add_error(
- "Unsupported CycloneDX spec version. Must be one of: %{versions}" \
- % { versions: SUPPORTED_SPEC_VERSIONS.join(', ') }
- )
-
- false
+ valid_schema?
end
def valid_schema?
diff --git a/lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator.rb b/lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator.rb
index 9d56e001c2f..a8d3ef1d6b5 100644
--- a/lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator.rb
+++ b/lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator.rb
@@ -6,7 +6,9 @@ module Gitlab
module Sbom
module Validators
class CyclonedxSchemaValidator
- SCHEMA_PATH = Rails.root.join('app', 'validators', 'json_schemas', 'cyclonedx_report.json').freeze
+ SUPPORTED_SPEC_VERSIONS = %w[1.4 1.5].freeze
+
+ SCHEMA_BASE_PATH = Rails.root.join('app', 'validators', 'json_schemas', 'cyclonedx').freeze
def initialize(report_data)
@report_data = report_data
@@ -17,13 +19,30 @@ module Gitlab
end
def errors
- @errors ||= pretty_errors
+ @errors ||= validate!
end
private
+ def validate!
+ if spec_version_valid?
+ pretty_errors
+ else
+ [format("Unsupported CycloneDX spec version. Must be one of: %{versions}",
+ versions: SUPPORTED_SPEC_VERSIONS.join(', '))]
+ end
+ end
+
+ def spec_version_valid?
+ SUPPORTED_SPEC_VERSIONS.include?(spec_version)
+ end
+
+ def spec_version
+ @report_data['specVersion']
+ end
+
def raw_errors
- JSONSchemer.schema(SCHEMA_PATH).validate(@report_data)
+ JSONSchemer.schema(SCHEMA_BASE_PATH.join("bom-#{spec_version}.schema.json")).validate(@report_data)
end
def pretty_errors
diff --git a/lib/gitlab/gitaly_client/conflicts_service.rb b/lib/gitlab/gitaly_client/conflicts_service.rb
index ffe65307c80..831c5ca1305 100644
--- a/lib/gitlab/gitaly_client/conflicts_service.rb
+++ b/lib/gitlab/gitaly_client/conflicts_service.rb
@@ -30,8 +30,8 @@ module Gitlab
end
def conflicts?
- skip_content = Feature.enabled?(:skip_conflict_files_in_gitaly, type: :experiment)
- list_conflict_files(skip_content: skip_content).any?
+ list_conflict_files(skip_content: true).any?
+
rescue GRPC::FailedPrecondition, GRPC::Unknown
# The server raises FailedPrecondition when it encounters
# ConflictSideMissing, which means a conflict exists but its `theirs` or
diff --git a/lib/gitlab/group_search_results.rb b/lib/gitlab/group_search_results.rb
index 6fe7a0030f0..b112740c4ad 100644
--- a/lib/gitlab/group_search_results.rb
+++ b/lib/gitlab/group_search_results.rb
@@ -13,7 +13,6 @@ module Gitlab
# rubocop:disable CodeReuse/ActiveRecord
def users
groups = group.self_and_hierarchy_intersecting_with_user_groups(current_user)
- groups = groups.allow_cross_joins_across_databases(url: "https://gitlab.com/gitlab-org/gitlab/-/issues/427108")
members = GroupMember.where(group: groups).non_invite
users = super
diff --git a/lib/gitlab/internal_events.rb b/lib/gitlab/internal_events.rb
index ede7502101b..eb2ba3449fb 100644
--- a/lib/gitlab/internal_events.rb
+++ b/lib/gitlab/internal_events.rb
@@ -111,7 +111,7 @@ module Gitlab
user = kwargs[:user]
gitlab_sdk_client.identify(user&.id)
- gitlab_sdk_client.track(event_name, nil)
+ gitlab_sdk_client.track(event_name, { project_id: kwargs[:project]&.id, namespace_id: kwargs[:namespace]&.id })
end
def gitlab_sdk_client
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 677370f7f0d..54936b0079c 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -32330,6 +32330,9 @@ msgstr ""
msgid "Not confidential"
msgstr ""
+msgid "Not eligible to rotate token with access level higher than the user"
+msgstr ""
+
msgid "Not found"
msgstr ""
@@ -45955,6 +45958,9 @@ msgstr ""
msgid "Smartcard authentication failed: client certificate header is missing."
msgstr ""
+msgid "Smartcard authentication failed: login process exceeded the time limit."
+msgstr ""
+
msgid "Snippet"
msgstr ""
@@ -48569,12 +48575,18 @@ msgstr ""
msgid "The current user is not authorized to create the pipeline schedule"
msgstr ""
+msgid "The current user is not authorized to create the pipeline schedule variables"
+msgstr ""
+
msgid "The current user is not authorized to set pipeline schedule variables"
msgstr ""
msgid "The current user is not authorized to update the pipeline schedule"
msgstr ""
+msgid "The current user is not authorized to update the pipeline schedule variables"
+msgstr ""
+
msgid "The data in this pipeline is too old to be rendered as a graph. Please check the Jobs tab to access historical data."
msgstr ""
@@ -51002,6 +51014,12 @@ msgstr ""
msgid "Total test time for all commits/merges"
msgstr ""
+msgid "Total time spent cannot be negative."
+msgstr ""
+
+msgid "Total time spent cannot exceed a year."
+msgstr ""
+
msgid "Total users"
msgstr ""
diff --git a/metrics_server/metrics_server.rb b/metrics_server/metrics_server.rb
index 873489b444e..f504d075498 100644
--- a/metrics_server/metrics_server.rb
+++ b/metrics_server/metrics_server.rb
@@ -17,6 +17,12 @@ class MetricsServer # rubocop:disable Gitlab/NamespacedClass
end
supervisor = PumaProcessSupervisor.instance
+
+ at_exit do
+ Gitlab::AppLogger.info("Puma process #{Process.pid} is exiting, shutting down metrics server...")
+ supervisor.shutdown
+ end
+
supervisor.supervise(start_server.call) do
Gitlab::AppLogger.info('Puma metrics server terminated, restarting...')
start_server.call
diff --git a/spec/controllers/groups/dependency_proxy_for_containers_controller_spec.rb b/spec/controllers/groups/dependency_proxy_for_containers_controller_spec.rb
index d5425428ec9..9b977248435 100644
--- a/spec/controllers/groups/dependency_proxy_for_containers_controller_spec.rb
+++ b/spec/controllers/groups/dependency_proxy_for_containers_controller_spec.rb
@@ -60,6 +60,42 @@ RSpec.describe Groups::DependencyProxyForContainersController, feature_category:
it { is_expected.to have_gitlab_http_status(:not_found) }
end
+ context 'with invalid group access token' do
+ let_it_be(:user) { create(:user, :project_bot) }
+
+ context 'not under the group' do
+ it { is_expected.to have_gitlab_http_status(:not_found) }
+ end
+
+ context 'with sufficient scopes, but not active' do
+ %i[expired revoked].each do |status|
+ context status.to_s do
+ let_it_be(:pat) do
+ create(:personal_access_token, status, user: user).tap do |pat|
+ pat.update_column(:scopes, Gitlab::Auth::REGISTRY_SCOPES)
+ end
+ end
+
+ it { is_expected.to have_gitlab_http_status(:not_found) }
+ end
+ end
+ end
+
+ context 'with insufficient scopes' do
+ let_it_be(:pat) { create(:personal_access_token, user: user, scopes: [Gitlab::Auth::READ_API_SCOPE]) }
+
+ it { is_expected.to have_gitlab_http_status(:not_found) }
+
+ context 'packages_dependency_proxy_containers_scope_check disabled' do
+ before do
+ stub_feature_flags(packages_dependency_proxy_containers_scope_check: false)
+ end
+
+ it { is_expected.to have_gitlab_http_status(:not_found) }
+ end
+ end
+ end
+
context 'with deploy token from a different group,' do
let_it_be(:user) { create(:deploy_token, :group, :dependency_proxy_scopes) }
@@ -153,6 +189,10 @@ RSpec.describe Groups::DependencyProxyForContainersController, feature_category:
let_it_be(:user) { create(:user, :project_bot) }
let_it_be_with_reload(:token) { create(:personal_access_token, user: user) }
+ before do
+ token.update_column(:scopes, Gitlab::Auth::REGISTRY_SCOPES)
+ end
+
it_behaves_like 'sends Workhorse instructions'
end
@@ -295,6 +335,18 @@ RSpec.describe Groups::DependencyProxyForContainersController, feature_category:
it_behaves_like 'a successful manifest pull'
end
end
+
+ context 'a valid group access token' do
+ let_it_be(:user) { create(:user, :project_bot) }
+ let_it_be(:token) { create(:personal_access_token, :dependency_proxy_scopes, user: user) }
+
+ before do
+ group.add_guest(user)
+ end
+
+ it_behaves_like 'a successful manifest pull'
+ it_behaves_like 'a package tracking event', described_class.name, 'pull_manifest', false
+ end
end
it_behaves_like 'not found when disabled'
diff --git a/spec/factories/personal_access_tokens.rb b/spec/factories/personal_access_tokens.rb
index c7361b11633..7e6fe96d3ed 100644
--- a/spec/factories/personal_access_tokens.rb
+++ b/spec/factories/personal_access_tokens.rb
@@ -36,5 +36,11 @@ FactoryBot.define do
trait :no_prefix do
after(:build) { |personal_access_token| personal_access_token.set_token(Devise.friendly_token) }
end
+
+ trait :dependency_proxy_scopes do
+ before(:create) do |personal_access_token|
+ personal_access_token.scopes = (personal_access_token.scopes + Gitlab::Auth::REPOSITORY_SCOPES).uniq
+ end
+ end
end
end
diff --git a/spec/features/profiles/two_factor_auths_spec.rb b/spec/features/profiles/two_factor_auths_spec.rb
index 15ab79684d9..cea3172898f 100644
--- a/spec/features/profiles/two_factor_auths_spec.rb
+++ b/spec/features/profiles/two_factor_auths_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'Two factor auths', feature_category: :user_profile do
+RSpec.describe 'Two factor auths', feature_category: :system_access do
include Spec::Support::Helpers::ModalHelpers
context 'when signed in' do
diff --git a/spec/features/projects/blobs/user_follows_pipeline_suggest_nudge_spec.rb b/spec/features/projects/blobs/user_follows_pipeline_suggest_nudge_spec.rb
index cd7601aa94e..cc819ccb5b9 100644
--- a/spec/features/projects/blobs/user_follows_pipeline_suggest_nudge_spec.rb
+++ b/spec/features/projects/blobs/user_follows_pipeline_suggest_nudge_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'User follows pipeline suggest nudge spec when feature is enabled', :js, feature_category: :groups_and_projects do
+RSpec.describe 'User follows pipeline suggest nudge spec when feature is enabled', :js, feature_category: :source_code_management do
include CookieHelper
let(:project) { create(:project, :empty_repo) }
diff --git a/spec/features/projects/branches/user_creates_branch_spec.rb b/spec/features/projects/branches/user_creates_branch_spec.rb
index 8d636dacb75..70a387e3ceb 100644
--- a/spec/features/projects/branches/user_creates_branch_spec.rb
+++ b/spec/features/projects/branches/user_creates_branch_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'User creates branch', :js, feature_category: :groups_and_projects do
+RSpec.describe 'User creates branch', :js, feature_category: :source_code_management do
include Features::BranchesHelpers
let_it_be(:group) { create(:group, :public) }
diff --git a/spec/features/projects/settings/monitor_settings_spec.rb b/spec/features/projects/settings/monitor_settings_spec.rb
index fca10d9c0b0..4baa169238b 100644
--- a/spec/features/projects/settings/monitor_settings_spec.rb
+++ b/spec/features/projects/settings/monitor_settings_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'Projects > Settings > For a forked project', :js, feature_category: :groups_and_projects do
+RSpec.describe 'Projects > Settings > For a forked project', :js, feature_category: :incident_management do
include ListboxHelpers
let_it_be(:user) { create(:user) }
diff --git a/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb b/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb
index 1b53a6222e6..96ccc061491 100644
--- a/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb
+++ b/spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'Project > Settings > Packages and registries > Container registry tag expiration policy',
- feature_category: :groups_and_projects do
+ feature_category: :container_registry do
let_it_be(:user) { create(:user) }
let_it_be(:project, reload: true) { create(:project, namespace: user.namespace) }
diff --git a/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb b/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb
index 4e8f42ae792..9305467cbe4 100644
--- a/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb
+++ b/spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb
@@ -2,7 +2,7 @@
require "spec_helper"
-RSpec.describe "User interacts with deploy keys", :js, feature_category: :groups_and_projects do
+RSpec.describe "User interacts with deploy keys", :js, feature_category: :continuous_delivery do
let(:project) { create(:project, :repository) }
let(:user) { project.first_owner }
diff --git a/spec/features/projects/show/user_interacts_with_auto_devops_banner_spec.rb b/spec/features/projects/show/user_interacts_with_auto_devops_banner_spec.rb
index 98714da34f2..52438340312 100644
--- a/spec/features/projects/show/user_interacts_with_auto_devops_banner_spec.rb
+++ b/spec/features/projects/show/user_interacts_with_auto_devops_banner_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe 'Project > Show > User interacts with auto devops implicitly enabled banner',
- feature_category: :groups_and_projects do
+ feature_category: :auto_devops do
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
diff --git a/spec/frontend/emoji/components/emoji_group_spec.js b/spec/frontend/emoji/components/emoji_group_spec.js
index a2a46bedd7b..75397ce25ff 100644
--- a/spec/frontend/emoji/components/emoji_group_spec.js
+++ b/spec/frontend/emoji/components/emoji_group_spec.js
@@ -1,6 +1,5 @@
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
-import { GlButton } from '@gitlab/ui';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import EmojiGroup from '~/emoji/components/emoji_group.vue';
@@ -11,9 +10,6 @@ function factory(propsData = {}) {
wrapper = extendedWrapper(
shallowMount(EmojiGroup, {
propsData,
- stubs: {
- GlButton,
- },
}),
);
}
@@ -23,6 +19,7 @@ describe('Emoji group component', () => {
factory({
emojis: [],
renderGroup: false,
+ clickEmoji: jest.fn(),
});
expect(wrapper.findByTestId('emoji-button').exists()).toBe(false);
@@ -32,20 +29,24 @@ describe('Emoji group component', () => {
factory({
emojis: ['thumbsup', 'thumbsdown'],
renderGroup: true,
+ clickEmoji: jest.fn(),
});
expect(wrapper.findAllByTestId('emoji-button').exists()).toBe(true);
expect(wrapper.findAllByTestId('emoji-button').length).toBe(2);
});
- it('emits emoji-click', () => {
+ it('calls clickEmoji', () => {
+ const clickEmoji = jest.fn();
+
factory({
emojis: ['thumbsup', 'thumbsdown'],
renderGroup: true,
+ clickEmoji,
});
- wrapper.findComponent(GlButton).vm.$emit('click');
+ wrapper.findByTestId('emoji-button').trigger('click');
- expect(wrapper.emitted('emoji-click')).toStrictEqual([['thumbsup']]);
+ expect(clickEmoji).toHaveBeenCalledWith('thumbsup');
});
});
diff --git a/spec/frontend/repository/components/table/row_spec.js b/spec/frontend/repository/components/table/row_spec.js
index 80471d8734b..9bff801dbf0 100644
--- a/spec/frontend/repository/components/table/row_spec.js
+++ b/spec/frontend/repository/components/table/row_spec.js
@@ -146,10 +146,11 @@ describe('Repository table row component', () => {
});
it.each`
- path
- ${'test#'}
- ${'Änderungen'}
- `('renders link for $path', ({ path }) => {
+ path | encodedPath
+ ${'test#'} | ${'test%23'}
+ ${'Änderungen'} | ${'%C3%84nderungen'}
+ ${'dir%2f_hello__.sh'} | ${'dir%252f_hello__.sh'}
+ `('renders link for $path', ({ path, encodedPath }) => {
factory({
propsData: {
id: '1',
@@ -161,7 +162,7 @@ describe('Repository table row component', () => {
});
expect(wrapper.findComponent({ ref: 'link' }).props('to')).toBe(
- `/-/tree/main/${encodeURIComponent(path)}?ref_type=heads`,
+ `/-/tree/main/${encodedPath}?ref_type=heads`,
);
});
diff --git a/spec/frontend/vue_shared/alert_details/alert_details_spec.js b/spec/frontend/vue_shared/alert_details/alert_details_spec.js
index 6c2b21053f0..d2dfb6ee1bf 100644
--- a/spec/frontend/vue_shared/alert_details/alert_details_spec.js
+++ b/spec/frontend/vue_shared/alert_details/alert_details_spec.js
@@ -1,16 +1,19 @@
+import Vue, { nextTick } from 'vue';
+import VueApollo from 'vue-apollo';
import { GlAlert, GlLoadingIcon } from '@gitlab/ui';
import { mount, shallowMount } from '@vue/test-utils';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
-import { nextTick } from 'vue';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import waitForPromises from 'helpers/wait_for_promises';
+import createMockApollo from 'helpers/mock_apollo_helper';
import { joinPaths } from '~/lib/utils/url_utility';
import Tracking from '~/tracking';
import AlertDetails from '~/vue_shared/alert_details/components/alert_details.vue';
import AlertSummaryRow from '~/vue_shared/alert_details/components/alert_summary_row.vue';
import { PAGE_CONFIG, SEVERITY_LEVELS } from '~/vue_shared/alert_details/constants';
import createIssueMutation from '~/vue_shared/alert_details/graphql/mutations/alert_issue_create.mutation.graphql';
+import alertQuery from '~/vue_shared/alert_details/graphql/queries/alert_sidebar_details.query.graphql';
import AlertDetailsTable from '~/vue_shared/components/alert_details_table.vue';
import MetricImagesTab from '~/vue_shared/components/metric_images/metric_images_tab.vue';
import createStore from '~/vue_shared/components/metric_images/store/';
@@ -27,20 +30,57 @@ describe('AlertDetails', () => {
let environmentData = { name: environmentName, path: environmentPath };
let mock;
let wrapper;
+ let requestHandlers;
const projectPath = 'root/alerts';
const projectIssuesPath = 'root/alerts/-/issues';
const projectId = '1';
const $router = { push: jest.fn() };
+ const defaultHandlers = {
+ createIssueMutationMock: jest.fn().mockResolvedValue({
+ data: {
+ createAlertIssue: {
+ errors: [],
+ issue: {
+ id: 'id',
+ iid: 'iid',
+ webUrl: 'webUrl',
+ },
+ },
+ },
+ }),
+ alertQueryMock: jest.fn().mockResolvedValue({
+ data: {
+ project: {
+ id: '1',
+ alertManagementAlerts: {
+ nodes: [],
+ },
+ },
+ },
+ }),
+ };
+
+ const createMockApolloProvider = (handlers) => {
+ Vue.use(VueApollo);
+ requestHandlers = handlers;
+
+ return createMockApollo([
+ [alertQuery, handlers.alertQueryMock],
+ [createIssueMutation, handlers.createIssueMutationMock],
+ ]);
+ };
+
function mountComponent({
data,
- loading = false,
mountMethod = shallowMount,
provide = {},
stubs = {},
+ handlers = defaultHandlers,
} = {}) {
wrapper = extendedWrapper(
mountMethod(AlertDetails, {
+ apolloProvider: createMockApolloProvider(handlers),
provide: {
alertId: 'alertId',
projectPath,
@@ -59,15 +99,6 @@ describe('AlertDetails', () => {
};
},
mocks: {
- $apollo: {
- mutate: jest.fn(),
- queries: {
- alert: {
- loading,
- },
- sidebarStatus: {},
- },
- },
$router,
$route: { params: {} },
},
@@ -139,7 +170,6 @@ describe('AlertDetails', () => {
describe('Metrics tab', () => {
it('should mount without errors', () => {
mountComponent({
- mountMethod: mount,
provide: {
canUpdate: true,
iid: '1',
@@ -216,7 +246,6 @@ describe('AlertDetails', () => {
it('should display "Create incident" button when incident doesn\'t exist yet', async () => {
const issue = null;
mountComponent({
- mountMethod: mount,
data: { alert: { ...mockAlert, issue } },
});
@@ -226,23 +255,16 @@ describe('AlertDetails', () => {
});
it('calls `$apollo.mutate` with `createIssueQuery`', () => {
- const issueIid = '10';
mountComponent({
mountMethod: mount,
data: { alert: { ...mockAlert } },
});
- jest
- .spyOn(wrapper.vm.$apollo, 'mutate')
- .mockResolvedValue({ data: { createAlertIssue: { issue: { iid: issueIid } } } });
findCreateIncidentBtn().trigger('click');
- expect(wrapper.vm.$apollo.mutate).toHaveBeenCalledWith({
- mutation: createIssueMutation,
- variables: {
- iid: mockAlert.iid,
- projectPath,
- },
+ expect(requestHandlers.createIssueMutationMock).toHaveBeenCalledWith({
+ iid: mockAlert.iid,
+ projectPath,
});
});
@@ -251,25 +273,44 @@ describe('AlertDetails', () => {
mountComponent({
mountMethod: mount,
data: { alert: { ...mockAlert, alertIid: 1 } },
+ handlers: {
+ ...defaultHandlers,
+ createIssueMutationMock: jest.fn().mockRejectedValue(new Error(errorMsg)),
+ },
});
- jest.spyOn(wrapper.vm.$apollo, 'mutate').mockRejectedValue(errorMsg);
findCreateIncidentBtn().trigger('click');
await waitForPromises();
- expect(findIncidentCreationAlert().text()).toBe(errorMsg);
+ expect(findIncidentCreationAlert().text()).toBe(`Error: ${errorMsg}`);
});
});
describe('View full alert details', () => {
- beforeEach(() => {
- mountComponent({ data: { alert: mockAlert } });
+ beforeEach(async () => {
+ mountComponent({
+ data: { alert: mockAlert },
+ handlers: {
+ ...defaultHandlers,
+ alertQueryMock: jest.fn().mockResolvedValue({
+ data: {
+ project: {
+ id: '1',
+ alertManagementAlerts: {
+ nodes: [{ id: '1' }],
+ },
+ },
+ },
+ }),
+ },
+ });
+ await waitForPromises();
});
it('should display a table of raw alert details data', () => {
- const details = findDetailsTable();
- expect(details.exists()).toBe(true);
- expect(details.props()).toStrictEqual({
+ expect(findDetailsTable().exists()).toBe(true);
+
+ expect(findDetailsTable().props()).toStrictEqual({
alert: mockAlert,
statuses: PAGE_CONFIG.OPERATIONS.STATUSES,
loading: false,
@@ -279,7 +320,7 @@ describe('AlertDetails', () => {
describe('loading state', () => {
beforeEach(() => {
- mountComponent({ loading: true });
+ mountComponent();
});
it('displays a loading state when loading', () => {
diff --git a/spec/lib/gitlab/checks/tag_check_spec.rb b/spec/lib/gitlab/checks/tag_check_spec.rb
index 158dfad42e2..15c6b906689 100644
--- a/spec/lib/gitlab/checks/tag_check_spec.rb
+++ b/spec/lib/gitlab/checks/tag_check_spec.rb
@@ -60,6 +60,7 @@ RSpec.describe Gitlab::Checks::TagCheck, feature_category: :source_code_manageme
context "when prohibited_tag_name_encoding_check feature flag is disabled" do
before do
stub_feature_flags(prohibited_tag_name_encoding_check: false)
+ allow(change_check).to receive(:validate_tag_name_not_sha_like!)
end
it "doesn't prohibit tag names that include characters incompatible with UTF-8" do
@@ -83,6 +84,66 @@ RSpec.describe Gitlab::Checks::TagCheck, feature_category: :source_code_manageme
expect { change_check.validate! }.not_to raise_error
end
end
+
+ it "forbids SHA-1 values" do
+ allow(change_check)
+ .to receive(:tag_name)
+ .and_return("267208abfe40e546f5e847444276f7d43a39503e")
+
+ expect { change_check.validate! }.to raise_error(
+ Gitlab::GitAccess::ForbiddenError,
+ "You cannot create a tag with a SHA-1 or SHA-256 tag name."
+ )
+ end
+
+ it "forbids SHA-256 values" do
+ allow(change_check)
+ .to receive(:tag_name)
+ .and_return("09b9fd3ea68e9b95a51b693a29568c898e27d1476bbd83c825664f18467fc175")
+
+ expect { change_check.validate! }.to raise_error(
+ Gitlab::GitAccess::ForbiddenError,
+ "You cannot create a tag with a SHA-1 or SHA-256 tag name."
+ )
+ end
+
+ it "forbids '{SHA-1}{+anything}' values" do
+ allow(change_check)
+ .to receive(:tag_name)
+ .and_return("267208abfe40e546f5e847444276f7d43a39503e-")
+
+ expect { change_check.validate! }.to raise_error(
+ Gitlab::GitAccess::ForbiddenError,
+ "You cannot create a tag with a SHA-1 or SHA-256 tag name."
+ )
+ end
+
+ it "forbids '{SHA-256}{+anything} values" do
+ allow(change_check)
+ .to receive(:tag_name)
+ .and_return("09b9fd3ea68e9b95a51b693a29568c898e27d1476bbd83c825664f18467fc175-")
+
+ expect { change_check.validate! }.to raise_error(
+ Gitlab::GitAccess::ForbiddenError,
+ "You cannot create a tag with a SHA-1 or SHA-256 tag name."
+ )
+ end
+
+ it "allows SHA-1 values to be appended to the tag name" do
+ allow(change_check)
+ .to receive(:tag_name)
+ .and_return("fix-267208abfe40e546f5e847444276f7d43a39503e")
+
+ expect { change_check.validate! }.not_to raise_error
+ end
+
+ it "allows SHA-256 values to be appended to the tag name" do
+ allow(change_check)
+ .to receive(:tag_name)
+ .and_return("fix-09b9fd3ea68e9b95a51b693a29568c898e27d1476bbd83c825664f18467fc175")
+
+ expect { change_check.validate! }.not_to raise_error
+ end
end
context 'with protected tag' do
diff --git a/spec/lib/gitlab/ci/components/instance_path_spec.rb b/spec/lib/gitlab/ci/components/instance_path_spec.rb
index 6bc6f04309d..b9b4c3f7c69 100644
--- a/spec/lib/gitlab/ci/components/instance_path_spec.rb
+++ b/spec/lib/gitlab/ci/components/instance_path_spec.rb
@@ -42,48 +42,86 @@ RSpec.describe Gitlab::Ci::Components::InstancePath, feature_category: :pipeline
end
end
- context 'when the component is simple (single file template)' do
- it 'fetches the component content', :aggregate_failures do
+ shared_examples 'does not find the component' do
+ it 'returns nil' do
result = path.fetch_content!(current_user: user)
- expect(result.content).to eq('image: alpine_1')
- expect(result.path).to eq('templates/secret-detection.yml')
- expect(path.host).to eq(current_host)
- expect(path.project).to eq(project)
- expect(path.sha).to eq(project.commit('master').id)
+ expect(result).to be_nil
+ end
+ end
+
+ shared_examples 'finds the component' do
+ shared_examples 'fetches the component content' do
+ it 'fetches the component content', :aggregate_failures do
+ result = path.fetch_content!(current_user: user)
+ expect(result.content).to eq(file_content)
+ expect(result.path).to eq(file_path)
+ expect(path.host).to eq(current_host)
+ expect(path.project).to eq(project)
+ expect(path.sha).to eq(project.commit('master').id)
+ end
+ end
+
+ it_behaves_like 'fetches the component content'
+
+ context 'when feature flag ci_redirect_component_project is disabled' do
+ before do
+ stub_feature_flags(ci_redirect_component_project: false)
+ end
+
+ it_behaves_like 'fetches the component content'
+ end
+
+ context 'when the there is a redirect set for the project' do
+ let!(:redirect_route) { project.redirect_routes.create!(path: 'another-group/new-project') }
+ let(:project_path) { redirect_route.path }
+
+ it_behaves_like 'fetches the component content'
+
+ context 'when feature flag ci_redirect_component_project is disabled' do
+ before do
+ stub_feature_flags(ci_redirect_component_project: false)
+ end
+
+ it_behaves_like 'does not find the component'
+ end
+ end
+ end
+
+ context 'when the component is simple (single file template)' do
+ it_behaves_like 'finds the component' do
+ let(:file_path) { 'templates/secret-detection.yml' }
+ let(:file_content) { 'image: alpine_1' }
end
end
context 'when the component is complex (directory-based template)' do
let(:address) { "acme.com/#{project_path}/dast@#{version}" }
- it 'fetches the component content', :aggregate_failures do
- result = path.fetch_content!(current_user: user)
- expect(result.content).to eq('image: alpine_2')
- expect(result.path).to eq('templates/dast/template.yml')
- expect(path.host).to eq(current_host)
- expect(path.project).to eq(project)
- expect(path.sha).to eq(project.commit('master').id)
+ it_behaves_like 'finds the component' do
+ let(:file_path) { 'templates/dast/template.yml' }
+ let(:file_content) { 'image: alpine_2' }
end
context 'when there is an invalid nested component folder' do
let(:address) { "acme.com/#{project_path}/dast/another-folder@#{version}" }
- it 'returns nil' do
- result = path.fetch_content!(current_user: user)
- expect(result.content).to be_nil
- end
+ it_behaves_like 'does not find the component'
end
context 'when there is an invalid nested component path' do
let(:address) { "acme.com/#{project_path}/dast/another-template@#{version}" }
- it 'returns nil' do
- result = path.fetch_content!(current_user: user)
- expect(result.content).to be_nil
- end
+ it_behaves_like 'does not find the component'
end
end
+ context "when the project path starts with '/'" do
+ let(:project_path) { "/#{project.full_path}" }
+
+ it_behaves_like 'does not find the component'
+ end
+
+ # TODO: remove when deleting the feature flag `ci_redirect_component_project`
shared_examples 'prevents infinite loop' do |prefix|
context "when the project path starts with '#{prefix}'" do
let(:project_path) { "#{prefix}#{project.full_path}" }
diff --git a/spec/lib/gitlab/ci/parsers/sbom/cyclonedx_spec.rb b/spec/lib/gitlab/ci/parsers/sbom/cyclonedx_spec.rb
index a331af9a9ac..9c8402faf77 100644
--- a/spec/lib/gitlab/ci/parsers/sbom/cyclonedx_spec.rb
+++ b/spec/lib/gitlab/ci/parsers/sbom/cyclonedx_spec.rb
@@ -33,35 +33,27 @@ RSpec.describe Gitlab::Ci::Parsers::Sbom::Cyclonedx, feature_category: :dependen
allow(SecureRandom).to receive(:uuid).and_return(uuid)
end
- context 'when report JSON is invalid' do
- let(:raw_report_data) { '{ ' }
+ context 'when report is invalid' do
+ context 'when report JSON is invalid' do
+ let(:raw_report_data) { '{ ' }
- it 'handles errors and adds them to the report' do
- expect(report).to receive(:add_error).with(a_string_including("Report JSON is invalid:"))
+ it 'handles errors and adds them to the report' do
+ expect(report).to receive(:add_error).with(a_string_including("Report JSON is invalid:"))
- expect { parse! }.not_to raise_error
+ expect { parse! }.not_to raise_error
+ end
end
- end
-
- context 'when report uses an unsupported spec version' do
- let(:report_data) { base_report_data.merge({ 'specVersion' => '1.3' }) }
-
- it 'reports unsupported version as an error' do
- expect(report).to receive(:add_error).with("Unsupported CycloneDX spec version. Must be one of: 1.4")
- parse!
- end
- end
+ context 'when report does not conform to the CycloneDX schema' do
+ let(:report_valid?) { false }
+ let(:validator_errors) { %w[error1 error2] }
- context 'when report does not conform to the CycloneDX schema' do
- let(:report_valid?) { false }
- let(:validator_errors) { %w[error1 error2] }
+ it 'reports all errors returned by the validator' do
+ expect(report).to receive(:add_error).with("error1")
+ expect(report).to receive(:add_error).with("error2")
- it 'reports all errors returned by the validator' do
- expect(report).to receive(:add_error).with("error1")
- expect(report).to receive(:add_error).with("error2")
-
- parse!
+ parse!
+ end
end
end
@@ -109,25 +101,26 @@ RSpec.describe Gitlab::Ci::Parsers::Sbom::Cyclonedx, feature_category: :dependen
it 'adds each component, ignoring unused attributes' do
expect(report).to receive(:add_component)
- .with(
- an_object_having_attributes(
- name: "activesupport",
- version: "5.1.4",
- component_type: "library",
- purl: an_object_having_attributes(type: "gem")
- )
- )
+ .with(
+ an_object_having_attributes(
+ name: "activesupport",
+ version: "5.1.4",
+ component_type: "library",
+ purl: an_object_having_attributes(type: "gem")
+ )
+ )
expect(report).to receive(:add_component)
- .with(
- an_object_having_attributes(
- name: "byebug",
- version: "10.0.0",
- component_type: "library",
- purl: an_object_having_attributes(type: "gem")
- )
- )
+ .with(
+ an_object_having_attributes(
+ name: "byebug",
+ version: "10.0.0",
+ component_type: "library",
+ purl: an_object_having_attributes(type: "gem")
+ )
+ )
expect(report).to receive(:add_component)
- .with(an_object_having_attributes(name: "minimal-component", version: nil, component_type: "library"))
+ .with(an_object_having_attributes(name: "minimal-component", version: nil,
+ component_type: "library"))
parse!
end
diff --git a/spec/lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator_spec.rb b/spec/lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator_spec.rb
index acb7c122bcd..9422290761d 100644
--- a/spec/lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator_spec.rb
+++ b/spec/lib/gitlab/ci/parsers/sbom/validators/cyclonedx_schema_validator_spec.rb
@@ -4,160 +4,116 @@ require "spec_helper"
RSpec.describe Gitlab::Ci::Parsers::Sbom::Validators::CyclonedxSchemaValidator,
feature_category: :dependency_management do
- # Reports should be valid or invalid according to the specification at
- # https://cyclonedx.org/docs/1.4/json/
-
- subject(:validator) { described_class.new(report_data) }
-
- let_it_be(:required_attributes) do
+ let(:report_data) do
{
"bomFormat" => "CycloneDX",
- "specVersion" => "1.4",
+ "specVersion" => spec_version,
"version" => 1
}
end
- context "with minimally valid report" do
- let_it_be(:report_data) { required_attributes }
-
- it { is_expected.to be_valid }
- end
-
- context "when report has components" do
- let(:report_data) { required_attributes.merge({ "components" => components }) }
-
- context "with minimally valid components" do
- let(:components) do
- [
- {
- "type" => "library",
- "name" => "activesupport"
- },
- {
- "type" => "library",
- "name" => "byebug"
- }
- ]
- end
+ subject(:validator) { described_class.new(report_data) }
- it { is_expected.to be_valid }
+ shared_examples 'a validator that performs the expected validations' do
+ let(:required_attributes) do
+ {
+ "bomFormat" => "CycloneDX",
+ "specVersion" => spec_version,
+ "version" => 1
+ }
end
- context "when components have versions" do
- let(:components) do
- [
- {
- "type" => "library",
- "name" => "activesupport",
- "version" => "5.1.4"
- },
- {
- "type" => "library",
- "name" => "byebug",
- "version" => "10.0.0"
- }
- ]
- end
+ context "with minimally valid report" do
+ let(:report_data) { required_attributes }
it { is_expected.to be_valid }
end
- context 'when components have licenses' do
- let(:components) do
- [
- {
- "type" => "library",
- "name" => "activesupport",
- "version" => "5.1.4",
- "licenses" => [
- { "license" => { "id" => "MIT" } }
- ]
- }
- ]
- end
+ context "when report has components" do
+ let(:report_data) { required_attributes.merge({ "components" => components }) }
- it { is_expected.to be_valid }
- end
-
- context 'when components have a signature' do
- let(:components) do
- [
- {
- "type" => "library",
- "name" => "activesupport",
- "version" => "5.1.4",
- "signature" => {
- "algorithm" => "ES256",
- "publicKey" => {
- "kty" => "EC",
- "crv" => "P-256",
- "x" => "6BKxpty8cI-exDzCkh-goU6dXq3MbcY0cd1LaAxiNrU",
- "y" => "mCbcvUzm44j3Lt2b5BPyQloQ91tf2D2V-gzeUxWaUdg"
- },
- "value" => "ybT1qz5zHNi4Ndc6y7Zhamuf51IqXkPkZwjH1XcC-KSuBiaQplTw6Jasf2MbCLg3CF7PAdnMO__WSLwvI5r2jA"
+ context "with minimally valid components" do
+ let(:components) do
+ [
+ {
+ "type" => "library",
+ "name" => "activesupport"
+ },
+ {
+ "type" => "library",
+ "name" => "byebug"
}
- }
- ]
- end
-
- it { is_expected.to be_valid }
- end
+ ]
+ end
- context "when components are not valid" do
- let(:components) do
- [
- { "type" => "foo" },
- { "name" => "activesupport" }
- ]
+ it { is_expected.to be_valid }
end
- it { is_expected.not_to be_valid }
-
- it "outputs errors for each validation failure" do
- expect(validator.errors).to match_array(
+ context "when components have versions" do
+ let(:components) do
[
- "property '/components/0' is missing required keys: name",
- "property '/components/0/type' is not one of: [\"application\", \"framework\"," \
- " \"library\", \"container\", \"operating-system\", \"device\", \"firmware\", \"file\"]",
- "property '/components/1' is missing required keys: type"
- ])
- end
- end
- end
-
- context "when report has metadata" do
- let(:metadata) do
- {
- "timestamp" => "2022-02-23T08:02:39Z",
- "tools" => [{ "vendor" => "GitLab", "name" => "Gemnasium", "version" => "2.34.0" }],
- "authors" => [{ "name" => "GitLab", "email" => "support@gitlab.com" }]
- }
- end
+ {
+ "type" => "library",
+ "name" => "activesupport",
+ "version" => "5.1.4"
+ },
+ {
+ "type" => "library",
+ "name" => "byebug",
+ "version" => "10.0.0"
+ }
+ ]
+ end
- let(:report_data) { required_attributes.merge({ "metadata" => metadata }) }
+ it { is_expected.to be_valid }
+ end
- it { is_expected.to be_valid }
+ context 'when components have licenses' do
+ let(:components) do
+ [
+ {
+ "type" => "library",
+ "name" => "activesupport",
+ "version" => "5.1.4",
+ "licenses" => [
+ { "license" => { "id" => "MIT" } }
+ ]
+ }
+ ]
+ end
- context "when metadata has properties" do
- before do
- metadata.merge!({ "properties" => properties })
+ it { is_expected.to be_valid }
end
- context "when properties are valid" do
- let(:properties) do
+ context 'when components have a signature' do
+ let(:components) do
[
- { "name" => "gitlab:dependency_scanning:input_file", "value" => "Gemfile.lock" },
- { "name" => "gitlab:dependency_scanning:package_manager", "value" => "bundler" }
+ {
+ "type" => "library",
+ "name" => "activesupport",
+ "version" => "5.1.4",
+ "signature" => {
+ "algorithm" => "ES256",
+ "publicKey" => {
+ "kty" => "EC",
+ "crv" => "P-256",
+ "x" => "6BKxpty8cI-exDzCkh-goU6dXq3MbcY0cd1LaAxiNrU",
+ "y" => "mCbcvUzm44j3Lt2b5BPyQloQ91tf2D2V-gzeUxWaUdg"
+ },
+ "value" => "ybT1qz5zHNi4Ndc6y7Zhamuf51IqXkPkZwjH1XcC-KSuBiaQplTw6Jasf2MbCLg3CF7PAdnMO__WSLwvI5r2jA"
+ }
+ }
]
end
it { is_expected.to be_valid }
end
- context "when properties are invalid" do
- let(:properties) do
+ context "when components are not valid" do
+ let(:components) do
[
- { "name" => ["gitlab:meta:schema_version"], "value" => 1 }
+ { "type" => "foo" },
+ { "name" => "activesupport" }
]
end
@@ -166,11 +122,75 @@ RSpec.describe Gitlab::Ci::Parsers::Sbom::Validators::CyclonedxSchemaValidator,
it "outputs errors for each validation failure" do
expect(validator.errors).to match_array(
[
- "property '/metadata/properties/0/name' is not of type: string",
- "property '/metadata/properties/0/value' is not of type: string"
+ "property '/components/0' is missing required keys: name",
+ a_string_starting_with("property '/components/0/type' is not one of:"),
+ "property '/components/1' is missing required keys: type"
])
end
end
end
+
+ context "when report has metadata" do
+ let(:metadata) do
+ {
+ "timestamp" => "2022-02-23T08:02:39Z",
+ "tools" => [{ "vendor" => "GitLab", "name" => "Gemnasium", "version" => "2.34.0" }],
+ "authors" => [{ "name" => "GitLab", "email" => "support@gitlab.com" }]
+ }
+ end
+
+ let(:report_data) { required_attributes.merge({ "metadata" => metadata }) }
+
+ it { is_expected.to be_valid }
+
+ context "when metadata has properties" do
+ before do
+ metadata.merge!({ "properties" => properties })
+ end
+
+ context "when properties are valid" do
+ let(:properties) do
+ [
+ { "name" => "gitlab:dependency_scanning:input_file", "value" => "Gemfile.lock" },
+ { "name" => "gitlab:dependency_scanning:package_manager", "value" => "bundler" }
+ ]
+ end
+
+ it { is_expected.to be_valid }
+ end
+
+ context "when properties are invalid" do
+ let(:properties) do
+ [
+ { "name" => ["gitlab:meta:schema_version"], "value" => 1 }
+ ]
+ end
+
+ it { is_expected.not_to be_valid }
+
+ it "outputs errors for each validation failure" do
+ expect(validator.errors).to match_array(
+ [
+ "property '/metadata/properties/0/name' is not of type: string",
+ "property '/metadata/properties/0/value' is not of type: string"
+ ])
+ end
+ end
+ end
+ end
+ end
+
+ context 'when spec version is supported' do
+ where(:spec_version) { %w[1.4 1.5] }
+
+ with_them do
+ it_behaves_like 'a validator that performs the expected validations'
+ end
+ end
+
+ context 'when spec version is not supported' do
+ let(:spec_version) { '1.3' }
+
+ it { is_expected.not_to be_valid }
end
end
diff --git a/spec/lib/gitlab/gitaly_client/conflicts_service_spec.rb b/spec/lib/gitlab/gitaly_client/conflicts_service_spec.rb
index bdc16f16e66..ddd63159a03 100644
--- a/spec/lib/gitlab/gitaly_client/conflicts_service_spec.rb
+++ b/spec/lib/gitlab/gitaly_client/conflicts_service_spec.rb
@@ -17,26 +17,11 @@ RSpec.describe Gitlab::GitalyClient::ConflictsService do
describe '#conflicts' do
subject(:conflicts) { client.conflicts? }
- context "with the `skip_conflict_files_in_gitaly` feature flag on" do
- it 'calls list_conflict_files with `skip_content: true`' do
- expect_any_instance_of(described_class).to receive(:list_conflict_files)
- .with(skip_content: true).and_return(["let's pretend i'm a conflicted file"])
+ it 'calls list_conflict_files with no parameters' do
+ expect_any_instance_of(described_class).to receive(:list_conflict_files)
+ .and_return(["let's pretend i'm a conflicted file"])
- conflicts
- end
- end
-
- context "with the `skip_conflict_files_in_gitaly` feature flag off" do
- before do
- stub_feature_flags(skip_conflict_files_in_gitaly: false)
- end
-
- it 'calls list_conflict_files with no parameters' do
- expect_any_instance_of(described_class).to receive(:list_conflict_files)
- .with(skip_content: false).and_return(["let's pretend i'm a conflicted file"])
-
- conflicts
- end
+ conflicts
end
end
diff --git a/spec/lib/gitlab/internal_events_spec.rb b/spec/lib/gitlab/internal_events_spec.rb
index 31e4f6ab127..7ac583b24ce 100644
--- a/spec/lib/gitlab/internal_events_spec.rb
+++ b/spec/lib/gitlab/internal_events_spec.rb
@@ -273,6 +273,7 @@ RSpec.describe Gitlab::InternalEvents, :snowplow, feature_category: :product_ana
let(:app_id) { 'foobar' }
let(:url) { 'http://localhost:4000' }
let(:sdk_client) { instance_double('GitlabSDK::Client') }
+ let(:event_kwargs) { { user: user, project: project } }
before do
described_class.clear_memoization(:gitlab_sdk_client)
@@ -281,7 +282,7 @@ RSpec.describe Gitlab::InternalEvents, :snowplow, feature_category: :product_ana
stub_env('GITLAB_ANALYTICS_URL', url)
end
- subject(:track_event) { described_class.track_event(event_name, user: user) }
+ subject(:track_event) { described_class.track_event(event_name, **event_kwargs) }
shared_examples 'does not send a Product Analytics event' do
it 'does not call the Product Analytics Ruby SDK' do
@@ -303,7 +304,8 @@ RSpec.describe Gitlab::InternalEvents, :snowplow, feature_category: :product_ana
it 'calls Product Analytics Ruby SDK', :aggregate_failures do
expect(sdk_client).to receive(:identify).with(user.id)
- expect(sdk_client).to receive(:track).with(event_name, nil)
+ expect(sdk_client).to receive(:track)
+ .with(event_name, { project_id: project.id, namespace_id: project.namespace.id })
track_event
end
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 4aa687b5135..48e19cd0ad5 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -1046,6 +1046,11 @@ RSpec.describe Issue, feature_category: :team_planning do
end
end
+ it_behaves_like 'a time trackable' do
+ let(:trackable) { create(:issue) }
+ let(:timelog) { create(:issue_timelog, issue: trackable) }
+ end
+
it_behaves_like 'an editable mentionable' do
subject { create(:issue, project: create(:project, :repository)) }
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 1b4e74b4f01..2b5f4165d8c 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -2058,6 +2058,11 @@ RSpec.describe MergeRequest, factory_default: :keep, feature_category: :code_rev
end
end
+ it_behaves_like 'a time trackable' do
+ let(:trackable) { create(:merge_request, :simple, source_project: create(:project, :repository)) }
+ let(:timelog) { create(:merge_request_timelog, merge_request: trackable) }
+ end
+
it_behaves_like 'an editable mentionable' do
subject { create(:merge_request, :simple, source_project: create(:project, :repository)) }
diff --git a/spec/models/timelog_spec.rb b/spec/models/timelog_spec.rb
index 4f2f16875b8..aee2c4ded19 100644
--- a/spec/models/timelog_spec.rb
+++ b/spec/models/timelog_spec.rb
@@ -46,6 +46,53 @@ RSpec.describe Timelog, feature_category: :team_planning do
expect(subject).to be_valid
end
+ describe 'check if total time spent would be within the set range' do
+ let_it_be(:time_already_spent) { 1.minute.to_i }
+
+ before_all do
+ create(:issue_timelog, issue: issue, time_spent: time_already_spent)
+ end
+
+ it 'is valid when a negative time spent offsets the time already spent' do
+ timelog = build(:issue_timelog, issue: issue, time_spent: -time_already_spent)
+
+ expect(timelog).to be_valid
+ end
+
+ context 'when total time spent is within the allowed range' do
+ before_all do
+ # Offset the time already spent
+ create(:issue_timelog, issue: issue, time_spent: -time_already_spent)
+ end
+
+ it 'is valid' do
+ timelog = build(:issue_timelog, issue: issue, time_spent: 1.minute.to_i)
+
+ expect(timelog).to be_valid
+ end
+ end
+
+ context 'when total time spent is outside the allowed range' do
+ it 'adds an error if total time spent would exceed a year' do
+ time_to_spend = described_class::MAX_TOTAL_TIME_SPENT - time_already_spent + 1.second.to_i
+ timelog = build(:issue_timelog, issue: issue, time_spent: time_to_spend)
+
+ expect { timelog.save! }
+ .to raise_error(ActiveRecord::RecordInvalid,
+ _('Validation failed: Total time spent cannot exceed a year.'))
+ end
+
+ it 'adds an error if total time spent would be negative' do
+ time_to_spend = -time_already_spent - 1.second.to_i
+ timelog = build(:issue_timelog, issue: issue, time_spent: time_to_spend)
+
+ expect { timelog.save! }
+ .to raise_error(ActiveRecord::RecordInvalid,
+ _('Validation failed: Total time spent cannot be negative.'))
+ end
+ end
+ end
+
describe 'when importing' do
it 'is valid if issue_id and merge_request_id are missing' do
subject.attributes = { issue: nil, merge_request: nil, importing: true }
diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb
index c81cffeb871..a9a4575d747 100644
--- a/spec/policies/project_policy_spec.rb
+++ b/spec/policies/project_policy_spec.rb
@@ -3267,37 +3267,46 @@ RSpec.describe ProjectPolicy, feature_category: :system_access do
end
describe 'read_model_registry' do
- let(:project_with_feature) { project }
- let(:current_user) { owner }
-
- before do
- stub_feature_flags(model_registry: false)
- stub_feature_flags(model_registry: project_with_feature) if project_with_feature
- end
+ using RSpec::Parameterized::TableSyntax
- context 'feature flag is enabled' do
- specify { is_expected.to be_allowed(:read_model_registry) }
+ where(:feature_flag_enabled, :current_user, :access_level, :allowed) do
+ false | ref(:owner) | Featurable::ENABLED | false
+ true | ref(:guest) | Featurable::ENABLED | true
+ true | ref(:guest) | Featurable::PRIVATE | true
+ true | ref(:guest) | Featurable::DISABLED | false
+ true | ref(:non_member) | Featurable::ENABLED | true
+ true | ref(:non_member) | Featurable::PRIVATE | false
+ true | ref(:non_member) | Featurable::DISABLED | false
end
+ with_them do
+ before do
+ stub_feature_flags(model_registry: feature_flag_enabled)
+ project.project_feature.update!(model_registry_access_level: access_level)
+ end
- context 'feature flag is disabled' do
- let(:project_with_feature) { nil }
-
- specify { is_expected.not_to be_allowed(:read_model_registry) }
+ if params[:allowed]
+ it { expect_allowed(:read_model_registry) }
+ else
+ it { expect_disallowed(:read_model_registry) }
+ end
end
end
describe 'write_model_registry' do
using RSpec::Parameterized::TableSyntax
- where(:ff_model_registry_enabled, :current_user, :allowed) do
- true | ref(:reporter) | true
- true | ref(:guest) | false
- false | ref(:owner) | false
+ where(:feature_flag_enabled, :current_user, :access_level, :allowed) do
+ false | ref(:owner) | Featurable::ENABLED | false
+ true | ref(:reporter) | Featurable::ENABLED | true
+ true | ref(:reporter) | Featurable::PRIVATE | true
+ true | ref(:reporter) | Featurable::DISABLED | false
+ true | ref(:guest) | Featurable::ENABLED | false
+ true | ref(:non_member) | Featurable::ENABLED | false
end
with_them do
before do
- stub_feature_flags(model_registry: false)
- stub_feature_flags(model_registry: project) if ff_model_registry_enabled
+ stub_feature_flags(model_registry: feature_flag_enabled)
+ project.project_feature.update!(model_registry_access_level: access_level)
end
if params[:allowed]
diff --git a/spec/requests/api/ci/pipeline_schedules_spec.rb b/spec/requests/api/ci/pipeline_schedules_spec.rb
index fb67d7cb4fb..a4bb379d01c 100644
--- a/spec/requests/api/ci/pipeline_schedules_spec.rb
+++ b/spec/requests/api/ci/pipeline_schedules_spec.rb
@@ -628,17 +628,89 @@ RSpec.describe API::Ci::PipelineSchedules, feature_category: :continuous_integra
context 'authenticated user with valid permissions' do
context 'with required parameters' do
- it 'creates pipeline_schedule_variable' do
- expect do
- post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables", developer),
+ let(:pipeline_schedule) do
+ create(:ci_pipeline_schedule, project: project, owner: api_user)
+ end
+
+ let_it_be(:maintainer) { create(:user) }
+ let_it_be(:project_owner) { create(:user) }
+
+ before do
+ project.add_maintainer(maintainer)
+ project.add_owner(project_owner)
+ end
+
+ shared_examples 'creates pipeline_schedule_variables' do
+ it do
+ expect do
+ post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables", api_user),
+ params: params.merge(variable_type: 'file')
+ end.to change { pipeline_schedule.variables.count }.by(1)
+
+ expect(response).to have_gitlab_http_status(:created)
+ expect(response).to match_response_schema('pipeline_schedule_variable')
+ expect(json_response['key']).to eq(params[:key])
+ expect(json_response['value']).to eq(params[:value])
+ expect(json_response['variable_type']).to eq('file')
+ end
+ end
+
+ shared_examples 'fails to create pipeline_schedule_variables' do
+ it do
+ post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables", api_user),
params: params.merge(variable_type: 'file')
- end.to change { pipeline_schedule.variables.count }.by(1)
- expect(response).to have_gitlab_http_status(:created)
- expect(response).to match_response_schema('pipeline_schedule_variable')
- expect(json_response['key']).to eq(params[:key])
- expect(json_response['value']).to eq(params[:value])
- expect(json_response['variable_type']).to eq('file')
+ expect(pipeline_schedule.variables.count).to eq(0)
+ expect(response).to have_gitlab_http_status(:forbidden)
+ end
+ end
+
+ context 'when project restricts use of user defined variables' do
+ before do
+ project.update!(restrict_user_defined_variables: true)
+ end
+
+ context 'as developer' do
+ let(:api_user) { developer }
+
+ it_behaves_like 'fails to create pipeline_schedule_variables'
+ end
+
+ context 'as maintainer' do
+ let(:api_user) { maintainer }
+
+ it_behaves_like 'creates pipeline_schedule_variables'
+ end
+
+ context 'as owner' do
+ let(:api_user) { project_owner }
+
+ it_behaves_like 'creates pipeline_schedule_variables'
+ end
+ end
+
+ context 'when project does not restrict use of user defined variables' do
+ before do
+ project.update!(restrict_user_defined_variables: false)
+ end
+
+ context 'as developer' do
+ let(:api_user) { developer }
+
+ it_behaves_like 'creates pipeline_schedule_variables'
+ end
+
+ context 'as maintainer' do
+ let(:api_user) { maintainer }
+
+ it_behaves_like 'creates pipeline_schedule_variables'
+ end
+
+ context 'as owner' do
+ let(:api_user) { project_owner }
+
+ it_behaves_like 'creates pipeline_schedule_variables'
+ end
end
end
@@ -688,14 +760,85 @@ RSpec.describe API::Ci::PipelineSchedules, feature_category: :continuous_integra
end
context 'authenticated user with valid permissions' do
- it 'updates pipeline_schedule_variable' do
- put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", developer),
- params: { value: 'updated_value', variable_type: 'file' }
+ let(:pipeline_schedule) do
+ create(:ci_pipeline_schedule, project: project, owner: api_user)
+ end
- expect(response).to have_gitlab_http_status(:ok)
- expect(response).to match_response_schema('pipeline_schedule_variable')
- expect(json_response['value']).to eq('updated_value')
- expect(json_response['variable_type']).to eq('file')
+ let_it_be(:maintainer) { create(:user) }
+ let_it_be(:project_owner) { create(:user) }
+
+ before do
+ project.add_maintainer(maintainer)
+ project.add_owner(project_owner)
+ end
+
+ shared_examples 'updates pipeline_schedule_variable' do
+ it do
+ put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", api_user),
+ params: { value: 'updated_value', variable_type: 'file' }
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(response).to match_response_schema('pipeline_schedule_variable')
+ expect(json_response['value']).to eq('updated_value')
+ expect(json_response['variable_type']).to eq('file')
+ end
+ end
+
+ shared_examples 'fails to update pipeline_schedule_variable' do
+ it do
+ put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", api_user),
+ params: { value: 'updated_value', variable_type: 'file' }
+
+ expect(response).to have_gitlab_http_status(:forbidden)
+ end
+ end
+
+ context 'when project restricts use of user defined variables' do
+ before do
+ project.update!(restrict_user_defined_variables: true)
+ end
+
+ context 'as developer' do
+ let(:api_user) { developer }
+
+ it_behaves_like 'fails to update pipeline_schedule_variable'
+ end
+
+ context 'as maintainer' do
+ let(:api_user) { maintainer }
+
+ it_behaves_like 'updates pipeline_schedule_variable'
+ end
+
+ context 'as owner' do
+ let(:api_user) { project_owner }
+
+ it_behaves_like 'updates pipeline_schedule_variable'
+ end
+ end
+
+ context 'when project does not restrict use of user defined variables' do
+ before do
+ project.update!(restrict_user_defined_variables: false)
+ end
+
+ context 'as developer' do
+ let(:api_user) { developer }
+
+ it_behaves_like 'updates pipeline_schedule_variable'
+ end
+
+ context 'as maintainer' do
+ let(:api_user) { maintainer }
+
+ it_behaves_like 'updates pipeline_schedule_variable'
+ end
+
+ context 'as owner' do
+ let(:api_user) { project_owner }
+
+ it_behaves_like 'updates pipeline_schedule_variable'
+ end
end
end
@@ -732,19 +875,93 @@ RSpec.describe API::Ci::PipelineSchedules, feature_category: :continuous_integra
end
context 'authenticated user with valid permissions' do
- it 'deletes pipeline_schedule_variable' do
- expect do
- delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", maintainer)
- end.to change { Ci::PipelineScheduleVariable.count }.by(-1)
+ let(:pipeline_schedule) do
+ create(:ci_pipeline_schedule, project: project, owner: api_user)
+ end
- expect(response).to have_gitlab_http_status(:accepted)
- expect(response).to match_response_schema('pipeline_schedule_variable')
+ let_it_be(:project_owner) { create(:user) }
+
+ before do
+ project.add_owner(project_owner)
end
- it 'responds with 404 Not Found if requesting non-existing pipeline_schedule_variable' do
- delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/____", maintainer)
+ shared_examples 'deletes pipeline_schedule_variable' do
+ it do
+ expect do
+ delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", api_user)
+ end.to change { Ci::PipelineScheduleVariable.count }.by(-1)
- expect(response).to have_gitlab_http_status(:not_found)
+ expect(response).to have_gitlab_http_status(:accepted)
+ expect(response).to match_response_schema('pipeline_schedule_variable')
+ end
+ end
+
+ shared_examples 'fails to delete pipeline_schedule_variable' do
+ it do
+ expect do
+ delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", api_user)
+ end.not_to change { Ci::PipelineScheduleVariable.count }
+
+ expect(response).to have_gitlab_http_status(:forbidden)
+ end
+ end
+
+ context 'when project restricts use of user defined variables' do
+ before do
+ project.update!(restrict_user_defined_variables: true)
+ end
+
+ context 'as developer' do
+ let(:api_user) { developer }
+
+ it_behaves_like 'fails to delete pipeline_schedule_variable'
+ end
+
+ context 'as maintainer' do
+ let(:api_user) { maintainer }
+
+ it_behaves_like 'deletes pipeline_schedule_variable'
+ end
+
+ context 'as owner' do
+ let(:api_user) { project_owner }
+
+ it_behaves_like 'deletes pipeline_schedule_variable'
+ end
+ end
+
+ context 'when project does not restrict use of user defined variables' do
+ before do
+ project.update!(restrict_user_defined_variables: false)
+ end
+
+ context 'as developer' do
+ let(:api_user) { developer }
+
+ it_behaves_like 'deletes pipeline_schedule_variable'
+ end
+
+ context 'as maintainer' do
+ let(:api_user) { maintainer }
+
+ it_behaves_like 'deletes pipeline_schedule_variable'
+ end
+
+ context 'as owner' do
+ let(:api_user) { project_owner }
+
+ it_behaves_like 'deletes pipeline_schedule_variable'
+ end
+ end
+
+ context 'as developer' do
+ let(:api_user) { developer }
+
+ it 'responds with 404 Not Found if requesting non-existing pipeline_schedule_variable' do
+ delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/____", maintainer)
+
+ expect(response).to have_gitlab_http_status(:not_found)
+ end
end
end
diff --git a/spec/requests/api/graphql/mutations/work_items/delete_task_spec.rb b/spec/requests/api/graphql/mutations/work_items/delete_task_spec.rb
deleted file mode 100644
index b1828de046f..00000000000
--- a/spec/requests/api/graphql/mutations/work_items/delete_task_spec.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe "Delete a task in a work item's description", feature_category: :team_planning do
- include GraphqlHelpers
-
- let_it_be(:project) { create(:project) }
- let_it_be(:developer) { create(:user).tap { |user| project.add_developer(user) } }
- let_it_be(:task) { create(:work_item, :task, project: project, author: developer) }
- let_it_be(:work_item, refind: true) do
- create(:work_item, project: project, description: "- [ ] #{task.to_reference}+", lock_version: 3)
- end
-
- before_all do
- create(:issue_link, source_id: work_item.id, target_id: task.id)
- end
-
- let(:lock_version) { work_item.lock_version }
- let(:input) do
- {
- 'id' => work_item.to_global_id.to_s,
- 'lockVersion' => lock_version,
- 'taskData' => {
- 'id' => task.to_global_id.to_s,
- 'lineNumberStart' => 1,
- 'lineNumberEnd' => 1
- }
- }
- end
-
- let(:mutation) { graphql_mutation(:workItemDeleteTask, input) }
- let(:mutation_response) { graphql_mutation_response(:work_item_delete_task) }
-
- context 'the user is not allowed to update a work item' do
- let(:current_user) { create(:user) }
-
- it_behaves_like 'a mutation that returns a top-level access error'
- end
-
- context 'when user can update the description but not delete the task' do
- let(:current_user) { create(:user).tap { |u| project.add_developer(u) } }
-
- it_behaves_like 'a mutation that returns a top-level access error'
- end
-
- context 'when user has permissions to remove a task' do
- let(:current_user) { developer }
-
- it 'removes the task from the work item' do
- expect do
- post_graphql_mutation(mutation, current_user: current_user)
- work_item.reload
- end.to change(WorkItem, :count).by(-1).and(
- change(IssueLink, :count).by(-1)
- ).and(
- change(work_item, :description).from("- [ ] #{task.to_reference}+").to("- [ ] #{task.title}")
- )
-
- expect(response).to have_gitlab_http_status(:success)
- expect(mutation_response['workItem']).to include('id' => work_item.to_global_id.to_s)
- end
-
- context 'when removing the task fails' do
- let(:lock_version) { 2 }
-
- it 'makes no changes to the DB and returns an error message' do
- expect do
- post_graphql_mutation(mutation, current_user: current_user)
- work_item.reload
- end.to not_change(WorkItem, :count).and(
- not_change(work_item, :description)
- )
-
- expect(mutation_response['errors']).to contain_exactly('Stale work item. Check lock version')
- end
- end
- end
-end
diff --git a/spec/requests/api/resource_access_tokens_spec.rb b/spec/requests/api/resource_access_tokens_spec.rb
index 01e02651a64..f0282b3a675 100644
--- a/spec/requests/api/resource_access_tokens_spec.rb
+++ b/spec/requests/api/resource_access_tokens_spec.rb
@@ -481,25 +481,75 @@ RSpec.describe API::ResourceAccessTokens, feature_category: :system_access do
let(:path) { "/#{source_type}s/#{resource_id}/access_tokens/#{token_id}/rotate" }
- before do
- resource.add_maintainer(project_bot)
- resource.add_owner(user)
+ subject(:rotate_token) { post(api(path, user), params: params) }
+
+ context 'when user is owner' do
+ before do
+ resource.add_maintainer(project_bot)
+ resource.add_owner(user)
+ end
+
+ it "allows owner to rotate token", :freeze_time do
+ rotate_token
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['token']).not_to eq(token.token)
+ expect(json_response['expires_at']).to eq((Date.today + 1.week).to_s)
+ end
end
- subject(:rotate_token) { post(api(path, user), params: params) }
+ context 'when user is maintainer' do
+ before do
+ resource.add_maintainer(user)
+ end
+
+ context "when token has owner access level" do
+ let(:error_message) { 'Not eligible to rotate token with access level higher than the user' }
- it "allows owner to rotate token", :freeze_time do
- rotate_token
+ before do
+ resource.add_owner(project_bot)
+ end
- expect(response).to have_gitlab_http_status(:ok)
- expect(json_response['token']).not_to eq(token.token)
- expect(json_response['expires_at']).to eq((Date.today + 1.week).to_s)
+ it "raises error" do
+ rotate_token
+
+ if source_type == 'project'
+ expect(response).to have_gitlab_http_status(:bad_request)
+ expect(json_response['message']).to eq("400 Bad request - #{error_message}")
+ else
+ expect(response).to have_gitlab_http_status(:unauthorized)
+ end
+ end
+ end
+
+ context 'when token has maintainer access level' do
+ before do
+ resource.add_maintainer(project_bot)
+ end
+
+ it "rotates token", :freeze_time do
+ rotate_token
+
+ if source_type == 'project'
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(json_response['token']).not_to eq(token.token)
+ expect(json_response['expires_at']).to eq((Date.today + 1.week).to_s)
+ else
+ expect(response).to have_gitlab_http_status(:unauthorized)
+ end
+ end
+ end
end
context 'when expiry is defined' do
let(:expiry_date) { Date.today + 1.month }
let(:params) { { expires_at: expiry_date } }
+ before do
+ resource.add_maintainer(project_bot)
+ resource.add_owner(user)
+ end
+
it "allows owner to rotate token", :freeze_time do
rotate_token
@@ -510,6 +560,11 @@ RSpec.describe API::ResourceAccessTokens, feature_category: :system_access do
end
context 'without permission' do
+ before do
+ resource.add_maintainer(project_bot)
+ resource.add_owner(user)
+ end
+
it 'returns an error message' do
another_user = create(:user)
resource.add_developer(another_user)
@@ -522,10 +577,21 @@ RSpec.describe API::ResourceAccessTokens, feature_category: :system_access do
context 'when service raises an error' do
let(:error_message) { 'boom!' }
+ let(:personal_token_service) { PersonalAccessTokens::RotateService }
+ let(:project_token_service) { ProjectAccessTokens::RotateService }
before do
- allow_next_instance_of(PersonalAccessTokens::RotateService) do |service|
- allow(service).to receive(:execute).and_return(ServiceResponse.error(message: error_message))
+ resource.add_maintainer(project_bot)
+ resource.add_owner(user)
+
+ if source_type == 'project'
+ allow_next_instance_of(project_token_service) do |service|
+ allow(service).to receive(:execute).and_return(ServiceResponse.error(message: error_message))
+ end
+ else
+ allow_next_instance_of(personal_token_service) do |service|
+ allow(service).to receive(:execute).and_return(ServiceResponse.error(message: error_message))
+ end
end
end
diff --git a/spec/requests/jwt_controller_spec.rb b/spec/requests/jwt_controller_spec.rb
index 966cc2d6d4e..956c0e06cda 100644
--- a/spec/requests/jwt_controller_spec.rb
+++ b/spec/requests/jwt_controller_spec.rb
@@ -92,7 +92,7 @@ RSpec.describe JwtController, feature_category: :system_access do
context 'project with enabled CI' do
subject! { get '/jwt/auth', params: parameters, headers: headers }
- it { expect(service_class).to have_received(:new).with(project, user, ActionController::Parameters.new(parameters.merge(auth_type: :build)).permit!) }
+ it { expect(service_class).to have_received(:new).with(project, user, ActionController::Parameters.new(parameters.merge(auth_type: :build, raw_token: build.token)).permit!) }
it_behaves_like 'user logging'
end
@@ -119,7 +119,7 @@ RSpec.describe JwtController, feature_category: :system_access do
.with(
nil,
nil,
- ActionController::Parameters.new(parameters.merge(deploy_token: deploy_token, auth_type: :deploy_token)).permit!
+ ActionController::Parameters.new(parameters.merge(deploy_token: deploy_token, auth_type: :deploy_token, raw_token: deploy_token.token)).permit!
)
end
@@ -144,7 +144,7 @@ RSpec.describe JwtController, feature_category: :system_access do
.with(
nil,
user,
- ActionController::Parameters.new(parameters.merge(auth_type: :personal_access_token)).permit!
+ ActionController::Parameters.new(parameters.merge(auth_type: :personal_access_token, raw_token: pat.token)).permit!
)
end
@@ -160,7 +160,7 @@ RSpec.describe JwtController, feature_category: :system_access do
subject! { get '/jwt/auth', params: parameters, headers: headers }
- it { expect(service_class).to have_received(:new).with(nil, user, ActionController::Parameters.new(parameters.merge(auth_type: :gitlab_or_ldap)).permit!) }
+ it { expect(service_class).to have_received(:new).with(nil, user, ActionController::Parameters.new(parameters.merge(auth_type: :gitlab_or_ldap, raw_token: user.password)).permit!) }
it_behaves_like 'rejecting a blocked user'
@@ -180,7 +180,7 @@ RSpec.describe JwtController, feature_category: :system_access do
ActionController::Parameters.new({ service: service_name, scopes: %w[scope1 scope2] }).permit!
end
- it { expect(service_class).to have_received(:new).with(nil, user, service_parameters.merge(auth_type: :gitlab_or_ldap)) }
+ it { expect(service_class).to have_received(:new).with(nil, user, service_parameters.merge(auth_type: :gitlab_or_ldap, raw_token: user.password)) }
it_behaves_like 'user logging'
end
@@ -197,7 +197,7 @@ RSpec.describe JwtController, feature_category: :system_access do
ActionController::Parameters.new({ service: service_name, scopes: %w[scope1 scope2] }).permit!
end
- it { expect(service_class).to have_received(:new).with(nil, user, service_parameters.merge(auth_type: :gitlab_or_ldap)) }
+ it { expect(service_class).to have_received(:new).with(nil, user, service_parameters.merge(auth_type: :gitlab_or_ldap, raw_token: user.password)) }
end
context 'when user has 2FA enabled' do
@@ -274,6 +274,8 @@ RSpec.describe JwtController, feature_category: :system_access do
let_it_be(:personal_access_token) { create(:personal_access_token, user: user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, :private, group: group) }
+ let_it_be(:bot_user) { create(:user, :project_bot) }
+ let_it_be(:group_access_token) { create(:personal_access_token, :dependency_proxy_scopes, user: bot_user) }
let_it_be(:group_deploy_token) { create(:deploy_token, :group, :dependency_proxy_scopes) }
let_it_be(:gdeploy_token) { create(:group_deploy_token, deploy_token: group_deploy_token, group: group) }
let_it_be(:project_deploy_token) { create(:deploy_token, :project, :dependency_proxy_scopes) }
@@ -313,6 +315,48 @@ RSpec.describe JwtController, feature_category: :system_access do
it_behaves_like 'with valid credentials'
end
+ context 'with group access token' do
+ let(:credential_user) { group_access_token.user.username }
+ let(:credential_password) { group_access_token.token }
+
+ context 'with the required scopes' do
+ it_behaves_like 'with valid credentials'
+ it_behaves_like 'a token that expires today'
+
+ context 'revoked' do
+ before do
+ group_access_token.update!(revoked: true)
+ end
+
+ it_behaves_like 'returning response status', :unauthorized
+ end
+
+ context 'expired' do
+ before do
+ group_access_token.update!(expires_at: Date.yesterday)
+ end
+
+ it_behaves_like 'returning response status', :unauthorized
+ end
+ end
+
+ context 'without the required scopes' do
+ before do
+ group_access_token.update!(scopes: [::Gitlab::Auth::READ_REPOSITORY_SCOPE])
+ end
+
+ it_behaves_like 'returning response status', :forbidden
+
+ context 'packages_dependency_proxy_containers_scope_check disabled' do
+ before do
+ stub_feature_flags(packages_dependency_proxy_containers_scope_check: false)
+ end
+
+ it_behaves_like 'with valid credentials'
+ end
+ end
+ end
+
context 'with group deploy token' do
let(:credential_user) { group_deploy_token.username }
let(:credential_password) { group_deploy_token.token }
diff --git a/spec/services/auth/dependency_proxy_authentication_service_spec.rb b/spec/services/auth/dependency_proxy_authentication_service_spec.rb
index c2de3cc7ae0..e81f59cff39 100644
--- a/spec/services/auth/dependency_proxy_authentication_service_spec.rb
+++ b/spec/services/auth/dependency_proxy_authentication_service_spec.rb
@@ -6,6 +6,7 @@ RSpec.describe Auth::DependencyProxyAuthenticationService, feature_category: :de
let_it_be(:user) { create(:user) }
let_it_be(:params) { {} }
+ let(:authentication_abilities) { nil }
let(:service) { described_class.new(nil, user, params) }
before do
@@ -13,7 +14,7 @@ RSpec.describe Auth::DependencyProxyAuthenticationService, feature_category: :de
end
describe '#execute' do
- subject { service.execute(authentication_abilities: nil) }
+ subject { service.execute(authentication_abilities: authentication_abilities) }
shared_examples 'returning' do |status:, message:|
it "returns #{message}", :aggregate_failures do
@@ -69,6 +70,48 @@ RSpec.describe Auth::DependencyProxyAuthenticationService, feature_category: :de
end
end
+ context 'with a group access token' do
+ let_it_be(:user) { create(:user, :project_bot) }
+ let_it_be_with_reload(:token) { create(:personal_access_token, user: user) }
+
+ context 'with insufficient authentication abilities' do
+ it_behaves_like 'returning', status: 403, message: 'access forbidden'
+
+ context 'packages_dependency_proxy_containers_scope_check disabled' do
+ before do
+ stub_feature_flags(packages_dependency_proxy_containers_scope_check: false)
+ end
+
+ it_behaves_like 'returning a token with an encoded field', 'user_id'
+ end
+ end
+
+ context 'with sufficient authentication abilities' do
+ let_it_be(:authentication_abilities) { Auth::DependencyProxyAuthenticationService::REQUIRED_ABILITIES }
+ let_it_be(:params) { { raw_token: token.token } }
+
+ subject { service.execute(authentication_abilities: authentication_abilities) }
+
+ it_behaves_like 'returning a token with an encoded field', 'user_id'
+
+ context 'revoked' do
+ before do
+ token.revoke!
+ end
+
+ it_behaves_like 'returning', status: 403, message: 'access forbidden'
+ end
+
+ context 'expired' do
+ before do
+ token.update_column(:expires_at, 1.day.ago)
+ end
+
+ it_behaves_like 'returning', status: 403, message: 'access forbidden'
+ end
+ end
+ end
+
def decode(token)
DependencyProxy::AuthTokenService.new(token).execute
end
diff --git a/spec/services/ci/pipeline_schedules/variables_create_service_spec.rb b/spec/services/ci/pipeline_schedules/variables_create_service_spec.rb
new file mode 100644
index 00000000000..4f99de093d4
--- /dev/null
+++ b/spec/services/ci/pipeline_schedules/variables_create_service_spec.rb
@@ -0,0 +1,108 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Ci::PipelineSchedules::VariablesCreateService, feature_category: :continuous_integration do
+ let_it_be(:reporter) { create(:user) }
+ let_it_be_with_reload(:user) { create(:user) }
+ let_it_be_with_reload(:developer) { create(:user) }
+ let_it_be_with_reload(:project) { create(:project, :public, :repository) }
+ let_it_be_with_reload(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: user) }
+
+ subject(:service) { described_class.new(pipeline_schedule, user, params) }
+
+ before_all do
+ project.add_maintainer(user)
+ project.add_developer(developer)
+ project.add_reporter(reporter)
+ end
+
+ describe 'execute' do
+ context 'when user does not have permission' do
+ subject(:service) { described_class.new(pipeline_schedule, reporter, {}) }
+
+ it 'returns ServiceResponse.error' do
+ result = service.execute
+
+ expect(result).to be_a(ServiceResponse)
+ expect(result.error?).to be(true)
+
+ error_message = _('The current user is not authorized to create the pipeline schedule variables')
+ expect(result.message).to match_array([error_message])
+ expect(result.payload.errors).to match_array([error_message])
+ end
+ end
+
+ context 'when user limited with permission on a project' do
+ let(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: developer) }
+
+ subject(:service) { described_class.new(pipeline_schedule, developer, {}) }
+
+ before do
+ project.update!(restrict_user_defined_variables: true)
+ end
+
+ it 'returns ServiceResponse.error' do
+ result = service.execute
+
+ expect(result).to be_a(ServiceResponse)
+ expect(result.error?).to be(true)
+
+ error_message = _('The current user is not authorized to set pipeline schedule variables')
+ expect(result.message).to match_array([error_message])
+ expect(result.payload.errors).to match_array([error_message])
+ end
+ end
+
+ context 'when user has permissions' do
+ let(:params) do
+ {
+ key: 'variable1',
+ value: 'value1',
+ variable_type: 'file'
+ }
+ end
+
+ subject(:service) { described_class.new(pipeline_schedule, user, params) }
+
+ it 'saves variable with passed params' do
+ result = service.execute
+
+ expect(result.payload).to have_attributes(
+ key: 'variable1',
+ value: 'value1',
+ variable_type: 'file'
+ )
+ end
+
+ it 'returns ServiceResponse.success' do
+ result = service.execute
+
+ expect(result).to be_a(ServiceResponse)
+ expect(result.success?).to be(true)
+ end
+ end
+
+ context 'when schedule save fails' do
+ subject(:service) { described_class.new(pipeline_schedule, user, {}) }
+
+ before do
+ errors = ActiveModel::Errors.new(project)
+ errors.add(:base, 'An error occurred')
+
+ allow_next_instance_of(Ci::PipelineScheduleVariable) do |instance|
+ allow(instance).to receive(:save).and_return(false)
+ allow(instance).to receive(:errors).and_return(errors)
+ end
+ end
+
+ it 'returns ServiceResponse.error' do
+ result = service.execute
+
+ expect(result).to be_a(ServiceResponse)
+ expect(result.error?).to be(true)
+ expect(result.message).to match_array(['An error occurred'])
+ end
+ end
+ end
+end
diff --git a/spec/services/ci/pipeline_schedules/variables_update_service_spec.rb b/spec/services/ci/pipeline_schedules/variables_update_service_spec.rb
new file mode 100644
index 00000000000..b2e1c2c9df7
--- /dev/null
+++ b/spec/services/ci/pipeline_schedules/variables_update_service_spec.rb
@@ -0,0 +1,107 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Ci::PipelineSchedules::VariablesUpdateService, feature_category: :continuous_integration do
+ let_it_be(:reporter) { create(:user) }
+ let_it_be_with_reload(:user) { create(:user) }
+ let_it_be_with_reload(:developer) { create(:user) }
+ let_it_be_with_reload(:project) { create(:project, :public, :repository) }
+ let(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: user) }
+ let(:pipeline_schedule_variable) { create(:ci_pipeline_schedule_variable, pipeline_schedule: pipeline_schedule) }
+
+ subject(:service) { described_class.new(pipeline_schedule_variable, user, params) }
+
+ before_all do
+ project.add_maintainer(user)
+ project.add_developer(developer)
+ project.add_reporter(reporter)
+ end
+
+ describe 'execute' do
+ context 'when user does not have permission' do
+ subject(:service) { described_class.new(pipeline_schedule_variable, reporter, {}) }
+
+ it 'returns ServiceResponse.error' do
+ result = service.execute
+
+ expect(result).to be_a(ServiceResponse)
+ expect(result.error?).to be(true)
+
+ error_message = _('The current user is not authorized to update the pipeline schedule variables')
+ expect(result.message).to match_array([error_message])
+ expect(result.payload.errors).to match_array([error_message])
+ end
+ end
+
+ context 'when user limited with permission on a project' do
+ let(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: developer) }
+
+ subject(:service) { described_class.new(pipeline_schedule_variable, developer, {}) }
+
+ before do
+ project.update!(restrict_user_defined_variables: true)
+ end
+
+ it 'returns ServiceResponse.error' do
+ result = service.execute
+
+ expect(result).to be_a(ServiceResponse)
+ expect(result.error?).to be(true)
+
+ error_message = _('The current user is not authorized to set pipeline schedule variables')
+ expect(result.message).to match_array([error_message])
+ expect(result.payload.errors).to match_array([error_message])
+ end
+ end
+
+ context 'when user has permissions' do
+ let(:params) do
+ {
+ key: 'variable1',
+ value: 'value1',
+ variable_type: 'file'
+ }
+ end
+
+ subject(:service) { described_class.new(pipeline_schedule_variable, user, params) }
+
+ it 'saves variable with passed params' do
+ result = service.execute
+
+ expect(result.payload).to have_attributes(
+ key: 'variable1',
+ value: 'value1',
+ variable_type: 'file'
+ )
+ end
+
+ it 'returns ServiceResponse.success' do
+ result = service.execute
+
+ expect(result).to be_a(ServiceResponse)
+ expect(result.success?).to be(true)
+ end
+ end
+
+ context 'when schedule save fails' do
+ subject(:service) { described_class.new(pipeline_schedule_variable, user, {}) }
+
+ before do
+ allow(pipeline_schedule_variable).to receive(:save).and_return(false)
+
+ errors = ActiveModel::Errors.new(project)
+ errors.add(:base, 'An error occurred')
+ allow(pipeline_schedule_variable).to receive(:errors).and_return(errors)
+ end
+
+ it 'returns ServiceResponse.error' do
+ result = service.execute
+
+ expect(result).to be_a(ServiceResponse)
+ expect(result.error?).to be(true)
+ expect(result.message).to match_array(['An error occurred'])
+ end
+ end
+ end
+end
diff --git a/spec/services/personal_access_tokens/rotate_service_spec.rb b/spec/services/personal_access_tokens/rotate_service_spec.rb
index fa428e4c7f0..a114f2cd909 100644
--- a/spec/services/personal_access_tokens/rotate_service_spec.rb
+++ b/spec/services/personal_access_tokens/rotate_service_spec.rb
@@ -8,16 +8,20 @@ RSpec.describe PersonalAccessTokens::RotateService, feature_category: :system_ac
subject(:response) { described_class.new(token.user, token).execute }
- it "rotates user's own token", :freeze_time do
- expect(response).to be_success
+ shared_examples_for 'rotates token succesfully' do
+ it "rotates user's own token", :freeze_time do
+ expect(response).to be_success
- new_token = response.payload[:personal_access_token]
+ new_token = response.payload[:personal_access_token]
- expect(new_token.token).not_to eq(token.token)
- expect(new_token.expires_at).to eq(Date.today + 1.week)
- expect(new_token.user).to eq(token.user)
+ expect(new_token.token).not_to eq(token.token)
+ expect(new_token.expires_at).to eq(Date.today + 1.week)
+ expect(new_token.user).to eq(token.user)
+ end
end
+ it_behaves_like "rotates token succesfully"
+
it 'revokes the previous token' do
expect { response }.to change { token.reload.revoked? }.from(false).to(true)
@@ -32,34 +36,6 @@ RSpec.describe PersonalAccessTokens::RotateService, feature_category: :system_ac
expect(new_token.previous_personal_access_token).to eql(token)
end
- context 'when token user has a membership' do
- context 'when its not a bot user' do
- let_it_be(:user_membership) do
- create(:project_member, :developer, user: token.user, project: create(:project))
- end
-
- it 'does not update membership expires at' do
- expect { response }.not_to change { user_membership.reload.expires_at }
- end
- end
-
- context 'when its a bot user' do
- let_it_be(:bot_user) { create(:user, :project_bot) }
- let_it_be(:bot_user_membership) do
- create(:project_member, :developer, user: bot_user, project: create(:project))
- end
-
- let_it_be(:token, reload: true) { create(:personal_access_token, user: bot_user) }
-
- it 'updates membership expires at' do
- response
-
- new_token = response.payload[:personal_access_token]
- expect(bot_user_membership.reload.expires_at).to eq(new_token.expires_at)
- end
- end
- end
-
context 'when user tries to rotate already revoked token' do
let_it_be(:token, reload: true) { create(:personal_access_token, :revoked) }
diff --git a/spec/services/project_access_tokens/rotate_service_spec.rb b/spec/services/project_access_tokens/rotate_service_spec.rb
new file mode 100644
index 00000000000..10e29be4979
--- /dev/null
+++ b/spec/services/project_access_tokens/rotate_service_spec.rb
@@ -0,0 +1,189 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+RSpec.describe ProjectAccessTokens::RotateService, feature_category: :system_access do
+ describe '#execute' do
+ let_it_be(:token, reload: true) { create(:personal_access_token) }
+ let(:current_user) { create(:user) }
+ let(:project) { create(:project, group: create(:group)) }
+ let(:error_message) { 'Not eligible to rotate token with access level higher than the user' }
+
+ subject(:response) { described_class.new(current_user, token, project).execute }
+
+ shared_examples_for 'rotates token succesfully' do
+ it "rotates user's own token", :freeze_time do
+ expect(response).to be_success
+
+ new_token = response.payload[:personal_access_token]
+
+ expect(new_token.token).not_to eq(token.token)
+ expect(new_token.expires_at).to eq(Date.today + 1.week)
+ expect(new_token.user).to eq(token.user)
+ end
+ end
+
+ context 'when user tries to rotate token with different access level' do
+ before do
+ project.add_guest(token.user)
+ end
+
+ context 'when current user is an owner' do
+ before do
+ project.add_owner(current_user)
+ end
+
+ it_behaves_like "rotates token succesfully"
+
+ context 'when creating the new token fails' do
+ let(:error_message) { 'boom!' }
+
+ before do
+ allow_next_instance_of(PersonalAccessToken) do |token|
+ allow(token).to receive_message_chain(:errors, :full_messages, :to_sentence).and_return(error_message)
+ allow(token).to receive_message_chain(:errors, :clear)
+ allow(token).to receive_message_chain(:errors, :empty?).and_return(false)
+ end
+ end
+
+ it 'returns an error' do
+ expect(response).to be_error
+ expect(response.message).to eq(error_message)
+ end
+
+ it 'reverts the changes' do
+ expect { response }.not_to change { token.reload.revoked? }.from(false)
+ end
+ end
+ end
+
+ context 'when current user is not an owner' do
+ context 'when current user is maintainer' do
+ before do
+ project.add_maintainer(current_user)
+ end
+
+ context 'when access level is not owner' do
+ it_behaves_like "rotates token succesfully"
+ end
+
+ context 'when access level is owner' do
+ before do
+ project.add_owner(token.user)
+ end
+
+ it "does not rotate token with higher priviledge" do
+ response
+
+ expect(response).to be_error
+ expect(response.message).to eq(error_message)
+ end
+ end
+ end
+
+ context 'when current user is not maintainer' do
+ before do
+ project.add_developer(current_user)
+ end
+
+ it 'does not rotate the token' do
+ response
+
+ expect(response).to be_error
+ expect(response.message).to eq(error_message)
+ end
+ end
+ end
+
+ context 'when current user is admin' do
+ let(:current_user) { create(:admin) }
+
+ context 'when admin mode enabled', :enable_admin_mode do
+ it_behaves_like "rotates token succesfully"
+ end
+
+ context 'when admin mode not enabled' do
+ it 'does not rotate the token' do
+ response
+
+ expect(response).to be_error
+ expect(response.message).to eq(error_message)
+ end
+ end
+ end
+
+ context 'when nested membership' do
+ let_it_be(:project_bot) { create(:user, :project_bot) }
+ let(:token) { create(:personal_access_token, user: project_bot) }
+ let(:top_level_group) { create(:group) }
+ let(:sub_group) { create(:group, parent: top_level_group) }
+ let(:project) { create(:project, group: sub_group) }
+
+ before do
+ project.add_maintainer(project_bot)
+ end
+
+ context 'when current user is an owner' do
+ before do
+ project.add_owner(current_user)
+ end
+
+ it_behaves_like "rotates token succesfully"
+
+ context 'when its a bot user' do
+ let_it_be(:bot_user) { create(:user, :project_bot) }
+ let_it_be(:bot_user_membership) do
+ create(:project_member, :developer, user: bot_user, project: create(:project))
+ end
+
+ let_it_be(:token, reload: true) { create(:personal_access_token, user: bot_user) }
+
+ it 'updates membership expires at' do
+ response
+
+ new_token = response.payload[:personal_access_token]
+ expect(bot_user_membership.reload.expires_at).to eq(new_token.expires_at)
+ end
+ end
+ end
+
+ context 'when current user is not an owner' do
+ context 'when current user is maintainer' do
+ before do
+ project.add_maintainer(current_user)
+ end
+
+ context 'when access level is not owner' do
+ it_behaves_like "rotates token succesfully"
+ end
+
+ context 'when access level is owner' do
+ before do
+ project.add_owner(token.user)
+ end
+
+ it "does not rotate token with higher priviledge" do
+ response
+
+ expect(response).to be_error
+ expect(response.message).to eq(error_message)
+ end
+ end
+ end
+
+ context 'when current user is not maintainer' do
+ before do
+ project.add_developer(current_user)
+ end
+
+ it 'does not rotate the token' do
+ response
+
+ expect(response).to be_error
+ expect(response.message).to eq(error_message)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/spec/services/system_notes/time_tracking_service_spec.rb b/spec/services/system_notes/time_tracking_service_spec.rb
index 3242ae9e533..cf994220946 100644
--- a/spec/services/system_notes/time_tracking_service_spec.rb
+++ b/spec/services/system_notes/time_tracking_service_spec.rb
@@ -272,7 +272,11 @@ RSpec.describe ::SystemNotes::TimeTrackingService, feature_category: :team_plann
context 'when the timelog has a negative time spent value' do
let_it_be(:noteable, reload: true) { create(:issue, project: project) }
- let(:timelog) { create(:timelog, user: author, issue: noteable, time_spent: -1800, spent_at: '2022-03-30T00:00:00.000Z') }
+ let!(:existing_timelog) { create(:timelog, user: author, issue: noteable, time_spent: time_spent.to_i) }
+
+ let(:time_spent) { 1800.seconds }
+ let(:spent_at) { '2022-03-30T00:00:00.000Z' }
+ let(:timelog) { create(:timelog, user: author, issue: noteable, time_spent: -time_spent.to_i, spent_at: spent_at) }
it 'sets the note text' do
expect(subject.note).to eq "subtracted 30m of time spent at 2022-03-30"
@@ -296,7 +300,11 @@ RSpec.describe ::SystemNotes::TimeTrackingService, feature_category: :team_plann
context 'when the timelog has a negative time spent value' do
let_it_be(:noteable, reload: true) { create(:issue, project: project) }
- let(:timelog) { create(:timelog, user: author, issue: noteable, time_spent: -1800, spent_at: '2022-03-30T00:00:00.000Z') }
+ let!(:existing_timelog) { create(:timelog, user: author, issue: noteable, time_spent: time_spent.to_i) }
+
+ let(:time_spent) { 1800.seconds }
+ let(:spent_at) { '2022-03-30T00:00:00.000Z' }
+ let(:timelog) { create(:timelog, user: author, issue: noteable, time_spent: -time_spent.to_i, spent_at: spent_at) }
it 'sets the note text' do
expect(subject.note).to eq "deleted -30m of spent time from 2022-03-30"
diff --git a/spec/services/work_items/delete_task_service_spec.rb b/spec/services/work_items/delete_task_service_spec.rb
deleted file mode 100644
index dc01da65771..00000000000
--- a/spec/services/work_items/delete_task_service_spec.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe WorkItems::DeleteTaskService, feature_category: :team_planning do
- let_it_be(:project) { create(:project) }
- let_it_be(:developer) { create(:user).tap { |u| project.add_developer(u) } }
- let_it_be_with_refind(:task) { create(:work_item, project: project, author: developer) }
- let_it_be_with_refind(:list_work_item) do
- create(:work_item, project: project, description: "- [ ] #{task.to_reference}+")
- end
-
- let(:current_user) { developer }
- let(:line_number_start) { 1 }
- let(:params) do
- {
- line_number_start: line_number_start,
- line_number_end: 1,
- task: task
- }
- end
-
- before_all do
- create(:issue_link, source_id: list_work_item.id, target_id: task.id)
- end
-
- shared_examples 'failing WorkItems::DeleteTaskService' do |error_message|
- it { is_expected.to be_error }
-
- it 'does not remove work item or issue links' do
- expect do
- service_result
- list_work_item.reload
- end.to not_change(WorkItem, :count).and(
- not_change(IssueLink, :count)
- ).and(
- not_change(list_work_item, :description)
- )
- end
-
- it 'returns an error message' do
- expect(service_result.errors).to contain_exactly(error_message)
- end
- end
-
- describe '#execute' do
- subject(:service_result) do
- described_class.new(
- work_item: list_work_item,
- current_user: current_user,
- lock_version: list_work_item.lock_version,
- task_params: params
- ).execute
- end
-
- context 'when work item params are valid' do
- it { is_expected.to be_success }
-
- it 'deletes the work item and the related issue link' do
- expect do
- service_result
- end.to change(WorkItem, :count).by(-1).and(
- change(IssueLink, :count).by(-1)
- )
- end
-
- it 'removes the task list item with the work item reference' do
- expect do
- service_result
- end.to change(list_work_item, :description).from(list_work_item.description).to("- [ ] #{task.title}")
- end
- end
-
- context 'when first operation fails' do
- let(:line_number_start) { -1 }
-
- it_behaves_like 'failing WorkItems::DeleteTaskService', 'line_number_start must be greater than 0'
- end
-
- context 'when last operation fails' do
- let_it_be(:non_member_user) { create(:user) }
-
- let(:current_user) { non_member_user }
-
- it_behaves_like 'failing WorkItems::DeleteTaskService', 'User not authorized to delete work item'
- end
- end
-end
diff --git a/spec/services/work_items/task_list_reference_removal_service_spec.rb b/spec/services/work_items/task_list_reference_removal_service_spec.rb
deleted file mode 100644
index 0d34aaa3c1c..00000000000
--- a/spec/services/work_items/task_list_reference_removal_service_spec.rb
+++ /dev/null
@@ -1,152 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe WorkItems::TaskListReferenceRemovalService, feature_category: :team_planning do
- let_it_be(:developer) { create(:user) }
- let_it_be(:project) { create(:project, :repository).tap { |project| project.add_developer(developer) } }
- let_it_be(:task) { create(:work_item, project: project, title: 'Task title') }
- let_it_be(:single_line_work_item, refind: true) do
- create(:work_item, project: project, description: "- [ ] #{task.to_reference}+ single line")
- end
-
- let_it_be(:multiple_line_work_item, refind: true) do
- create(
- :work_item,
- project: project,
- description: <<~MARKDOWN
- Any text
-
- * [ ] Item to be converted
- #{task.to_reference}+ second line
- third line
- * [x] task
-
- More text
- MARKDOWN
- )
- end
-
- let(:line_number_start) { 3 }
- let(:line_number_end) { 5 }
- let(:work_item) { multiple_line_work_item }
- let(:lock_version) { work_item.lock_version }
-
- shared_examples 'successful work item task reference removal service' do |expected_description|
- it { is_expected.to be_success }
-
- it 'removes the task list item containing the task reference' do
- expect do
- result
- end.to change(work_item, :description).from(work_item.description).to(expected_description)
- end
-
- it 'creates system notes' do
- expect do
- result
- end.to change(Note, :count).by(1)
-
- expect(Note.last.note).to include('changed the description')
- end
- end
-
- shared_examples 'failing work item task reference removal service' do |error_message|
- it { is_expected.to be_error }
-
- it 'does not change the work item description' do
- expect do
- result
- work_item.reload
- end.to not_change(work_item, :description)
- end
-
- it 'returns an error message' do
- expect(result.errors).to contain_exactly(error_message)
- end
- end
-
- describe '#execute' do
- subject(:result) do
- described_class.new(
- work_item: work_item,
- task: task,
- line_number_start: line_number_start,
- line_number_end: line_number_end,
- lock_version: lock_version,
- current_user: developer
- ).execute
- end
-
- context 'when task mardown spans a single line' do
- let(:line_number_start) { 1 }
- let(:line_number_end) { 1 }
- let(:work_item) { single_line_work_item }
-
- it_behaves_like 'successful work item task reference removal service', '- [ ] Task title single line'
-
- context 'when description does not contain a task' do
- let_it_be(:no_matching_work_item) { create(:work_item, project: project, description: 'no matching task') }
-
- let(:work_item) { no_matching_work_item }
-
- it_behaves_like 'failing work item task reference removal service', 'Unable to detect a task on lines 1-1'
- end
-
- context 'when description reference does not exactly match the task reference' do
- before do
- work_item.update!(description: work_item.description.gsub(task.to_reference, "#{task.to_reference}200"))
- end
-
- it_behaves_like 'failing work item task reference removal service', 'Unable to detect a task on lines 1-1'
- end
- end
-
- context 'when task mardown spans multiple lines' do
- it_behaves_like 'successful work item task reference removal service',
- "Any text\n\n* [ ] Item to be converted\n Task title second line\n third line\n* [x] task\n\nMore text"
- end
-
- context 'when updating the work item fails' do
- before do
- work_item.title = nil
- end
-
- it_behaves_like 'failing work item task reference removal service', "Title can't be blank"
- end
-
- context 'when description is empty' do
- let_it_be(:empty_work_item) { create(:work_item, project: project, description: '') }
-
- let(:work_item) { empty_work_item }
-
- it_behaves_like 'failing work item task reference removal service', "Work item description can't be blank"
- end
-
- context 'when line_number_start is lower than 1' do
- let(:line_number_start) { 0 }
-
- it_behaves_like 'failing work item task reference removal service', 'line_number_start must be greater than 0'
- end
-
- context 'when line_number_end is lower than line_number_start' do
- let(:line_number_end) { line_number_start - 1 }
-
- it_behaves_like 'failing work item task reference removal service',
- 'line_number_end must be greater or equal to line_number_start'
- end
-
- context 'when lock_version is older than current' do
- let(:lock_version) { work_item.lock_version - 1 }
-
- it_behaves_like 'failing work item task reference removal service', 'Stale work item. Check lock version'
- end
-
- context 'when work item is stale before updating' do
- it_behaves_like 'failing work item task reference removal service', 'Stale work item. Check lock version' do
- before do
- ::WorkItem.where(id: work_item.id).update_all(lock_version: lock_version + 1)
- end
- end
- end
- end
-end
diff --git a/spec/support/rspec_order_todo.yml b/spec/support/rspec_order_todo.yml
index d772a051ac8..28e5d4f3a90 100644
--- a/spec/support/rspec_order_todo.yml
+++ b/spec/support/rspec_order_todo.yml
@@ -7942,7 +7942,6 @@
- './spec/requests/api/graphql/mutations/work_items/create_from_task_spec.rb'
- './spec/requests/api/graphql/mutations/work_items/create_spec.rb'
- './spec/requests/api/graphql/mutations/work_items/delete_spec.rb'
-- './spec/requests/api/graphql/mutations/work_items/delete_task_spec.rb'
- './spec/requests/api/graphql/mutations/work_items/update_spec.rb'
- './spec/requests/api/graphql/mutations/work_items/update_task_spec.rb'
- './spec/requests/api/graphql/namespace/package_settings_spec.rb'
@@ -9161,10 +9160,8 @@
- './spec/services/work_items/create_from_task_service_spec.rb'
- './spec/services/work_items/create_service_spec.rb'
- './spec/services/work_items/delete_service_spec.rb'
-- './spec/services/work_items/delete_task_service_spec.rb'
- './spec/services/work_items/parent_links/create_service_spec.rb'
- './spec/services/work_items/parent_links/destroy_service_spec.rb'
-- './spec/services/work_items/task_list_reference_removal_service_spec.rb'
- './spec/services/work_items/task_list_reference_replacement_service_spec.rb'
- './spec/services/work_items/update_service_spec.rb'
- './spec/services/work_items/widgets/assignees_service/update_service_spec.rb'
diff --git a/spec/support/shared_examples/models/trackable_shared_examples.rb b/spec/support/shared_examples/models/trackable_shared_examples.rb
new file mode 100644
index 00000000000..649a8eb2d6c
--- /dev/null
+++ b/spec/support/shared_examples/models/trackable_shared_examples.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+RSpec.shared_examples 'a time trackable' do
+ describe '#total_time_spent' do
+ context 'when total time spent exceeds the allowed limit' do
+ let(:time_spent) { Timelog::MAX_TOTAL_TIME_SPENT + 1.second }
+
+ it 'returns the maximum allowed total time spent' do
+ timelog.update_column(:time_spent, time_spent.to_i)
+
+ expect(trackable.total_time_spent).to eq(Timelog::MAX_TOTAL_TIME_SPENT)
+ end
+
+ context 'when total time spent is below 0' do
+ let(:time_spent) { -Timelog::MAX_TOTAL_TIME_SPENT - 1.second }
+
+ it 'returns the minimum allowed total time spent' do
+ timelog.update_column(:time_spent, time_spent.to_i)
+
+ expect(trackable.total_time_spent).to eq(-Timelog::MAX_TOTAL_TIME_SPENT)
+ end
+ end
+ end
+ end
+end
diff --git a/spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb b/spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb
index dec15cb68b3..eddda969ba2 100644
--- a/spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb
+++ b/spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb
@@ -169,6 +169,8 @@ RSpec.shared_examples 'time tracking endpoints' do |issuable_name|
end
it "resets spent time for #{issuable_name}" do
+ issuable.update!(spend_time: { duration: 60, user_id: user.id })
+
travel_to(2.minutes.from_now) do
expect do
post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/reset_spent_time", user)