Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-02-16 00:15:19 +00:00
parent 1760f824bb
commit b57f24ba16
24 changed files with 157 additions and 79 deletions

View file

@ -1028,7 +1028,7 @@ GEM
redis-store (>= 1.2, < 2)
redis-store (1.9.0)
redis (>= 4, < 5)
regexp_parser (2.1.1)
regexp_parser (2.2.1)
regexp_property_values (1.0.0)
representable (3.0.4)
declarative (< 0.1.0)

View file

@ -1,3 +1,3 @@
import { initSecurityConfiguration } from '~/security_configuration';
initSecurityConfiguration(document.querySelector('#js-security-configuration-static'));
initSecurityConfiguration(document.querySelector('#js-security-configuration'));

View file

@ -159,15 +159,6 @@ export const securityFeatures = [
helpPath: SAST_HELP_PATH,
configurationHelpPath: SAST_CONFIG_HELP_PATH,
type: REPORT_TYPE_SAST,
// This field is currently hardcoded because SAST is always available.
// It will eventually come from the Backend, the progress is tracked in
// https://gitlab.com/gitlab-org/gitlab/-/issues/331622
available: true,
// This field is currently hardcoded because SAST can always be enabled via MR
// It will eventually come from the Backend, the progress is tracked in
// https://gitlab.com/gitlab-org/gitlab/-/issues/331621
canEnableByMergeRequest: true,
},
{
name: SAST_IAC_NAME,
@ -176,15 +167,6 @@ export const securityFeatures = [
helpPath: SAST_IAC_HELP_PATH,
configurationHelpPath: SAST_IAC_CONFIG_HELP_PATH,
type: REPORT_TYPE_SAST_IAC,
// This field is currently hardcoded because SAST IaC is always available.
// It will eventually come from the Backend, the progress is tracked in
// https://gitlab.com/gitlab-org/gitlab/-/issues/331622
available: true,
// This field will eventually come from the backend, the progress is
// tracked in https://gitlab.com/gitlab-org/gitlab/-/issues/331621
canEnableByMergeRequest: true,
},
{
name: DAST_NAME,
@ -206,10 +188,6 @@ export const securityFeatures = [
helpPath: DEPENDENCY_SCANNING_HELP_PATH,
configurationHelpPath: DEPENDENCY_SCANNING_CONFIG_HELP_PATH,
type: REPORT_TYPE_DEPENDENCY_SCANNING,
// This field will eventually come from the backend, the progress is
// tracked in https://gitlab.com/gitlab-org/gitlab/-/issues/331621
canEnableByMergeRequest: true,
},
{
name: CONTAINER_SCANNING_NAME,
@ -217,10 +195,6 @@ export const securityFeatures = [
helpPath: CONTAINER_SCANNING_HELP_PATH,
configurationHelpPath: CONTAINER_SCANNING_CONFIG_HELP_PATH,
type: REPORT_TYPE_CONTAINER_SCANNING,
// This field will eventually come from the backend, the progress is
// tracked in https://gitlab.com/gitlab-org/gitlab/-/issues/331621
canEnableByMergeRequest: true,
},
{
name: CLUSTER_IMAGE_SCANNING_NAME,
@ -235,16 +209,6 @@ export const securityFeatures = [
helpPath: SECRET_DETECTION_HELP_PATH,
configurationHelpPath: SECRET_DETECTION_CONFIG_HELP_PATH,
type: REPORT_TYPE_SECRET_DETECTION,
// This field is currently hardcoded because Secret Detection is always
// available. It will eventually come from the Backend, the progress is
// tracked in https://gitlab.com/gitlab-org/gitlab/-/issues/333113
available: true,
// This field is currently hardcoded because SAST can always be enabled via MR
// It will eventually come from the Backend, the progress is tracked in
// https://gitlab.com/gitlab-org/gitlab/-/issues/331621
canEnableByMergeRequest: true,
},
{
name: API_FUZZING_NAME,

View file

@ -24,9 +24,6 @@ export default {
enabled() {
return this.available && this.feature.configured;
},
hasStatus() {
return !this.available || typeof this.feature.configured === 'boolean';
},
shortName() {
return this.feature.shortName ?? this.feature.name;
},
@ -93,19 +90,17 @@ export default {
data-testid="feature-status"
:data-qa-selector="`${feature.type}_status`"
>
<template v-if="hasStatus">
<template v-if="enabled">
<gl-icon name="check-circle-filled" />
<span class="gl-text-green-700">{{ $options.i18n.enabled }}</span>
</template>
<template v-if="enabled">
<gl-icon name="check-circle-filled" />
<span class="gl-text-green-700">{{ $options.i18n.enabled }}</span>
</template>
<template v-else-if="available">
{{ $options.i18n.notEnabled }}
</template>
<template v-else-if="available">
{{ $options.i18n.notEnabled }}
</template>
<template v-else>
{{ $options.i18n.availableWith }}
</template>
<template v-else>
{{ $options.i18n.availableWith }}
</template>
</div>
</div>

View file

@ -1,6 +1,19 @@
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { SCANNER_NAMES_MAP } from '~/security_configuration/components/constants';
/**
* This function takes in 3 arrays of objects, securityFeatures, complianceFeatures and features.
* securityFeatures and complianceFeatures are static arrays living in the constants.
* features is dynamic and coming from the backend.
* This function builds a superset of those arrays.
* It looks for matching keys within the dynamic and the static arrays
* and will enrich the objects with the available static data.
* @param [{}] securityFeatures
* @param [{}] complianceFeatures
* @param [{}] features
* @returns {Object} Object with enriched features from constants divided into Security and Compliance Features
*/
export const augmentFeatures = (securityFeatures, complianceFeatures, features = []) => {
const featuresByType = features.reduce((acc, feature) => {
acc[feature.type] = convertObjectPropsToCamelCase(feature, { deep: true });

View file

@ -10,6 +10,8 @@ module Projects
def show
render_403 unless can?(current_user, :read_security_configuration, project)
@configuration ||= configuration_presenter
respond_to do |format|
format.html
format.json do

View file

@ -0,0 +1,20 @@
# frozen_string_literal: true
module Ci
class JobArtifactsDeletedEvent < ::Gitlab::EventStore::Event
def schema
{
'type' => 'object',
'required' => ['job_ids'],
'properties' => {
'job_ids' => {
'type' => 'array',
'properties' => {
'job_id' => { 'type' => 'integer' }
}
}
}
}
end
end
end

View file

@ -81,7 +81,7 @@ module Projects
configured: scan.configured?,
configuration_path: scan.configuration_path,
available: scan.available?,
can_enable_in_merge_request: scan.can_enable_in_merge_request?
can_enable_by_merge_request: scan.can_enable_by_merge_request?
}
end

View file

@ -2,4 +2,6 @@
- page_title _("Security Configuration")
- @content_class = "limit-container-width" unless fluid_layout
#js-security-configuration-static{ data: { project_full_path: @project.full_path, upgrade_path: security_upgrade_path } }
#js-security-configuration{ data: { **@configuration.to_html_data_attribute,
upgrade_path: security_upgrade_path,
project_full_path: @project.full_path } }

View file

@ -1,8 +0,0 @@
---
name: api_caching_rate_limit_branches
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61688
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/330876
milestone: '13.12'
type: development
group: group::source code
default_enabled: true

View file

@ -413,6 +413,8 @@
- 1
- - security_auto_fix
- 1
- - security_findings_delete_by_job_id
- 1
- - security_scans
- 2
- - self_monitoring_project_create

View file

@ -0,0 +1,17 @@
- name: "Retire-JS Dependency Scanning tool" # The name of the feature to be deprecated
announcement_milestone: "14.8" # The milestone when this feature was first announced as deprecated.
announcement_date: "2022-02-22" # The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post.
removal_milestone: "15.0" # The milestone when this feature is planned to be removed
breaking_change: true
body: | # Do not modify this line, instead modify the lines below.
As of 14.8 the retire.js job is being deprecated from Dependency Scanning. It will continue to be included in our CI/CD template while deprecated. We are removing retire.js from Dependency Scanning on May 22, 2022 in GitLab 15.0. JavaScript scanning functionality will not be affected as it is still being covered by Gemnasium.
If you have explicitly excluded retire.js using DS_EXCLUDED_ANALYZERS you will need to clean up (remove the reference) in 15.0. If you have customized your pipeline's Dependency Scanning configuration related to the `retire-js-dependency_scanning` job you will want to switch to gemnasium-dependency_scanning before the removal in 15.0, to prevent your pipeline from failing. If you have not used the DS_EXCLUDED_ANALYZERS to reference retire.js, or customized your template specifically for retire.js, you will not need to take action.
# The following items are not published on the docs page, but may be used in the future.
stage: secure # (optional - may be required in the future) String value of the stage that the feature was created in. e.g., Growth
tiers: ultimate # (optional - may be required in the future) An array of tiers that the feature is available in currently. e.g., [Free, Silver, Gold, Core, Premium, Ultimate]
issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/350510 # (optional) This is a link to the deprecation issue in GitLab
documentation_url: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/analyzers.html # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
removal_date: "2022-05-22" # (optional - may be required in the future) YYYY-MM-DD format. This should almost always be the 22nd of a month (YYYY-MM-22), the date of the milestone release when this feature is planned to be removed

View file

@ -7,6 +7,8 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# User File Uploads **(FREE)**
> - In GitLab 14.8 and later, [authorization checks are enforced](https://gitlab.com/gitlab-org/gitlab/-/issues/26781) on media uploads. This change is being [rolled out incrementally](https://gitlab.com/gitlab-org/gitlab/-/issues/352291) on GitLab.com in 14.9.
Images that are attached to issues, merge requests, or comments
do not require authentication to be viewed if they are accessed directly by URL.
This direct URL contains a random 32-character ID that prevents unauthorized

View file

@ -1028,6 +1028,20 @@ For more information, check the [summary section of the deprecation issue](https
**Planned removal milestone: 15.0 (2022-05-22)**
### Retire-JS Dependency Scanning tool
WARNING:
This feature will be changed or removed in 15.0
as a [breaking change](https://docs.gitlab.com/ee/development/contributing/#breaking-changes).
Before updating GitLab, review the details carefully to determine if you need to make any
changes to your code, settings, or workflow.
As of 14.8 the retire.js job is being deprecated from Dependency Scanning. It will continue to be included in our CI/CD template while deprecated. We are removing retire.js from Dependency Scanning on May 22, 2022 in GitLab 15.0. JavaScript scanning functionality will not be affected as it is still being covered by Gemnasium.
If you have explicitly excluded retire.js using DS_EXCLUDED_ANALYZERS you will need to clean up (remove the reference) in 15.0. If you have customized your pipeline's Dependency Scanning configuration related to the `retire-js-dependency_scanning` job you will want to switch to gemnasium-dependency_scanning before the removal in 15.0, to prevent your pipeline from failing. If you have not used the DS_EXCLUDED_ANALYZERS to reference retire.js, or customized your template specifically for retire.js, you will not need to take action.
**Planned removal milestone: 15.0 (2022-05-22)**
### Support for gRPC-aware proxy deployed between Gitaly and rest of GitLab
WARNING:

View file

@ -35,6 +35,9 @@ maintained by GitLab, but users can also integrate their own **custom images**.
WARNING:
The `bundler-audit` analyzer is deprecated and will be removed in GitLab 15.0 since it duplicates the functionality of the `gemnasium` analyzer. For more information, read the [deprecation announcement](../../../update/deprecations.md#bundler-audit-dependency-scanning-tool).
WARNING:
The `retire.js` analyzer is deprecated and will be removed in GitLab 15.0 since it duplicates the functionality of the `gemnasium` analyzer. For more information, read the [deprecation announcement](../../../update/deprecations.md#retire-js-dependency-scanning-tool).
## Official default analyzers
Any custom change to the official analyzers can be achieved by using a

View file

@ -389,7 +389,8 @@ The following analyzers are executed, each of which have different behavior when
Does not support multiple lockfiles. When multiple lockfiles exist, `bundler-audit`
analyzes the first lockfile discovered while traversing the directory tree in alphabetical order.
We execute both analyzers because they use different sources of vulnerability data. The result is more comprehensive analysis than if only one was executed.
WARNING:
The `bundler-audit` analyzer is deprecated and will be removed in GitLab 15.0 since it duplicates the functionality of the `gemnasium` analyzer. For more information, read the [deprecation announcement](../../../update/deprecations.md#bundler-audit-dependency-scanning-tool).
#### Python
@ -421,6 +422,8 @@ The following analyzers are executed, each of which have different behavior when
From GitLab 14.8 the `Gemnasium` analyzer scans supported JavaScript projects for vendored libraries
(that is, those checked into the project but not managed by the package manager).
WARNING:
The `retire.js` analyzer is deprecated and will be removed in GitLab 15.0 since it duplicates the functionality of the `gemnasium` analyzer. For more information, read the [deprecation announcement](../../../update/deprecations.md#retire-js-dependency-scanning-tool).
We execute both analyzers because they use different sources of vulnerability data. The result is more comprehensive analysis than if only one was executed.
#### PHP, Go, C, C++, .NET, C&#35;

View file

@ -263,7 +263,7 @@ The `name` must be `Job-Token`.
<httpHeaders>
<property>
<name>Job-Token</name>
<value>${env.CI_JOB_TOKEN}</value>
<value>${CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
@ -725,7 +725,7 @@ You can create a new package each time the `main` branch is updated.
<httpHeaders>
<property>
<name>Job-Token</name>
<value>${env.CI_JOB_TOKEN}</value>
<value>${CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
@ -742,17 +742,17 @@ You can create a new package each time the `main` branch is updated.
<repositories>
<repository>
<id>gitlab-maven</id>
<url>${env.CI_API_V4_URL}/projects/${env.CI_PROJECT_ID}/packages/maven</url>
<url>${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitlab-maven</id>
<url>${CI_API_V4_URL}/projects/${env.CI_PROJECT_ID}/packages/maven</url>
<url>${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-maven</id>
<url>${CI_API_V4_URL}/projects/${env.CI_PROJECT_ID}/packages/maven</url>
<url>${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven</url>
</snapshotRepository>
</distributionManagement>
```

View file

@ -1,6 +1,6 @@
---
stage: none
group: unassigned
stage: Create
group: Editor
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
type: reference
disqus_identifier: 'https://docs.gitlab.com/ee/workflow/shortcuts.html'
@ -149,6 +149,57 @@ This shortcut is available when viewing a [wiki page](project/wiki/index.md):
|-------------------|-------------|
| <kbd>e</kbd> | Edit wiki page. |
### Content editor
These shortcuts are available when editing a file with the [Content Editor](https://about.gitlab.com/direction/create/editor/content_editor/):
| Keyboard shortcut | Description |
|-------------------|-------------|
| <kbd></kbd> + <kbd>C</kbd> (Mac) / <kbd>Control</kbd> + <kbd>C</kbd> | Copy |
| <kbd></kbd> + <kbd>X</kbd> (Mac) / <kbd>Control</kbd> + <kbd>X</kbd> | Cut |
| <kbd></kbd> + <kbd>V</kbd> (Mac) / <kbd>Control</kbd> + <kbd>V</kbd> | Paste |
| <kbd></kbd> + <kbd>Shift</kbd> + <kbd>V</kbd> (Mac) / <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>V</kbd> | Paste without formatting |
| <kbd></kbd> + <kbd>Z</kbd> (Mac) / <kbd>Control</kbd> + <kbd>Z</kbd> | Undo |
| <kbd></kbd> + <kbd>Shift</kbd> + <kbd>V</kbd> (Mac) / <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>V</kbd> | Redo |
| <kbd>Shift</kbd> + <kbd>Enter</kbd> | Add a line break |
#### Formatting
| Mac | Windows/Linux | Description |
|-----|---------------|-------------|
| <kbd></kbd> + <kbd>b</kbd> | <kbd>Control</kbd> + <kbd>b</kbd> | Bold |
| <kbd></kbd> + <kbd>i</kbd> | <kbd>Control</kbd> + <kbd>i</kbd> | Italic |
| <kbd></kbd> + <kbd>Shift</kbd> + <kbd>s</kbd> | <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>s</kbd> | Strikethrough |
| <kbd></kbd> + <kbd>e</kbd> | <kbd>Control</kbd> + <kbd>e</kbd> | Code |
| <kbd></kbd> + <kbd>Alt</kbd> + <kbd>0</kbd> | <kbd>Control</kbd> + <kbd>Alt</kbd> + <kbd>0</kbd> | Apply normal text style |
| <kbd></kbd> + <kbd>Alt</kbd> + <kbd>1</kbd> | <kbd>Control</kbd> + <kbd>Alt</kbd> + <kbd>1</kbd> | Apply heading style 1 |
| <kbd></kbd> + <kbd>Alt</kbd> + <kbd>2</kbd> | <kbd>Control</kbd> + <kbd>Alt</kbd> + <kbd>2</kbd> | Apply heading style 2 |
| <kbd></kbd> + <kbd>Alt</kbd> + <kbd>3</kbd> | <kbd>Control</kbd> + <kbd>Alt</kbd> + <kbd>3</kbd> | Apply heading style 3 |
| <kbd></kbd> + <kbd>Alt</kbd> + <kbd>4</kbd> | <kbd>Control</kbd> + <kbd>Alt</kbd> + <kbd>4</kbd> | Apply heading style 4 |
| <kbd></kbd> + <kbd>Alt</kbd> + <kbd>5</kbd> | <kbd>Control</kbd> + <kbd>Alt</kbd> + <kbd>5</kbd> | Apply heading style 5 |
| <kbd></kbd> + <kbd>Alt</kbd> + <kbd>6</kbd> | <kbd>Control</kbd> + <kbd>Alt</kbd> + <kbd>6</kbd> | Apply heading style 6 |
| <kbd></kbd> + <kbd>Shift</kbd> + <kbd>7</kbd> | <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>7</kbd> | Ordered list |
| <kbd></kbd> + <kbd>Shift</kbd> + <kbd>8</kbd> | <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>7</kbd> | Bullet list |
| <kbd></kbd> + <kbd>Shift</kbd> + <kbd>9</kbd> | <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>7</kbd> | Task list |
| <kbd></kbd> + <kbd>Shift</kbd> + <kbd>b</kbd> | <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>b</kbd> | Blockquote |
| <kbd></kbd> + <kbd>Alt</kbd> + <kbd>c</kbd> | <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>c</kbd> | Code block |
| <kbd></kbd> + <kbd>,</kbd> | <kbd>Control</kbd> + <kbd>,</kbd> | Subscript |
| <kbd></kbd> + <kbd>.</kbd> | <kbd>Control</kbd> + <kbd>,</kbd> | Superscript |
| <kbd>Tab</kbd> | | Indent list |
| <kbd>Shift</kbd> + <kbd>Tab</kbd> | | Outdent list |
#### Text selection
| Keyboard shortcut | Description |
|-------------------|-------------|
| <kbd></kbd> + <kbd>a</kbd> (Mac) / <kbd>Control</kbd> + <kbd>a</kbd> | Select all |
| <kbd>Shift</kbd> + <kbd></kbd> | Extend selection one character to left |
| <kbd>Shift</kbd> + <kbd></kbd> | Extend selection one character to right |
| <kbd>Shift</kbd> + <kbd></kbd> | Extend selection one line up |
| <kbd>Shift</kbd> + <kbd></kbd> | Extend selection one line down |
| <kbd></kbd> + <kbd>Shift</kbd> + <kbd></kbd> (Mac) / <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd></kbd> | Extend selection to the beginning of the document |
| <kbd></kbd> + <kbd>Shift</kbd> + <kbd></kbd> (Mac) / <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd></kbd> | Extend selection to the end of the document |
### Filtered search
These shortcuts are available when using a [filtered search input](search/index.md):

View file

@ -42,9 +42,7 @@ module API
optional :page_token, type: String, desc: 'Name of branch to start the paginaition from'
end
get ':id/repository/branches', urgency: :low do
ff_enabled = Feature.enabled?(:api_caching_rate_limit_branches, user_project, default_enabled: :yaml)
cache_action_if(ff_enabled, [user_project, :branches, current_user, declared_params], expires_in: 30.seconds) do
cache_action([user_project, :branches, current_user, declared_params], expires_in: 30.seconds) do
user_project.preload_protected_branches
repository = user_project.repository

View file

@ -21,7 +21,7 @@ module Gitlab
%i[sast sast_iac secret_detection].include?(type)
end
def can_enable_in_merge_request?
def can_enable_by_merge_request?
scans_configurable_in_merge_request.include?(type)
end

View file

@ -113,7 +113,6 @@ describe('FeatureCard component', () => {
context | available | configured | expectedStatus
${'a configured feature'} | ${true} | ${true} | ${'Enabled'}
${'an unconfigured feature'} | ${true} | ${false} | ${'Not enabled'}
${'an available feature with unknown status'} | ${true} | ${undefined} | ${''}
${'an unavailable feature'} | ${false} | ${false} | ${'Available with Ultimate'}
${'an unavailable feature with unknown status'} | ${false} | ${undefined} | ${'Available with Ultimate'}
`('given $context', ({ available, configured, expectedStatus }) => {

View file

@ -47,8 +47,8 @@ RSpec.describe ::Gitlab::Security::ScanConfiguration do
it { is_expected.to be_nil }
end
describe '#can_enable_in_merge_request?' do
subject { scan.can_enable_in_merge_request? }
describe '#can_enable_by_merge_request?' do
subject { scan.can_enable_by_merge_request? }
let(:configured) { true }

View file

@ -88,7 +88,7 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
expect(feature['configured']).to eq(true)
expect(feature['configuration_path']).to be_nil
expect(feature['available']).to eq(true)
expect(feature['can_enable_in_merge_request']).to eq(true)
expect(feature['can_enable_by_merge_request']).to eq(true)
end
context 'when checking features configured status' do

View file

@ -15,6 +15,7 @@ RSpec.describe Projects::DestroyService, :aggregate_failures do
before do
stub_container_registry_config(enabled: true)
stub_container_registry_tags(repository: :any, tags: [])
allow(Gitlab::EventStore).to receive(:publish)
end
shared_examples 'deleting the project' do
@ -42,7 +43,7 @@ RSpec.describe Projects::DestroyService, :aggregate_failures do
end
it 'does not publish an event' do
expect(Gitlab::EventStore).not_to receive(:publish)
expect(Gitlab::EventStore).not_to receive(:publish).with(event_type(Projects::ProjectDeletedEvent))
destroy_project(project, user, {})
end