Skip to content

Commit 76e4504

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent f8b0e66 commit 76e4504

File tree

17 files changed

+229
-38
lines changed

17 files changed

+229
-38
lines changed

config/sidekiq_queues.yml

-2
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,6 @@
415415
- 1
416416
- - security_findings_delete_by_job_id
417417
- 1
418-
- - security_generate_scan_finding_rules
419-
- 1
420418
- - security_orchestration_policy_rule_schedule_namespace
421419
- 1
422420
- - security_scans

doc/api/graphql/reference/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -15590,7 +15590,6 @@ Returns [`[SecurityTrainingUrl!]`](#securitytrainingurl).
1559015590
| ---- | ---- | ----------- |
1559115591
| <a id="projectsecuritytrainingurlsfilename"></a>`filename` | [`String`](#string) | Filename to filter security training URLs by programming language. |
1559215592
| <a id="projectsecuritytrainingurlsidentifierexternalids"></a>`identifierExternalIds` | [`[String!]!`](#string) | List of external IDs of vulnerability identifiers. |
15593-
| <a id="projectsecuritytrainingurlslanguage"></a>`language` | [`String`](#string) | Desired language for training urls. |
1559415593

1559515594
##### `Project.sentryDetailedError`
1559615595

doc/development/gemfile.md

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ When upgrading the Rails gem and its dependencies, you also should update the fo
8989
You should also update npm packages that follow the current version of Rails:
9090

9191
- `@rails/ujs`
92+
- Run `yarn patch-package @rails/ujs` after updating this to ensure our local patch file version matches.
9293
- `@rails/actioncable`
9394

9495
## Upgrading dependencies because of vulnerabilities

doc/development/integrations/secure.md

+2-19
Original file line numberDiff line numberDiff line change
@@ -338,27 +338,10 @@ To view vulnerabilities, either:
338338
NOTE:
339339
This does not apply for the vulnerabilities existing on the default branch.
340340

341-
### Enable report validation
342-
343-
> [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/354928) in GitLab 14.9, and planned for removal in GitLab 15.0.
344-
DISCLAIMER:
345-
This page contains information related to upcoming products, features, and functionality.
346-
It is important to note that the information presented is for informational purposes only.
347-
Please do not rely on this information for purchasing or planning purposes.
348-
As with all projects, the items mentioned on this page are subject to change or delay.
349-
The development, release, and timing of any products, features, or functionality remain at the
350-
sole discretion of GitLab Inc.
351-
In GitLab 15.0 and later, report validation is enabled and enforced. Reports that fail validation
352-
are not ingested, and an error message displays on the corresponding pipeline.
353-
354-
In GitLab 14.10 and later, report validation against the schemas is enabled but not enforced.
355-
Reports that fail validation are ingested but display a warning in the pipeline security tab.
356-
357-
To enforce report validation for GitLab version 14.10 and earlier, set
358-
[`VALIDATE_SCHEMA`](../../user/application_security/#enable-security-report-validation) to `"true"`.
359-
360341
### Report validation
361342

343+
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/351000) in GitLab 15.0.
344+
362345
You must ensure that reports generated by the scanner pass validation against the schema version
363346
declared in your reports. Reports that don't pass validation are not ingested by GitLab, and an
364347
error message displays on the corresponding pipeline.

doc/development/rails_update.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ We strive to run GitLab using the latest Rails releases to benefit from performa
2424
1. Run `bundle update --conservative activesupport` in the `qa` folder.
2525
1. Resolve any Bundler conflicts.
2626
1. Ensure that `@rails/ujs` and `@rails/actioncable` npm packages match the new rails version in [`package.json`](https://gitlab.com/gitlab-org/gitlab/blob/master/package.json).
27+
1. Run `yarn patch-package @rails/ujs` after updating this to ensure our local patch file version matches.
2728
1. Create an MR with the `pipeline:run-all-rspec` label and see if pipeline breaks.
2829
1. To resolve and debug spec failures use `git bisect` against the rails repository. See the [debugging section](#git-bisect-against-rails) below.
2930
1. Include links to the Gem diffs between the two versions in the merge request description. For example, this is the gem diff for [`activesupport` 6.1.3.2 to

doc/topics/autodevops/quick_start_guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ you to common environment tasks:
236236
- **Monitoring** (**{chart}**) - Opens the metrics page where Prometheus collects data
237237
about the Kubernetes cluster and how the application
238238
affects it in terms of memory usage, CPU usage, and latency
239-
- **Deploy to** (**{play}** **{angle-down}**) - Displays a list of environments you can deploy to
239+
- **Deploy to** (**{play}** **{chevron-down}**) - Displays a list of environments you can deploy to
240240
- **Terminal** (**{terminal}**) - Opens a [web terminal](../../ci/environments/index.md#web-terminals-deprecated)
241241
session inside the container where the application is running
242242
- **Re-deploy to environment** (**{repeat}**) - For more information, see

doc/update/index.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ Find where your version sits in the upgrade path below, and upgrade GitLab
367367
accordingly, while also consulting the
368368
[version-specific upgrade instructions](#version-specific-upgrading-instructions):
369369
370-
`8.11.Z` -> `8.12.0` -> `8.17.7` -> `9.5.10` -> `10.8.7` -> [`11.11.8`](#1200) -> `12.0.12` -> [`12.1.17`](#1210) -> [`12.10.14`](#12100) -> `13.0.14` -> [`13.1.11`](#1310) -> [`13.8.8`](#1388) -> [`13.12.15`](#13120) -> [`14.0.12`](#1400) -> [`14.9.5`](#1490) -> [`14.10.Z`](#1410) -> [`15.0.Z`](#1500) -> [latest `15.Y.Z`](https://gitlab.com/gitlab-org/gitlab/-/releases)
370+
`8.11.Z` -> `8.12.0` -> `8.17.7` -> `9.5.10` -> `10.8.7` -> [`11.11.8`](#1200) -> `12.0.12` -> [`12.1.17`](#1210) -> [`12.10.14`](#12100) -> `13.0.14` -> [`13.1.11`](#1310) -> [`13.8.8`](#1388) -> [`13.12.15`](#13120) -> [`14.0.12`](#1400) -> [`14.3.6`](#1430) -> [`14.9.5`](#1490) -> [`14.10.Z`](#1410) -> [`15.0.Z`](#1500) -> [latest `15.Y.Z`](https://gitlab.com/gitlab-org/gitlab/-/releases)
371371
372372
The following table, while not exhaustive, shows some examples of the supported
373373
upgrade paths.
@@ -377,7 +377,7 @@ Additional steps between the mentioned versions are possible. We list the minima
377377
| -------------- | ------------ | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
378378
| `15.1.0` | `14.6.2` | `14.6.2` -> `14.9.5` -> `14.10.4` -> `15.0.2` -> `15.1.0` | Three intermediate versions are required: `14.9` and `14.10`, `15.0`, then `15.1.0`. |
379379
| `15.0.0` | `14.6.2` | `14.6.2` -> `14.9.5` -> `14.10.4` -> `15.0.2` | Two intermediate versions are required: `14.9` and `14.10`, then `15.0.0`. |
380-
| `14.6.2` | `13.10.2` | `13.10.2` -> `13.12.15` -> `14.0.12` -> `14.6.2` | Two intermediate versions are required: `13.12` and `14.0`, then `14.6.2`. |
380+
| `14.6.2` | `13.10.2` | `13.10.2` -> `13.12.15` -> `14.0.12` -> `14.3.6` => `14.6.2` | Three intermediate versions are required: `13.12` and `14.0`, `14.3`, then `14.6.2`. |
381381
| `14.1.8` | `13.9.2` | `13.9.2` -> `13.12.15` -> `14.0.12` -> `14.1.8` | Two intermediate versions are required: `13.12` and `14.0`, then `14.1.8`. |
382382
| `13.12.15` | `12.9.2` | `12.9.2` -> `12.10.14` -> `13.0.14` -> `13.1.11` -> `13.8.8` -> `13.12.15` | Four intermediate versions are required: `12.10`, `13.0`, `13.1` and `13.8.8`, then `13.12.15`. |
383383
| `13.2.10` | `11.5.0` | `11.5.0` -> `11.11.8` -> `12.0.12` -> `12.1.17` -> `12.10.14` -> `13.0.14` -> `13.1.11` -> `13.2.10` | Six intermediate versions are required: `11.11`, `12.0`, `12.1`, `12.10`, `13.0` and `13.1`, then `13.2.10`. |
@@ -706,6 +706,20 @@ for how to proceed.
706706
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
707707
```
708708
709+
- After upgrading to 14.3, ensure that all the `MigrateMergeRequestDiffCommitUsers` background
710+
migration jobs have completed before continuing with upgrading to GitLab 14.5 or later.
711+
This is especially important if your GitLab instance has a large
712+
`merge_request_diff_commits` table. Any pending
713+
`MigrateMergeRequestDiffCommitUsers` background migration jobs are
714+
foregrounded in GitLab 14.5, and may take a long time to complete.
715+
You can check the count of pending jobs for
716+
`MigrateMergeRequestDiffCommitUsers` by using the PostgreSQL console (or `sudo
717+
gitlab-psql`):
718+
719+
```sql
720+
select count(*) from background_migration_jobs where class_name = 'MigrateMergeRequestDiffCommitUsers' and status = 0;
721+
```
722+
709723
- See [Maintenance mode issue in GitLab 13.9 to 14.4](#maintenance-mode-issue-in-gitlab-139-to-144).
710724
711725
### 14.2.0

doc/user/project/issues/design_management.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ The design you selected opens. You can then [zoom in](#zoom-in-on-a-design) on i
9292

9393
When viewing a design, you can move to other designs. To do so, either:
9494

95-
- In the top-right corner, select **Go to previous design** (**{angle-left}**) or **Go to next design** (**{angle-right}**).
95+
- In the top-right corner, select **Go to previous design** (**{chevron-left}**) or **Go to next design** (**{chevron-right}**).
9696
- Press <kbd>Left</kbd> or <kbd>Right</kbd> on your keyboard.
9797

9898
To return to the issue view, either:

lib/gitlab/background_migration/nullify_orphan_runner_id_on_ci_builds.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ def perform(start_id, end_id, batch_table, batch_column, sub_batch_size, pause_m
1010
pause_ms = 0 if pause_ms < 0
1111

1212
batch_relation = relation_scoped_to_range(batch_table, batch_column, start_id, end_id)
13-
batch_relation.each_batch(column: batch_column, of: sub_batch_size, order_hint: :type) do |sub_batch|
13+
batch_relation.each_batch(column: batch_column, of: sub_batch_size) do |sub_batch|
1414
batch_metrics.time_operation(:update_all) do
15-
sub_batch.update_all(runner_id: nil)
15+
filtered_sub_batch(sub_batch).update_all(runner_id: nil)
1616
end
1717

1818
sleep(pause_ms * 0.001)
@@ -31,9 +31,13 @@ def connection
3131

3232
def relation_scoped_to_range(source_table, source_key_column, start_id, stop_id)
3333
define_batchable_model(source_table, connection: connection)
34+
.where(source_key_column => start_id..stop_id)
35+
end
36+
37+
def filtered_sub_batch(sub_batch)
38+
sub_batch
3439
.joins('LEFT OUTER JOIN ci_runners ON ci_runners.id = ci_builds.runner_id')
3540
.where('ci_builds.runner_id IS NOT NULL AND ci_runners.id IS NULL')
36-
.where(source_key_column => start_id..stop_id)
3741
end
3842
end
3943
end

lib/tasks/gitlab/db/validate_config.rake

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ namespace :gitlab do
141141
rescue ActiveRecord::ConnectionNotEstablished, PG::ConnectionBad => err
142142
warn "WARNING: Could not establish database connection for #{db_config.name}: #{err.message}"
143143
rescue ActiveRecord::NoDatabaseError
144+
rescue PG::ReadOnlySqlTransaction => err
145+
warn "WARNING: Could not write to the database #{db_config.name}: #{err.message}"
144146
end
145147

146148
def get_db_identifier(db_config)

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
"monaco-yaml": "^2.5.1",
151151
"mousetrap": "1.6.5",
152152
"papaparse": "^5.3.1",
153+
"patch-package": "^6.4.7",
153154
"pdfjs-dist": "^2.0.943",
154155
"pikaday": "^1.8.0",
155156
"popper.js": "^1.16.1",

patches/@rails+ujs+6.1.4-7.patch

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js b/node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js
2+
index 2176247..1a83d48 100644
3+
--- a/node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js
4+
+++ b/node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js
5+
@@ -265,11 +265,6 @@ Released under the MIT license
6+
try {
7+
response = JSON.parse(response);
8+
} catch (error) {}
9+
- } else if (type.match(/\b(?:java|ecma)script\b/)) {
10+
- script = document.createElement('script');
11+
- script.setAttribute('nonce', cspNonce());
12+
- script.text = response;
13+
- document.head.appendChild(script).parentNode.removeChild(script);
14+
} else if (type.match(/\b(xml|html|svg)\b/)) {
15+
parser = new DOMParser();
16+
type = type.replace(/;.+/, '');

qa/Gemfile.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ GEM
118118
gitlab (4.18.0)
119119
httparty (~> 0.18)
120120
terminal-table (>= 1.5.1)
121-
gitlab-qa (7.29.1)
121+
gitlab-qa (7.32.0)
122122
activesupport (~> 6.1)
123123
gitlab (~> 4.18.0)
124124
http (~> 5.0)
@@ -163,7 +163,7 @@ GEM
163163
http-form_data (~> 2.2)
164164
llhttp-ffi (~> 0.4.0)
165165
http-accept (1.7.0)
166-
http-cookie (1.0.4)
166+
http-cookie (1.0.5)
167167
domain_name (~> 0.5)
168168
http-form_data (2.3.0)
169169
httparty (0.20.0)
@@ -198,7 +198,7 @@ GEM
198198
multi_xml (0.6.0)
199199
multipart-post (2.1.1)
200200
netrc (0.11.0)
201-
nokogiri (1.13.3)
201+
nokogiri (1.13.6)
202202
mini_portile2 (~> 2.8.0)
203203
racc (~> 1.4)
204204
octokit (4.21.0)
@@ -222,7 +222,7 @@ GEM
222222
pry-byebug (3.5.1)
223223
byebug (~> 9.1)
224224
pry (~> 0.10)
225-
public_suffix (4.0.6)
225+
public_suffix (4.0.7)
226226
racc (1.6.0)
227227
rack (2.2.3.1)
228228
rack-test (1.1.0)
@@ -295,7 +295,7 @@ GEM
295295
uber (0.1.0)
296296
unf (0.1.4)
297297
unf_ext
298-
unf_ext (0.0.8.1)
298+
unf_ext (0.0.8.2)
299299
unicode-display_width (2.1.0)
300300
unparser (0.4.7)
301301
abstract_type (~> 0.0.7)

scripts/frontend/postinstall.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const { execSync } = require('child_process');
12
const chalk = require('chalk');
23

34
// check that fsevents is available if we're on macOS
@@ -20,3 +21,8 @@ if (process.platform === 'darwin') {
2021
}
2122

2223
console.log(`${chalk.green('success')} Dependency postinstall check passed.`);
24+
25+
// Apply any patches to our packages
26+
// See https://gitlab.com/gitlab-org/gitlab/-/issues/336138
27+
execSync('node_modules/.bin/patch-package --error-on-fail');
28+
console.log(`${chalk.green('success')} Packages successfully patched.`);
+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { setHTMLFixture } from 'helpers/fixtures';
2+
import waitForPromises from 'helpers/wait_for_promises';
3+
4+
beforeAll(async () => {
5+
// @rails/ujs expects jQuery.ajaxPrefilter to exist if jQuery exists at
6+
// import time. This is only a problem in tests, since we expose jQuery
7+
// globally earlier than in production builds. Work around this by pretending
8+
// that jQuery isn't available *before* we import @rails/ujs.
9+
delete global.jQuery;
10+
11+
const { initRails } = await import('~/lib/utils/rails_ujs.js');
12+
initRails();
13+
});
14+
15+
function mockXHRResponse({ responseText, responseContentType } = {}) {
16+
jest
17+
.spyOn(global.XMLHttpRequest.prototype, 'getResponseHeader')
18+
.mockReturnValue(responseContentType);
19+
20+
jest.spyOn(global.XMLHttpRequest.prototype, 'send').mockImplementation(function send() {
21+
requestAnimationFrame(() => {
22+
Object.defineProperties(this, {
23+
readyState: { value: XMLHttpRequest.DONE },
24+
status: { value: 200 },
25+
response: { value: responseText },
26+
});
27+
this.onreadystatechange();
28+
});
29+
});
30+
}
31+
32+
// This is a test to make sure that the patch-package patch correctly disables
33+
// script execution for data-remote attributes.
34+
it('does not perform script execution via data-remote', async () => {
35+
global.scriptExecutionSpy = jest.fn();
36+
37+
mockXHRResponse({
38+
responseText: 'scriptExecutionSpy();',
39+
responseContentType: 'application/javascript',
40+
});
41+
42+
setHTMLFixture(`
43+
<a href="/foo/evil.js"
44+
data-remote="true"
45+
data-method="get"
46+
data-type="script"
47+
data-testid="evil-link"
48+
>XSS</a>
49+
`);
50+
51+
const link = document.querySelector('[data-testid="evil-link"]');
52+
const ajaxSuccessSpy = jest.fn();
53+
link.addEventListener('ajax:success', ajaxSuccessSpy);
54+
55+
link.click();
56+
57+
await waitForPromises();
58+
59+
// Make sure Rails ajax machinery finished working as expected to avoid false
60+
// positives
61+
expect(ajaxSuccessSpy).toHaveBeenCalledTimes(1);
62+
63+
// If @rails/ujs has been patched correctly, this next assertion should pass.
64+
//
65+
// Because it's asserting something didn't happen, it is possible for it to
66+
// pass for the wrong reason. So, to verify that this test correctly fails
67+
// when @rails/ujs has not been patched, run:
68+
//
69+
// yarn patch-package --reverse
70+
//
71+
// And then re-run this test. The spy should now be called, and correctly
72+
// fail the test.
73+
//
74+
// To restore the patch(es), run:
75+
//
76+
// yarn install
77+
expect(global.scriptExecutionSpy).not.toHaveBeenCalled();
78+
});

spec/tasks/gitlab/db/validate_config_rake_spec.rb

+14
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,20 @@
205205
it_behaves_like 'raises an error', /The 'ci' since it is using 'database_tasks: false' should share database with 'main:'/
206206
end
207207
end
208+
209+
context 'one of the databases is in read-only mode' do
210+
let(:test_config) do
211+
{
212+
main: main_database_config
213+
}
214+
end
215+
216+
before do
217+
expect(ActiveRecord::InternalMetadata).to receive(:upsert).at_least(:once).and_raise(PG::ReadOnlySqlTransaction, "READONLY")
218+
end
219+
220+
it_behaves_like 'validates successfully'
221+
end
208222
end
209223

210224
%w[db:migrate db:schema:load db:schema:dump].each do |task|

0 commit comments

Comments
 (0)