Skip to content

Commit cbb8628

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 20625a2 commit cbb8628

File tree

11 files changed

+225
-38
lines changed

11 files changed

+225
-38
lines changed

GITALY_SERVER_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0105df4bc690f9a56806eb72ebec59b1c5396d6d
1+
7d588faba97dfbf48c39a3dc600eee66499cf065

app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules_empty_state.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,12 @@ export default {
4040
</script>
4141
<template>
4242
<gl-empty-state
43+
:title="$options.i18n.pipelineSchedules"
4344
:svg-path="$options.SCHEDULE_MD_SVG_URL"
4445
:svg-height="150"
4546
:primary-button-text="$options.i18n.createNew"
4647
:primary-button-link="newSchedulePath"
4748
>
48-
<template #title>
49-
<h3>
50-
{{ $options.i18n.pipelineSchedules }}
51-
</h3>
52-
</template>
5349
<template #description>
5450
<p class="gl-mb-0">{{ $options.i18n.description }}</p>
5551
<ul class="gl-list-inside" data-testid="pipeline-schedules-characteristics">

app/assets/javascripts/vue_shared/components/rich_timestamp_tooltip.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { GlTooltip } from '@gitlab/ui';
33
4-
import { formatDate } from '~/lib/utils/datetime_utility';
4+
import { localeDateFormat, newDate } from '~/lib/utils/datetime_utility';
55
import timeagoMixin from '~/vue_shared/mixins/timeago';
66
77
export default {
@@ -28,7 +28,9 @@ export default {
2828
return this.rawTimestamp ? this.timeFormatted(this.rawTimestamp) : '';
2929
},
3030
timestamp() {
31-
return this.rawTimestamp ? formatDate(new Date(this.rawTimestamp)) : '';
31+
return this.rawTimestamp
32+
? localeDateFormat.asDateTimeFull.format(newDate(this.rawTimestamp))
33+
: '';
3234
},
3335
},
3436
};

doc/administration/package_information/postgresql_versions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Read more about update policies and warnings in the PostgreSQL
3535

3636
| First GitLab version | PostgreSQL versions | Default version for fresh installs | Default version for upgrades | Notes |
3737
| -------------- | ------------------- | ---------------------------------- | ---------------------------- | ----- |
38+
| 17.5.0 | 14.11, 16.4 | 14.11 | 16.4 | Single node upgrades from PostgreSQL 14 to PostgreSQL 16 are now supported. |
3839
| 17.4.0 | 14.11, 16.4 | 14.11 | 14.11 | PostgreSQL 16 is available for new installations if not using [Geo](../geo/index.md#requirements-for-running-geo) or [Patroni](../postgresql/index.md#postgresql-replication-and-failover-for-linux-package-installations). |
3940
| 17.0.0 | 14.11 | 14.11 | 14.11 | Package upgrades are aborted if PostgreSQL is not upgraded to 14 already. |
4041
| 16.10.1, 16.9.3, 16.8.5 | 13.14, 14.11 | 14.11 | 14.11 | |

doc/user/application_security/sast/advanced_sast_coverage.md

Lines changed: 5 additions & 8 deletions
Large diffs are not rendered by default.

doc/user/gitlab_duo_chat/index.md

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ You can use GitLab Duo Chat in:
3838
- [The GitLab Web IDE (VS Code in the cloud)](../project/web_ide/index.md)
3939
- VS Code, with the [GitLab Workflow extension for VS Code](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow)
4040
- JetBrains IDEs, with the [GitLab Duo Plugin for JetBrains](https://plugins.jetbrains.com/plugin/22325-gitlab-duo)
41-
42-
Visual Studio support is
43-
[under active development](https://gitlab.com/groups/gitlab-org/editor-extensions/-/epics/22).
44-
You can express interest in other IDE extension support
45-
[in this issue](https://gitlab.com/gitlab-org/editor-extensions/meta/-/issues/78).
41+
- Visual Studio for Windows, with the [GitLab Extension for Visual Studio](https://marketplace.visualstudio.com/items?itemName=GitLab.GitLabExtensionForVisualStudio)
4642

4743
NOTE:
4844
If you have self-managed GitLab: GitLab Duo requires GitLab 17.2 and later for the best user experience and results. Earlier versions may continue to work, however the experience may be degraded.
@@ -132,6 +128,43 @@ To use GitLab Duo Chat in GitLab Workflow extension for VS Code:
132128

133129
If you have selected code in the editor, this selection is sent along with your question to the AI. This way you can ask questions about this code selection. For instance, `Could you simplify this?`.
134130

131+
### In the editor window
132+
133+
> - [Generally available](https://gitlab.com/groups/gitlab-org/-/epics/15218) in the GitLab Workflow extension for VS Code 5.15.0.
134+
135+
To open GitLab Duo Chat in the editor window, use any of these methods:
136+
137+
- From a keyboard shortcut, by pressing:
138+
- MacOS: <kbd>Option</kbd> + <kbd>c</kbd>
139+
- Windows and Linux: <kbd>ALT</kbd> + <kbd>c</kbd>
140+
- In the currently open file in your IDE, by selecting some code.
141+
- Right-clicking, then selecting **GitLab Duo Chat > Open Quick Chat**.
142+
143+
After Quick Chat opens:
144+
145+
1. In the message box, enter your question. The available commands are shown while you enter text:
146+
- Enter `/` to display all available commands.
147+
- Enter `/re` to display `/refactor`.
148+
1. To send your question, select **Send**, or press <kbd>Command<kbd> + <kbd>Enter<kbd>.
149+
1. To exit chat, either select the chat icon in the gutter, or press **Escape** while focused on the chat.
150+
151+
## Use GitLab Duo Chat in Visual Studio for Windows
152+
153+
To use GitLab Duo Chat in the GitLab extension for Visual Studio:
154+
155+
1. Install and set up the extension for Visual Studio:
156+
1. In Visual Studio, download and install the [GitLab extension for Visual Studio](../../editor_extensions/visual_studio/index.md).
157+
1. Configure the [GitLab extension for Visual Studio](../../editor_extensions/visual_studio/index.md).
158+
1. In Visual Studio, open a file. The file does not need to be a file in a Git repository.
159+
1. Open Chat by using one of the following methods:
160+
- In the top menu bar, click on **Extensions** and then select **Open Duo Chat**.
161+
- In the file that you have open in the editor, select some code.
162+
1. Right-click and select **GitLab Duo Chat**.
163+
1. Select **Explain selected code** or **Generate Tests**.
164+
1. In the message box, enter your question and press **Enter** or select **Send**.
165+
166+
If you have selected code in the editor, this selection is sent along with your question to the AI. This way you can ask questions about this code selection. For instance, `Could you refactor this?`.
167+
135168
## Use GitLab Duo Chat in JetBrains IDEs
136169

137170
> - Introduced as generally available in GitLab 16.11.

gems/gitlab-secret_detection/lib/gitlab/secret_detection/scan_diffs.rb

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def initialize(logger: Logger.new($stdout), ruleset_path: RULESET_FILE_PATH)
5959
# it instead groups the diffs into smaller array where each array contains diffs with cumulative size of
6060
# +MIN_CHUNK_SIZE_PER_PROC_BYTES+ bytes and each group runs in a separate sub-process. Default value
6161
# is true.
62+
# +exclusions+:: A hash containing arrays of exclusions by their type. Types handled here are
63+
# `raw_value` and `rule`.
6264
#
6365
# NOTE:
6466
# Running the scan in fork mode primarily focuses on reducing the memory consumption of the scan by
@@ -77,7 +79,8 @@ def secrets_scan(
7779
diffs,
7880
timeout: DEFAULT_SCAN_TIMEOUT_SECS,
7981
payload_timeout: DEFAULT_PAYLOAD_TIMEOUT_SECS,
80-
subprocess: RUN_IN_SUBPROCESS
82+
subprocess: RUN_IN_SUBPROCESS,
83+
exclusions: {}
8184
)
8285

8386
return SecretDetection::Response.new(SecretDetection::Status::INPUT_ERROR) unless validate_scan_input(diffs)
@@ -89,9 +92,9 @@ def secrets_scan(
8992

9093
secrets =
9194
if subprocess
92-
run_scan_within_subprocess(matched_diffs, payload_timeout)
95+
run_scan_within_subprocess(matched_diffs, payload_timeout, exclusions)
9396
else
94-
run_scan(matched_diffs, payload_timeout)
97+
run_scan(matched_diffs, payload_timeout, exclusions)
9598
end
9699

97100
scan_status = overall_scan_status(secrets)
@@ -158,10 +161,10 @@ def filter_by_keywords(diffs)
158161
matched_diffs.freeze
159162
end
160163

161-
def run_scan(diffs, payload_timeout)
164+
def run_scan(diffs, payload_timeout, exclusions)
162165
found_secrets = diffs.flat_map do |diff|
163166
Timeout.timeout(payload_timeout) do
164-
find_secrets(diff)
167+
find_secrets(diff, exclusions)
165168
end
166169
rescue Timeout::Error => e
167170
logger.error "Secret Detection scan timed out on the diff(id:#{diff.right_blob_id}): #{e}"
@@ -172,7 +175,7 @@ def run_scan(diffs, payload_timeout)
172175
found_secrets.freeze
173176
end
174177

175-
def run_scan_within_subprocess(diffs, payload_timeout)
178+
def run_scan_within_subprocess(diffs, payload_timeout, exclusions)
176179
diff_sizes = diffs.map { |diff| diff.patch.bytesize }
177180
grouped_diff_indicies = group_by_chunk_size(diff_sizes)
178181

@@ -185,7 +188,7 @@ def run_scan_within_subprocess(diffs, payload_timeout)
185188
) do |grouped_diff|
186189
grouped_diff.flat_map do |diff|
187190
Timeout.timeout(payload_timeout) do
188-
find_secrets(diff)
191+
find_secrets(diff, exclusions)
189192
end
190193
rescue Timeout::Error => e
191194
logger.error "Secret Detection scan timed out on the diff(id:#{diff.right_blob_id}): #{e}"
@@ -198,7 +201,7 @@ def run_scan_within_subprocess(diffs, payload_timeout)
198201
end
199202

200203
# finds secrets in the given diff with a timeout circuit breaker
201-
def find_secrets(diff)
204+
def find_secrets(diff, exclusions)
202205
line_number_offset = 0
203206
secrets = []
204207

@@ -221,6 +224,10 @@ def find_secrets(diff)
221224
# +this context line has a + but starts with a space so isnt an addition
222225
# -this context line has a - but starts with a space so isnt a removal
223226
diff.patch.each_line do |line|
227+
exclusions[:raw_value]&.each do |exclusion|
228+
line.gsub!(exclusion.value, '') # remove excluded raw value from the line.
229+
end
230+
224231
# Parse hunk header for start line
225232
if line.start_with?("@@")
226233
hunk_info = line.match(/@@ -\d+(,\d+)? \+(\d+)(,\d+)? @@/)
@@ -239,6 +246,8 @@ def find_secrets(diff)
239246
type = rules[pattern]["id"]
240247
description = rules[pattern]["description"]
241248

249+
next if exclusions[:rule]&.any? { |exclusion| exclusion.value == type }
250+
242251
secrets << SecretDetection::Finding.new(
243252
diff.right_blob_id,
244253
SecretDetection::Status::FOUND,

gems/gitlab-secret_detection/spec/lib/gitlab/secret_detection/scan_diffs_spec.rb

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
let(:sha1_blank_sha) { ('0' * 40).freeze }
1313
let(:sample_blob_id) { 'fe29d93da4843da433e62711ace82db601eb4f8f' }
1414

15+
let(:exclusion) do
16+
Struct.new(:value, keyword_init: true)
17+
end
18+
1519
let(:ruleset) do
1620
{
1721
"title" => "gitleaks config",
@@ -377,5 +381,143 @@
377381
expect(scan.secrets_scan(all_large_diffs, payload_timeout: each_payload_timeout_secs)).to eq(expected_response)
378382
end
379383
end
384+
385+
context 'when using exclusions' do
386+
let(:diffs) do
387+
[
388+
diff_blob.new(
389+
left_blob_id: sha1_blank_sha,
390+
right_blob_id: sample_blob_id,
391+
patch: "@@ -0,0 +1 @@\n+data with no secret\n",
392+
status: :STATUS_END_OF_PATCH,
393+
binary: false,
394+
over_patch_bytes_limit: false
395+
),
396+
diff_blob.new(
397+
left_blob_id: sha1_blank_sha,
398+
right_blob_id: sample_blob_id,
399+
patch: "@@ -0,0 +1 @@\n+GR134894145645645645645645645\n", # gitleaks:allow
400+
status: :STATUS_END_OF_PATCH,
401+
binary: false,
402+
over_patch_bytes_limit: false
403+
),
404+
diff_blob.new(
405+
left_blob_id: sha1_blank_sha,
406+
right_blob_id: sample_blob_id,
407+
patch: "@@ -0,0 +1 @@\n+GR134894145645645645645645789\n", # gitleaks:allow
408+
status: :STATUS_END_OF_PATCH,
409+
binary: false,
410+
over_patch_bytes_limit: false
411+
),
412+
diff_blob.new(
413+
left_blob_id: sha1_blank_sha,
414+
right_blob_id: sample_blob_id,
415+
patch: "@@ -0,0 +1 @@\n+GR134894112312312312312312312\n", # gitleaks:allow
416+
status: :STATUS_END_OF_PATCH,
417+
binary: false,
418+
over_patch_bytes_limit: false
419+
),
420+
diff_blob.new(
421+
left_blob_id: sha1_blank_sha,
422+
right_blob_id: sample_blob_id,
423+
patch: "@@ -0,0 +1 @@\n+glpat-12312312312312312312\n", # gitleaks:allow
424+
status: :STATUS_END_OF_PATCH,
425+
binary: false,
426+
over_patch_bytes_limit: false
427+
),
428+
diff_blob.new(
429+
left_blob_id: sha1_blank_sha,
430+
right_blob_id: sample_blob_id,
431+
patch: "@@ -0,0 +1,3 @@\n+test data" \
432+
"\n+glptt-1231231231231231231212312312312312312312\n+line contd", # gitleaks:allow
433+
status: :STATUS_END_OF_PATCH,
434+
binary: false,
435+
over_patch_bytes_limit: false
436+
)
437+
]
438+
end
439+
440+
context "when excluding secrets based on raw values" do
441+
let(:exclusions) do
442+
{
443+
raw_value: [
444+
exclusion.new(value: 'GR134894112312312312312312312'), # gitleaks:allow
445+
exclusion.new(value: 'glpat-12312312312312312312') # gitleaks:allow
446+
]
447+
}
448+
end
449+
450+
let(:valid_lines) do
451+
[
452+
diffs[1].patch,
453+
diffs[2].patch,
454+
*diffs[5].patch.lines
455+
]
456+
end
457+
458+
it "excludes values from being detected" do
459+
expected_scan_status = Gitlab::SecretDetection::Status::FOUND
460+
461+
expected_response = Gitlab::SecretDetection::Response.new(
462+
expected_scan_status,
463+
[
464+
Gitlab::SecretDetection::Finding.new(
465+
diffs[1].right_blob_id,
466+
expected_scan_status,
467+
1,
468+
ruleset['rules'][2]['id'],
469+
ruleset['rules'][2]['description']
470+
),
471+
Gitlab::SecretDetection::Finding.new(
472+
diffs[2].right_blob_id,
473+
expected_scan_status,
474+
1,
475+
ruleset['rules'][2]['id'],
476+
ruleset['rules'][2]['description']
477+
),
478+
Gitlab::SecretDetection::Finding.new(
479+
diffs[5].right_blob_id,
480+
expected_scan_status,
481+
2,
482+
ruleset['rules'][1]['id'],
483+
ruleset['rules'][1]['description']
484+
)
485+
]
486+
)
487+
488+
expect(scan.secrets_scan(diffs, exclusions: exclusions)).to eq(expected_response)
489+
end
490+
end
491+
492+
context "when excluding secrets based on rules from default ruleset" do
493+
let(:exclusions) do
494+
{
495+
rule: [
496+
exclusion.new(value: "gitlab_runner_registration_token"),
497+
exclusion.new(value: "gitlab_personal_access_token")
498+
]
499+
}
500+
end
501+
502+
it 'filters out secrets matching excluded rules from detected findings' do
503+
expected_scan_status = Gitlab::SecretDetection::Status::FOUND
504+
505+
expected_response = Gitlab::SecretDetection::Response.new(
506+
expected_scan_status,
507+
[
508+
Gitlab::SecretDetection::Finding.new(
509+
diffs[5].right_blob_id,
510+
expected_scan_status,
511+
2,
512+
ruleset['rules'][1]['id'],
513+
ruleset['rules'][1]['description']
514+
)
515+
]
516+
)
517+
518+
expect(scan.secrets_scan(diffs, exclusions: exclusions)).to eq(expected_response)
519+
end
520+
end
521+
end
380522
end
381523
end

locale/gitlab.pot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20289,6 +20289,9 @@ msgstr ""
2028920289
msgid "DuoChat|Included references"
2029020290
msgstr ""
2029120291

20292+
msgid "DuoChat|Learn what Duo Chat can do."
20293+
msgstr ""
20294+
2029220295
msgid "DuoChat|No results found"
2029320296
msgstr ""
2029420297

0 commit comments

Comments
 (0)