Skip to content

Commit 6e88197

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 47bb428 commit 6e88197

File tree

34 files changed

+697
-88
lines changed

34 files changed

+697
-88
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ charset = utf-8
1616

1717
[*.{md,markdown,js.snap}]
1818
trim_trailing_whitespace = false
19+
20+
[*.rb]
21+
max_line_length = 120

.rubocop_todo/style/open_struct_use.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
Style/OpenStructUse:
33
Exclude:
4-
- app/helpers/application_settings_helper.rb
54
- ee/spec/features/projects/new_project_spec.rb
65
- ee/spec/finders/template_finder_spec.rb
76
- ee/spec/helpers/ee/blob_helper_spec.rb

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
documentation](doc/development/changelog.md) for instructions on adding your own
33
entry.
44

5+
## 14.9.3 (2022-04-12)
6+
7+
### Fixed (4 changes)
8+
9+
- [Revert Protected Environment group access inheritence](gitlab-org/gitlab@488fd8f3f6770eebae10c815398534ff41d57546) ([merge request](gitlab-org/gitlab!84664))
10+
- [Fix URL blocker when object storage enabled but type is disabled](gitlab-org/gitlab@d0da89768774de9cf635af530ed7386e65f92d40) ([merge request](gitlab-org/gitlab!84664))
11+
- [Remove pending builds from the queue on conflict](gitlab-org/gitlab@8c88898dfd1619cc635ce5b98e30eebd91da497f) ([merge request](gitlab-org/gitlab!84664))
12+
- [Fix null argument handling in background migration Rake task](gitlab-org/gitlab@23e1eb3272828b3546e18efdfaea5a8077cb20f4) ([merge request](gitlab-org/gitlab!84664))
13+
514
## 14.9.2 (2022-03-31)
615

716
### Security (20 changes)

app/assets/javascripts/security_configuration/components/constants.js

+18-7
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,17 @@ export const SAST_IAC_CONFIG_HELP_PATH = helpPagePath(
5050

5151
export const DAST_NAME = __('Dynamic Application Security Testing (DAST)');
5252
export const DAST_SHORT_NAME = s__('ciReport|DAST');
53-
export const DAST_DESCRIPTION = __('Analyze a review version of your web application.');
53+
export const DAST_DESCRIPTION = s__(
54+
'ciReport|Analyze a deployed version of your web application for known vulnerabilities by examining it from the outside in. DAST works by simulating external attacks on your application while it is running.',
55+
);
5456
export const DAST_HELP_PATH = helpPagePath('user/application_security/dast/index');
5557
export const DAST_CONFIG_HELP_PATH = helpPagePath('user/application_security/dast/index', {
5658
anchor: 'enable-dast',
5759
});
60+
export const DAST_BADGE_TEXT = __('Available on-demand');
61+
export const DAST_BADGE_TOOLTIP = __(
62+
'On-demand scans run outside of the DevOps cycle and find vulnerabilities in your projects',
63+
);
5864

5965
export const DAST_PROFILES_NAME = __('DAST profiles');
6066
export const DAST_PROFILES_DESCRIPTION = s__(
@@ -171,18 +177,23 @@ export const securityFeatures = [
171177
type: REPORT_TYPE_SAST_IAC,
172178
},
173179
{
174-
name: DAST_NAME,
175-
shortName: DAST_SHORT_NAME,
176-
description: DAST_DESCRIPTION,
177-
helpPath: DAST_HELP_PATH,
178-
configurationHelpPath: DAST_CONFIG_HELP_PATH,
179-
type: REPORT_TYPE_DAST,
180+
badge: {
181+
text: DAST_BADGE_TEXT,
182+
tooltipText: DAST_BADGE_TOOLTIP,
183+
variant: 'info',
184+
},
180185
secondary: {
181186
type: REPORT_TYPE_DAST_PROFILES,
182187
name: DAST_PROFILES_NAME,
183188
description: DAST_PROFILES_DESCRIPTION,
184189
configurationText: DAST_PROFILES_CONFIG_TEXT,
185190
},
191+
name: DAST_NAME,
192+
shortName: DAST_SHORT_NAME,
193+
description: DAST_DESCRIPTION,
194+
helpPath: DAST_HELP_PATH,
195+
configurationHelpPath: DAST_CONFIG_HELP_PATH,
196+
type: REPORT_TYPE_DAST,
186197
},
187198
{
188199
name: DEPENDENCY_SCANNING_NAME,

app/assets/javascripts/security_configuration/components/feature_card.vue

+27-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<script>
22
import { GlButton, GlCard, GlIcon, GlLink } from '@gitlab/ui';
33
import { __, s__, sprintf } from '~/locale';
4-
import ManageViaMr from '~/vue_shared/security_configuration/components/manage_via_mr.vue';
54
import { REPORT_TYPE_SAST_IAC } from '~/vue_shared/security_reports/constants';
5+
import ManageViaMr from '~/vue_shared/security_configuration/components/manage_via_mr.vue';
6+
import FeatureCardBadge from './feature_card_badge.vue';
67
78
export default {
89
components: {
910
GlButton,
1011
GlCard,
1112
GlIcon,
1213
GlLink,
14+
FeatureCardBadge,
1315
ManageViaMr,
1416
},
1517
props: {
@@ -37,25 +39,32 @@ export default {
3739
text: this.$options.i18n.enableFeature,
3840
};
3941
40-
button.category = 'secondary';
42+
button.category = this.feature.category || 'secondary';
4143
button.text = sprintf(button.text, { feature: this.shortName });
4244
4345
return button;
4446
},
47+
manageViaMrButtonCategory() {
48+
return this.feature.category || 'secondary';
49+
},
4550
showManageViaMr() {
4651
return ManageViaMr.canRender(this.feature);
4752
},
4853
cardClasses() {
4954
return { 'gl-bg-gray-10': !this.available };
5055
},
5156
statusClasses() {
52-
const { enabled } = this;
57+
const { enabled, hasBadge } = this;
5358
5459
return {
5560
'gl-ml-auto': true,
5661
'gl-flex-shrink-0': true,
5762
'gl-text-gray-500': !enabled,
5863
'gl-text-green-500': enabled,
64+
'gl-w-full': hasBadge,
65+
'gl-justify-content-space-between': hasBadge,
66+
'gl-display-flex': hasBadge,
67+
'gl-mb-4': hasBadge,
5968
};
6069
},
6170
hasSecondary() {
@@ -68,6 +77,9 @@ export default {
6877
isNotSastIACTemporaryHack() {
6978
return this.feature.type !== REPORT_TYPE_SAST_IAC;
7079
},
80+
hasBadge() {
81+
return Boolean(this.available && this.feature.badge?.text);
82+
},
7183
},
7284
methods: {
7385
onError(message) {
@@ -88,7 +100,10 @@ export default {
88100
89101
<template>
90102
<gl-card :class="cardClasses">
91-
<div class="gl-display-flex gl-align-items-baseline">
103+
<div
104+
class="gl-display-flex gl-align-items-baseline"
105+
:class="{ 'gl-flex-direction-column-reverse': hasBadge }"
106+
>
92107
<h3 class="gl-font-lg gl-m-0 gl-mr-3">{{ feature.name }}</h3>
93108
94109
<div
@@ -97,13 +112,19 @@ export default {
97112
data-testid="feature-status"
98113
:data-qa-selector="`${feature.type}_status`"
99114
>
115+
<feature-card-badge
116+
v-if="hasBadge"
117+
:badge="feature.badge"
118+
:badge-href="feature.badge.badgeHref"
119+
/>
120+
100121
<template v-if="enabled">
101122
<gl-icon name="check-circle-filled" />
102123
<span class="gl-text-green-700">{{ $options.i18n.enabled }}</span>
103124
</template>
104125
105126
<template v-else-if="available">
106-
{{ $options.i18n.notEnabled }}
127+
<span>{{ $options.i18n.notEnabled }}</span>
107128
</template>
108129
109130
<template v-else>
@@ -133,7 +154,7 @@ export default {
133154
v-else-if="showManageViaMr"
134155
:feature="feature"
135156
variant="confirm"
136-
category="secondary"
157+
:category="manageViaMrButtonCategory"
137158
class="gl-mt-5"
138159
:data-qa-selector="`${feature.type}_mr_button`"
139160
@error="onError"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script>
2+
import { GlBadge, GlTooltip } from '@gitlab/ui';
3+
4+
export default {
5+
components: {
6+
GlBadge,
7+
GlTooltip,
8+
},
9+
props: {
10+
badge: {
11+
type: Object,
12+
required: true,
13+
},
14+
badgeHref: {
15+
type: String,
16+
required: false,
17+
default: '',
18+
},
19+
},
20+
};
21+
</script>
22+
23+
<template>
24+
<span>
25+
<gl-tooltip
26+
v-if="badge.tooltipText"
27+
placement="top"
28+
boundary="window"
29+
title="Tooltip title"
30+
:target="() => $refs.badge"
31+
>
32+
{{ badge.tooltipText }}
33+
</gl-tooltip>
34+
<span ref="badge">
35+
<gl-badge size="sm" :href="badgeHref" :variant="badge.variant">
36+
{{ badge.text }}
37+
</gl-badge>
38+
</span>
39+
</span>
40+
</template>

app/assets/javascripts/security_configuration/utils.js

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export const augmentFeatures = (securityFeatures, complianceFeatures, features =
3030
augmented.secondary = { ...augmented.secondary, ...featuresByType[feature.secondary.type] };
3131
}
3232

33+
if (augmented.badge && augmented.metaInfoPath) {
34+
augmented.badge.badgeHref = augmented.metaInfoPath;
35+
}
36+
3337
return augmented;
3438
};
3539

app/controllers/concerns/wiki_actions.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,7 @@ def send_wiki_file_blob(wiki, file_blob)
308308
end
309309

310310
def load_content?
311-
return false if %w[history destroy diff].include?(params[:action])
312-
return false if params[:action] == 'show' && Feature.enabled?(:wiki_async_load, container, default_enabled: :yaml)
311+
return false if %w[history destroy diff show].include?(params[:action])
313312

314313
true
315314
end

app/graphql/types/dependency_proxy/manifest_type_enum.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class DependencyProxy::ManifestTypeEnum < BaseEnum
55
graphql_name 'DependencyProxyManifestStatus'
66

77
::DependencyProxy::Manifest.statuses.keys.each do |status|
8-
value status.upcase, { description: "Dependency proxy manifest has a status of #{status}.", value: status }
8+
value status.upcase, description: "Dependency proxy manifest has a status of #{status}.", value: status
99
end
1010
end
1111
end

app/helpers/application_settings_helper.rb

+12-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@ def kroki_available_formats
3737
end
3838

3939
def storage_weights
40-
Gitlab.config.repositories.storages.keys.each_with_object(OpenStruct.new) do |storage, weights|
41-
weights[storage.to_sym] = @application_setting.repository_storages_weighted[storage] || 0
40+
# Instead of using a `Struct` we could wrap this into an object.
41+
# See https://gitlab.com/gitlab-org/gitlab/-/issues/358419
42+
weights = Struct.new(*Gitlab.config.repositories.storages.keys.map(&:to_sym))
43+
44+
values = Gitlab.config.repositories.storages.keys.map do |storage|
45+
@application_setting.repository_storages_weighted[storage] || 0
4246
end
47+
48+
weights.new(*values)
4349
end
4450

4551
def all_protocols_enabled?
@@ -223,6 +229,7 @@ def visible_attributes
223229
:default_project_visibility,
224230
:default_projects_limit,
225231
:default_snippet_visibility,
232+
:delete_inactive_projects,
226233
:disable_feed_token,
227234
:disabled_oauth_sign_in_sources,
228235
:domain_denylist,
@@ -273,6 +280,9 @@ def visible_attributes
273280
:html_emails_enabled,
274281
:import_sources,
275282
:in_product_marketing_emails_enabled,
283+
:inactive_projects_delete_after_months,
284+
:inactive_projects_min_size_mb,
285+
:inactive_projects_send_warning_email_after_months,
276286
:invisible_captcha_enabled,
277287
:max_artifacts_size,
278288
:max_attachment_size,

app/models/application_setting.rb

+9
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,15 @@ def self.kroki_formats_attributes
578578

579579
validates :public_runner_releases_url, addressable_url: true, presence: true
580580

581+
validates :inactive_projects_min_size_mb,
582+
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
583+
584+
validates :inactive_projects_delete_after_months,
585+
numericality: { only_integer: true, greater_than: 0 }
586+
587+
validates :inactive_projects_send_warning_email_after_months,
588+
numericality: { only_integer: true, greater_than: 0, less_than: :inactive_projects_delete_after_months }
589+
581590
attr_encrypted :asset_proxy_secret_key,
582591
mode: :per_attribute_iv,
583592
key: Settings.attr_encrypted_db_key_base_truncated,

app/presenters/projects/security/configuration_presenter.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ def scan(type, configured: false)
8181
configured: scan.configured?,
8282
configuration_path: scan.configuration_path,
8383
available: scan.available?,
84-
can_enable_by_merge_request: scan.can_enable_by_merge_request?
84+
can_enable_by_merge_request: scan.can_enable_by_merge_request?,
85+
meta_info_path: scan.meta_info_path
8586
}
8687
end
8788

app/views/shared/wikis/show.html.haml

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
- if can?(current_user, :create_wiki, @wiki.container) && @page.latest? && @valid_encoding
2828
= link_to sprite_icon('pencil', css_class: 'gl-icon'), wiki_page_path(@wiki, @page, action: :edit), title: 'Edit', role: "button", class: 'btn gl-button btn-icon btn-default js-wiki-edit', data: { qa_selector: 'edit_page_button', testid: 'wiki_edit_button' }
2929

30-
- if Feature.enabled?(:wiki_async_load, @wiki.container, default_enabled: :yaml)
31-
.js-async-wiki-page-content.md.gl-pt-2{ data: { qa_selector: 'wiki_page_content', testid: 'wiki_page_content', tracking_context: wiki_page_tracking_context(@page).to_json, get_wiki_content_url: wiki_page_render_api_endpoint(@page) } }
32-
- else
33-
= render 'shared/wikis/wiki_content'
30+
.js-async-wiki-page-content.md.gl-pt-2{ data: { qa_selector: 'wiki_page_content', testid: 'wiki_page_content', tracking_context: wiki_page_tracking_context(@page).to_json, get_wiki_content_url: wiki_page_render_api_endpoint(@page) } }
3431

3532
= render 'shared/wikis/sidebar'

config/feature_flags/development/wiki_async_load.yml

-8
This file was deleted.

config/feature_flags/experiment/bypass_registration.yml

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
3+
class AddInactiveProjectDeletionToApplicationSettings < Gitlab::Database::Migration[1.0]
4+
def change
5+
add_column :application_settings, :delete_inactive_projects, :boolean, default: false, null: false
6+
add_column :application_settings, :inactive_projects_delete_after_months, :integer, default: 2, null: false
7+
add_column :application_settings, :inactive_projects_min_size_mb, :integer, default: 0, null: false
8+
add_column :application_settings, :inactive_projects_send_warning_email_after_months, :integer, default: 1,
9+
null: false
10+
end
11+
end

db/schema_migrations/20220406113217

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
161ba8db7400c12dc0550246af8db86487e811803eaecedcb2761f4a8349920b

db/structure.sql

+4
Original file line numberDiff line numberDiff line change
@@ -11257,6 +11257,10 @@ CREATE TABLE application_settings (
1125711257
database_grafana_api_url text,
1125811258
database_grafana_tag text,
1125911259
public_runner_releases_url text DEFAULT 'https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab-runner/releases'::text NOT NULL,
11260+
delete_inactive_projects boolean DEFAULT false NOT NULL,
11261+
inactive_projects_delete_after_months integer DEFAULT 2 NOT NULL,
11262+
inactive_projects_min_size_mb integer DEFAULT 0 NOT NULL,
11263+
inactive_projects_send_warning_email_after_months integer DEFAULT 1 NOT NULL,
1126011264
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
1126111265
CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)),
1126211266
CONSTRAINT app_settings_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)),

doc/.vale/gitlab/spelling-exceptions.txt

+1
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ repurposing
524524
requeue
525525
requeued
526526
requeues
527+
requeuing
527528
Restlet
528529
resync
529530
resynced

doc/api/settings.md

+4
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ listed in the descriptions of the relevant settings.
274274
| `default_projects_limit` | integer | no | Project limit per user. Default is `100000`. |
275275
| `default_snippet_visibility` | string | no | What visibility level new snippets receive. Can take `private`, `internal` and `public` as a parameter. Default is `private`. |
276276
| `delayed_project_deletion` **(PREMIUM SELF)** | boolean | no | Enable delayed project deletion by default in new groups. Default is `false`. |
277+
| `delete_inactive_projects` | boolean | no | Enable inactive project deletion feature. Default is `false`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84519) in GitLab 14.10. |
277278
| `deletion_adjourned_period` **(PREMIUM SELF)** | integer | no | The number of days to wait before deleting a project or group that is marked for deletion. Value must be between 0 and 90.
278279
| `diff_max_patch_bytes` | integer | no | Maximum [diff patch size](../user/admin_area/diff_limits.md), in bytes. |
279280
| `diff_max_files` | integer | no | Maximum [files in a diff](../user/admin_area/diff_limits.md). |
@@ -350,6 +351,9 @@ listed in the descriptions of the relevant settings.
350351
| `html_emails_enabled` | boolean | no | Enable HTML emails. |
351352
| `import_sources` | array of strings | no | Sources to allow project import from, possible values: `github`, `bitbucket`, `bitbucket_server`, `gitlab`, `fogbugz`, `git`, `gitlab_project`, `gitea`, `manifest`, and `phabricator`. |
352353
| `in_product_marketing_emails_enabled` | boolean | no | Enable [in-product marketing emails](../user/profile/notifications.md#global-notification-settings). Enabled by default. |
354+
| `inactive_projects_delete_after_months` | integer | no | If `delete_inactive_projects` is `true`, the time (in months) to wait before deleting inactive projects. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84519) in GitLab 14.10. |
355+
| `inactive_projects_min_size_mb` | integer | no | If `delete_inactive_projects` is `true`, the minimum repository size for projects to be checked for inactivity. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84519) in GitLab 14.10. |
356+
| `inactive_projects_send_warning_email_after_months` | integer | no | If `delete_inactive_projects` is `true`, sets the time (in months) to wait before emailing maintainers that the project will be deleted because it is inactive. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84519) in GitLab 14.10. |
353357
| `invisible_captcha_enabled` | boolean | no | Enable Invisible CAPTCHA spam detection during sign-up. Disabled by default. |
354358
| `issues_create_limit` | integer | no | Max number of issue creation requests per minute per user. Disabled by default.|
355359
| `keep_latest_artifact` | boolean | no | Prevent the deletion of the artifacts from the most recent successful jobs, regardless of the expiry time. Enabled by default. |

0 commit comments

Comments
 (0)