From 6f998d352988f93f875db862353e814e95db1fe3 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 2 Aug 2021 15:08:56 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- GITALY_SERVER_VERSION | 2 +- Gemfile | 2 + Gemfile.lock | 2 + .../components/invite_members_modal.vue | 61 +- app/assets/javascripts/invite_members/constants.js | 5 + .../invite_members/init_invite_members_modal.js | 2 + .../merge_request_artifact_download.vue | 2 +- .../fragments/job_artifacts.fragment.graphql | 13 + ...port_merge_request_download_paths.query.graphql | 24 + ...ty_report_pipeline_download_paths.query.graphql | 10 + ...port_merge_request_download_paths.query.graphql | 24 - ...ty_report_pipeline_download_paths.query.graphql | 18 - .../security_reports/security_reports_app.vue | 2 +- app/controllers/admin/users_controller.rb | 4 +- app/controllers/projects_controller.rb | 1 + app/helpers/invite_members_helper.rb | 39 + app/helpers/projects_helper.rb | 53 +- .../concerns/vulnerability_finding_helpers.rb | 33 +- .../vulnerability_finding_signature_helpers.rb | 28 +- app/models/user.rb | 10 +- app/models/users/banned_user.rb | 12 + app/services/security/merge_reports_service.rb | 70 ++ app/services/users/ban_service.rb | 22 +- app/services/users/banned_user_base_service.rb | 37 + app/services/users/unban_service.rb | 15 + app/views/groups/_invite_members_modal.html.haml | 7 +- app/views/projects/_invite_members_modal.html.haml | 7 +- app/views/projects/blob/_editor.html.haml | 2 +- app/views/projects/branches/_branch.html.haml | 2 +- app/views/projects/edit.html.haml | 2 +- .../merge_requests/_merge_request.html.haml | 2 +- .../experiment/member_areas_of_focus.yml | 8 + config/initializers/0_log_deprecations.rb | 22 + db/migrate/20210713211008_create_banned_users.rb | 20 + db/schema_migrations/20210713211008 | 1 + db/structure.sql | 12 + doc/administration/integration/kroki.md | 4 +- doc/administration/integration/terminal.md | 4 +- doc/api/api_resources.md | 4 +- doc/api/custom_attributes.md | 4 +- doc/api/graphql/audit_report.md | 4 +- doc/api/graphql/getting_started.md | 4 +- doc/api/graphql/index.md | 4 +- doc/api/graphql/users_example.md | 4 +- doc/api/index.md | 4 +- doc/api/openapi/openapi_interactive.md | 4 +- doc/api/services.md | 4 +- doc/api/system_hooks.md | 4 +- doc/api/v3_to_v4.md | 4 +- doc/api/version.md | 4 +- .../consolidating_groups_and_projects/index.md | 155 ++++ doc/development/integrations/jenkins.md | 4 +- doc/development/integrations/jira_connect.md | 4 +- doc/development/service_ping/metrics_dictionary.md | 2 +- doc/integration/akismet.md | 4 +- doc/integration/auth0.md | 4 +- doc/integration/azure.md | 4 +- doc/integration/bitbucket.md | 4 +- doc/integration/cas.md | 4 +- doc/integration/datadog.md | 4 +- doc/integration/external-issue-tracker.md | 4 +- doc/integration/facebook.md | 4 +- doc/integration/github.md | 4 +- doc/integration/gitlab.md | 4 +- doc/integration/gmail_action_buttons_for_gitlab.md | 4 +- doc/integration/google.md | 4 +- doc/integration/index.md | 4 +- doc/integration/jenkins.md | 4 +- doc/integration/jenkins_deprecated.md | 4 +- doc/integration/jira/configure.md | 4 +- doc/integration/jira/connect-app.md | 4 +- doc/integration/jira/development_panel.md | 4 +- doc/integration/jira/dvcs.md | 4 +- doc/integration/jira/index.md | 4 +- doc/integration/jira/issues.md | 4 +- doc/integration/jira/jira_cloud_configuration.md | 4 +- doc/integration/jira/jira_server_configuration.md | 4 +- doc/integration/oauth2_generic.md | 4 +- doc/integration/omniauth.md | 4 +- doc/integration/openid_connect_provider.md | 4 +- doc/integration/recaptcha.md | 4 +- doc/integration/salesforce.md | 4 +- doc/integration/slash_commands.md | 4 +- doc/integration/trello_power_up.md | 4 +- doc/integration/twitter.md | 4 +- .../settings/project_integration_management.md | 4 +- doc/user/project/integrations/asana.md | 4 +- doc/user/project/integrations/bamboo.md | 4 +- doc/user/project/integrations/bugzilla.md | 4 +- .../project/integrations/custom_issue_tracker.md | 4 +- .../project/integrations/discord_notifications.md | 4 +- doc/user/project/integrations/emails_on_push.md | 4 +- doc/user/project/integrations/ewm.md | 4 +- doc/user/project/integrations/github.md | 4 +- .../integrations/gitlab_slack_application.md | 4 +- doc/user/project/integrations/hangouts_chat.md | 4 +- doc/user/project/integrations/index.md | 4 +- doc/user/project/integrations/irker.md | 4 +- doc/user/project/integrations/mattermost.md | 4 +- .../integrations/mattermost_slash_commands.md | 4 +- doc/user/project/integrations/microsoft_teams.md | 4 +- doc/user/project/integrations/mock_ci.md | 4 +- doc/user/project/integrations/overview.md | 4 +- doc/user/project/integrations/pivotal_tracker.md | 4 +- doc/user/project/integrations/redmine.md | 4 +- doc/user/project/integrations/servicenow.md | 4 +- doc/user/project/integrations/slack.md | 4 +- .../project/integrations/slack_slash_commands.md | 4 +- doc/user/project/integrations/unify_circuit.md | 4 +- doc/user/project/integrations/webex_teams.md | 4 +- doc/user/project/integrations/webhooks.md | 4 +- doc/user/project/integrations/youtrack.md | 4 +- lib/gitlab/ci/parsers.rb | 4 +- lib/gitlab/ci/parsers/security/common.rb | 266 ++++++ .../parsers/security/concerns/deprecated_syntax.rb | 36 + lib/gitlab/ci/parsers/security/sast.rb | 26 + lib/gitlab/ci/parsers/security/secret_detection.rb | 27 + .../security/validators/schema_validator.rb | 68 ++ .../parsers/security/validators/schemas/sast.json | 706 +++++++++++++++ .../validators/schemas/secret_detection.json | 729 ++++++++++++++++ .../ci/reports/security/aggregated_report.rb | 24 + lib/gitlab/ci/reports/security/finding.rb | 151 ++++ lib/gitlab/ci/reports/security/finding_key.rb | 36 + .../ci/reports/security/finding_signature.rb | 46 + lib/gitlab/ci/reports/security/locations/base.rb | 41 + lib/gitlab/ci/reports/security/locations/sast.rb | 33 + .../reports/security/locations/secret_detection.rb | 33 + lib/gitlab/ci/reports/security/report.rb | 76 ++ lib/gitlab/ci/reports/security/reports.rb | 42 + lib/gitlab/deprecation_json_logger.rb | 9 + locale/gitlab.pot | 24 + spec/controllers/admin/users_controller_spec.rb | 13 +- spec/controllers/projects_controller_spec.rb | 27 + spec/factories/ci/job_artifacts.rb | 70 ++ .../ci/reports/security/aggregated_reports.rb | 14 + spec/factories/ci/reports/security/finding_keys.rb | 18 + spec/factories/ci/reports/security/findings.rb | 54 ++ .../ci/reports/security/locations/sast.rb | 23 + spec/factories/ci/reports/security/reports.rb | 28 + .../features/groups/members/manage_members_spec.rb | 54 ++ .../deprecated/gl-sast-report.json | 964 +++++++++++++++++++++ .../feature-branch/gl-sast-report.json | 177 ++++ .../feature-branch/gl-secret-detection-report.json | 5 + .../master/gl-common-scanning-report-names.json | 168 ++++ .../master/gl-common-scanning-report.json | 160 ++++ .../master/gl-sast-missing-scanner.json | 802 +++++++++++++++++ .../components/invite_members_modal_spec.js | 136 ++- .../vue_mr_widget/mr_widget_options_spec.js | 2 +- .../merge_request_artifact_download_spec.js | 2 +- .../security_reports/security_reports_app_spec.js | 2 +- spec/helpers/invite_members_helper_spec.rb | 50 ++ spec/helpers/projects_helper_spec.rb | 36 + spec/initializers/0_log_deprecations_spec.rb | 74 ++ .../references/alert_reference_filter_spec.rb | 29 + spec/lib/gitlab/ci/parsers/security/common_spec.rb | 350 ++++++++ spec/lib/gitlab/ci/parsers/security/sast_spec.rb | 57 ++ .../ci/parsers/security/secret_detection_spec.rb | 54 ++ .../security/validators/schema_validator_spec.rb | 40 + .../ci/reports/security/aggregated_report_spec.rb | 45 + .../gitlab/ci/reports/security/finding_key_spec.rb | 41 + .../ci/reports/security/finding_signature_spec.rb | 59 ++ .../ci/reports/security/locations/sast_spec.rb | 21 + .../security/locations/secret_detection_spec.rb | 21 + spec/lib/gitlab/ci/reports/security/report_spec.rb | 224 +++++ .../lib/gitlab/ci/reports/security/reports_spec.rb | 113 +++ ...vulnerability_finding_signature_helpers_spec.rb | 32 + spec/models/user_spec.rb | 37 + spec/models/users/banned_user_spec.rb | 21 + spec/services/users/ban_service_spec.rb | 65 +- .../users/banned_user_base_service_spec.rb | 14 + spec/services/users/unban_service_spec.rb | 75 ++ .../features/invite_members_modal_helper.rb | 12 +- .../locations/locations_shared_examples.rb | 68 ++ 173 files changed, 7330 insertions(+), 333 deletions(-) create mode 100644 app/assets/javascripts/vue_shared/security_reports/graphql/fragments/job_artifacts.fragment.graphql create mode 100644 app/assets/javascripts/vue_shared/security_reports/graphql/queries/security_report_merge_request_download_paths.query.graphql create mode 100644 app/assets/javascripts/vue_shared/security_reports/graphql/queries/security_report_pipeline_download_paths.query.graphql delete mode 100644 app/assets/javascripts/vue_shared/security_reports/queries/security_report_merge_request_download_paths.query.graphql delete mode 100644 app/assets/javascripts/vue_shared/security_reports/queries/security_report_pipeline_download_paths.query.graphql create mode 100644 app/models/users/banned_user.rb create mode 100644 app/services/security/merge_reports_service.rb create mode 100644 app/services/users/banned_user_base_service.rb create mode 100644 app/services/users/unban_service.rb create mode 100644 config/feature_flags/experiment/member_areas_of_focus.yml create mode 100644 config/initializers/0_log_deprecations.rb create mode 100644 db/migrate/20210713211008_create_banned_users.rb create mode 100644 db/schema_migrations/20210713211008 create mode 100644 doc/architecture/blueprints/consolidating_groups_and_projects/index.md create mode 100644 lib/gitlab/ci/parsers/security/common.rb create mode 100644 lib/gitlab/ci/parsers/security/concerns/deprecated_syntax.rb create mode 100644 lib/gitlab/ci/parsers/security/sast.rb create mode 100644 lib/gitlab/ci/parsers/security/secret_detection.rb create mode 100644 lib/gitlab/ci/parsers/security/validators/schema_validator.rb create mode 100644 lib/gitlab/ci/parsers/security/validators/schemas/sast.json create mode 100644 lib/gitlab/ci/parsers/security/validators/schemas/secret_detection.json create mode 100644 lib/gitlab/ci/reports/security/aggregated_report.rb create mode 100644 lib/gitlab/ci/reports/security/finding.rb create mode 100644 lib/gitlab/ci/reports/security/finding_key.rb create mode 100644 lib/gitlab/ci/reports/security/finding_signature.rb create mode 100644 lib/gitlab/ci/reports/security/locations/base.rb create mode 100644 lib/gitlab/ci/reports/security/locations/sast.rb create mode 100644 lib/gitlab/ci/reports/security/locations/secret_detection.rb create mode 100644 lib/gitlab/ci/reports/security/report.rb create mode 100644 lib/gitlab/ci/reports/security/reports.rb create mode 100644 lib/gitlab/deprecation_json_logger.rb create mode 100644 spec/factories/ci/reports/security/aggregated_reports.rb create mode 100644 spec/factories/ci/reports/security/finding_keys.rb create mode 100644 spec/factories/ci/reports/security/findings.rb create mode 100644 spec/factories/ci/reports/security/locations/sast.rb create mode 100644 spec/factories/ci/reports/security/reports.rb create mode 100644 spec/fixtures/security_reports/deprecated/gl-sast-report.json create mode 100644 spec/fixtures/security_reports/feature-branch/gl-sast-report.json create mode 100644 spec/fixtures/security_reports/feature-branch/gl-secret-detection-report.json create mode 100644 spec/fixtures/security_reports/master/gl-common-scanning-report-names.json create mode 100644 spec/fixtures/security_reports/master/gl-common-scanning-report.json create mode 100644 spec/fixtures/security_reports/master/gl-sast-missing-scanner.json create mode 100644 spec/initializers/0_log_deprecations_spec.rb create mode 100644 spec/lib/gitlab/ci/parsers/security/common_spec.rb create mode 100644 spec/lib/gitlab/ci/parsers/security/sast_spec.rb create mode 100644 spec/lib/gitlab/ci/parsers/security/secret_detection_spec.rb create mode 100644 spec/lib/gitlab/ci/parsers/security/validators/schema_validator_spec.rb create mode 100644 spec/lib/gitlab/ci/reports/security/aggregated_report_spec.rb create mode 100644 spec/lib/gitlab/ci/reports/security/finding_key_spec.rb create mode 100644 spec/lib/gitlab/ci/reports/security/finding_signature_spec.rb create mode 100644 spec/lib/gitlab/ci/reports/security/locations/sast_spec.rb create mode 100644 spec/lib/gitlab/ci/reports/security/locations/secret_detection_spec.rb create mode 100644 spec/lib/gitlab/ci/reports/security/report_spec.rb create mode 100644 spec/lib/gitlab/ci/reports/security/reports_spec.rb create mode 100644 spec/models/concerns/vulnerability_finding_signature_helpers_spec.rb create mode 100644 spec/models/users/banned_user_spec.rb create mode 100644 spec/services/users/banned_user_base_service_spec.rb create mode 100644 spec/services/users/unban_service_spec.rb create mode 100644 spec/support/shared_examples/lib/gitlab/ci/reports/security/locations/locations_shared_examples.rb diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 99c31a13179..570b9c98af1 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -ce833c4ea66902f46b197d336e168a79ac29be81 +f69cea16bcc88ddf29fb6c4c67a5d788fbc00f9a diff --git a/Gemfile b/Gemfile index 9b1076baf87..d4126b7614f 100644 --- a/Gemfile +++ b/Gemfile @@ -335,6 +335,8 @@ gem 'method_source', '~> 1.0', require: false gem 'webrick', '~> 1.6.1', require: false gem 'prometheus-client-mmap', '~> 0.12.0', require: 'prometheus/client' +gem 'warning', '~> 1.2.0' + group :development do gem 'lefthook', '~> 0.7.0', require: false gem 'solargraph', '~> 0.42', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 999bed3eb4d..dd372a929cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1339,6 +1339,7 @@ GEM vmstat (2.3.0) warden (1.2.8) rack (>= 2.0.6) + warning (1.2.0) webauthn (2.3.0) android_key_attestation (~> 0.3.0) awrence (~> 1.1) @@ -1648,6 +1649,7 @@ DEPENDENCIES validates_hostname (~> 1.0.11) version_sorter (~> 2.2.4) vmstat (~> 2.3.0) + warning (~> 1.2.0) webauthn (~> 2.3) webmock (~> 3.9.1) webrick (~> 1.6.1) diff --git a/app/assets/javascripts/invite_members/components/invite_members_modal.vue b/app/assets/javascripts/invite_members/components/invite_members_modal.vue index 431900aecf0..5881ec08a2e 100644 --- a/app/assets/javascripts/invite_members/components/invite_members_modal.vue +++ b/app/assets/javascripts/invite_members/components/invite_members_modal.vue @@ -9,13 +9,14 @@ import { GlSprintf, GlButton, GlFormInput, + GlFormCheckboxGroup, } from '@gitlab/ui'; import { partition, isString } from 'lodash'; import Api from '~/api'; import ExperimentTracking from '~/experimentation/experiment_tracking'; -import { BV_SHOW_MODAL, BV_HIDE_MODAL } from '~/lib/utils/constants'; +import { BV_SHOW_MODAL } from '~/lib/utils/constants'; import { s__, sprintf } from '~/locale'; -import { INVITE_MEMBERS_IN_COMMENT, GROUP_FILTERS } from '../constants'; +import { INVITE_MEMBERS_IN_COMMENT, GROUP_FILTERS, MEMBER_AREAS_OF_FOCUS } from '../constants'; import eventHub from '../event_hub'; import { responseMessageFromError, @@ -36,6 +37,7 @@ export default { GlSprintf, GlButton, GlFormInput, + GlFormCheckboxGroup, MembersTokenSelect, GroupSelect, }, @@ -74,6 +76,14 @@ export default { type: String, required: true, }, + areasOfFocusOptions: { + type: Array, + required: true, + }, + noSelectionAreasOfFocus: { + type: Array, + required: true, + }, }, data() { return { @@ -83,6 +93,7 @@ export default { inviteeType: 'members', newUsersToInvite: [], selectedDate: undefined, + selectedAreasOfFocus: [], groupToBeSharedWith: {}, source: 'unknown', invalidFeedbackMessage: '', @@ -128,10 +139,21 @@ export default { this.newUsersToInvite.length === 0 && Object.keys(this.groupToBeSharedWith).length === 0 ); }, + areasOfFocusEnabled() { + return this.areasOfFocusOptions.length !== 0; + }, + areasOfFocusForPost() { + if (this.selectedAreasOfFocus.length === 0 && this.areasOfFocusEnabled) { + return this.noSelectionAreasOfFocus; + } + + return this.selectedAreasOfFocus; + }, }, mounted() { eventHub.$on('openModal', (options) => { this.openModal(options); + this.trackEvent(MEMBER_AREAS_OF_FOCUS.name, MEMBER_AREAS_OF_FOCUS.view); }); }, methods: { @@ -152,9 +174,12 @@ export default { this.$root.$emit(BV_SHOW_MODAL, this.modalId); }, + trackEvent(experimentName, eventName) { + const tracking = new ExperimentTracking(experimentName); + tracking.event(eventName); + }, closeModal() { - this.resetFields(); - this.$root.$emit(BV_HIDE_MODAL, this.modalId); + this.$refs.modal.hide(); }, sendInvite() { if (this.isInviteGroup) { @@ -165,9 +190,10 @@ export default { }, trackInvite() { if (this.source === INVITE_MEMBERS_IN_COMMENT) { - const tracking = new ExperimentTracking(INVITE_MEMBERS_IN_COMMENT); - tracking.event('comment_invite_success'); + this.trackEvent(INVITE_MEMBERS_IN_COMMENT, 'comment_invite_success'); } + + this.trackEvent(MEMBER_AREAS_OF_FOCUS.name, MEMBER_AREAS_OF_FOCUS.submit); }, resetFields() { this.isLoading = false; @@ -176,6 +202,7 @@ export default { this.newUsersToInvite = []; this.groupToBeSharedWith = {}; this.invalidFeedbackMessage = ''; + this.selectedAreasOfFocus = []; }, changeSelectedItem(item) { this.selectedAccessLevel = item; @@ -223,6 +250,7 @@ export default { email: usersToInviteByEmail, access_level: this.selectedAccessLevel, invite_source: this.source, + areas_of_focus: this.areasOfFocusForPost, }; }, addByUserIdPostData(usersToAddById) { @@ -231,6 +259,7 @@ export default { user_id: usersToAddById, access_level: this.selectedAccessLevel, invite_source: this.source, + areas_of_focus: this.areasOfFocusForPost, }; }, shareWithGroupPostData(groupToBeSharedWith) { @@ -304,18 +333,22 @@ export default { inviteButtonText: s__('InviteMembersModal|Invite'), cancelButtonText: s__('InviteMembersModal|Cancel'), headerCloseLabel: s__('InviteMembersModal|Close invite team members'), + areasOfFocusLabel: s__( + 'InviteMembersModal|What would you like new member(s) to focus on? (optional)', + ), }, membersTokenSelectLabelId: 'invite-members-input', }; +
+ + +