Skip to content

Commit fcb6fb0

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent ef69661 commit fcb6fb0

File tree

48 files changed

+522
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+522
-99
lines changed

.gitlab/issue_templates/GLAS Engine Limitation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ Use this to raise cases where the GLAS engine's behavior does not align with the
2626

2727
See [SAST Reaction rotation GLAS limitations](https://handbook.gitlab.com/handbook/engineering/development/sec/secure/static-analysis/reaction_rotation/#glas-limitations-issues) to traige this issue.
2828

29-
/label ~"section::sec" ~"devops::application security testing" ~"group::static analysis" ~"Category:SAST" ~"GLAS::VR-Reported" ~"GLAS::EngineLimitation"
29+
/label ~"section::sec" ~"devops::application security testing" ~"group::static analysis" ~"Category:SAST" ~"GLAS::VR-Reported" ~"GLAS:EngineLimitation"

app/assets/javascripts/ci/admin/jobs_table/components/cells/project_cell.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script>
2-
import { GlLink } from '@gitlab/ui';
2+
import LinkCell from '~/ci/runner/components/cells/link_cell.vue';
33
44
export default {
55
components: {
6-
GlLink,
6+
LinkCell,
77
},
88
props: {
99
job: {
@@ -23,6 +23,6 @@ export default {
2323
</script>
2424
<template>
2525
<div class="gl-truncate">
26-
<gl-link :href="projectUrl" data-testid="job-project-link">{{ projectName }}</gl-link>
26+
<link-cell :href="projectUrl" data-testid="job-project-link">{{ projectName }}</link-cell>
2727
</div>
2828
</template>

app/assets/javascripts/ci/jobs_page/components/job_cells/pipeline_cell.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script>
22
import { GlAvatar, GlLink } from '@gitlab/ui';
33
import { s__ } from '~/locale';
4+
import LinkCell from '~/ci/runner/components/cells/link_cell.vue';
45
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
56
67
export default {
@@ -10,6 +11,7 @@ export default {
1011
components: {
1112
GlAvatar,
1213
GlLink,
14+
LinkCell,
1315
},
1416
props: {
1517
job: {
@@ -41,9 +43,9 @@ export default {
4143
<template>
4244
<div>
4345
<div class="-gl-mx-3 -gl-mt-3 gl-p-3">
44-
<gl-link class="gl-truncate" :href="pipelinePath" data-testid="pipeline-id">
46+
<link-cell :href="pipelinePath" class="gl-truncate" data-testid="pipeline-id">
4547
{{ pipelineId }}
46-
</gl-link>
48+
</link-cell>
4749
4850
<span class="gl-text-subtle">
4951
<span>{{ __('created by') }}</span>

app/assets/javascripts/design_management/components/upload/design_version_dropdown.vue

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export default {
7676
<template>
7777
<gl-collapsible-listbox
7878
is-check-centered
79-
class="gl-z-1"
8079
:items="allVersionsList"
8180
:toggle-text="dropdownText"
8281
:selected="designsVersion"

app/assets/javascripts/environments/graphql/queries/environment_details.query.graphql

+6-4
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ query getEnvironmentDetails(
5252
...DeploymentJob
5353
deploymentPipeline: pipeline {
5454
id
55-
jobs(whenExecuted: ["manual"], retried: false) {
56-
nodes {
57-
...DeploymentJob
58-
scheduledAt
55+
... on Pipeline {
56+
jobs(whenExecuted: ["manual"], retried: false) {
57+
nodes {
58+
...DeploymentJob
59+
scheduledAt
60+
}
5961
}
6062
}
6163
}

app/assets/javascripts/gfm_auto_complete.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,11 @@ class GfmAutoComplete {
467467

468468
// Cache assignees & reviewers list for easier filtering later
469469
if (instance.isWorkItemsView) {
470-
const { workItemId } = this.$inputor.get(0).closest('.js-gfm-wrapper').dataset;
471-
assignees = (currentAssignees()[`${workItemId}`] || []).map(createMemberSearchString);
470+
const element = this.$inputor.get(0).closest('.js-gfm-wrapper');
471+
if (element) {
472+
const { workItemId } = element.dataset;
473+
assignees = (currentAssignees()[`${workItemId}`] || []).map(createMemberSearchString);
474+
}
472475
} else {
473476
assignees =
474477
SidebarMediator.singleton?.store?.assignees?.map(createMemberSearchString) || [];

app/assets/javascripts/graphql_shared/possible_types.json

+4
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@
171171
"PendingGroupMember",
172172
"PendingProjectMember"
173173
],
174+
"PipelineInterface": [
175+
"Pipeline",
176+
"PipelineMinimalAccess"
177+
],
174178
"ProjectInterface": [
175179
"Project",
176180
"ProjectMinimalAccess"

app/assets/javascripts/invite_members/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const QUEUED_MESSAGE_SUCCESSFUL = s__(
8484
);
8585
export const INVALID_FEEDBACK_MESSAGE_DEFAULT = s__('InviteMembersModal|Something went wrong');
8686
export const READ_MORE_TEXT = s__(
87-
`InviteMembersModal|Invited members are limited to this role or their current group role, whichever is higher. Learn more about %{linkStart}roles%{linkEnd}.`,
87+
`InviteMembersModal|Invited members are assigned the selected role or the role they have in the group, whichever is lower. Learn more about %{linkStart}roles%{linkEnd}.`,
8888
);
8989
export const READ_MORE_ACCESS_EXPIRATION_TEXT = s__(
9090
`InviteMembersModal|From this date onward, the user can no longer access the group or project. Learn more about %{linkStart}access%{linkEnd}.`,

app/assets/javascripts/ml/model_registry/graphql/queries/get_model.query.graphql

+8-6
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,21 @@ query getModel($id: MlModelID!) {
6262
name
6363
pipeline {
6464
id
65-
mergeRequest {
66-
id
67-
iid
68-
title
69-
webUrl
70-
}
7165
user {
7266
id
7367
avatarUrl
7468
webUrl
7569
username
7670
name
7771
}
72+
... on Pipeline {
73+
mergeRequest {
74+
id
75+
iid
76+
title
77+
webUrl
78+
}
79+
}
7880
}
7981
}
8082
_links {

app/assets/javascripts/ml/model_registry/graphql/queries/get_model_version.query.graphql

+8-6
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,21 @@ query getModelVersion($modelId: MlModelID!, $modelVersionId: MlModelVersionID!)
5050
name
5151
pipeline {
5252
id
53-
mergeRequest {
54-
id
55-
iid
56-
title
57-
webUrl
58-
}
5953
user {
6054
id
6155
avatarUrl
6256
webUrl
6357
username
6458
name
6559
}
60+
... on Pipeline {
61+
mergeRequest {
62+
id
63+
iid
64+
title
65+
webUrl
66+
}
67+
}
6668
}
6769
}
6870
_links {

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

+4-13
Original file line numberDiff line numberDiff line change
@@ -195,23 +195,14 @@ export default {
195195
]"
196196
>
197197
<div class="gl-flex gl-grow gl-flex-col gl-self-center">
198-
<button
199-
v-if="isCollapsible"
200-
tabindex="-1"
201-
aria-hidden="true"
202-
class="gl-z-0 gl-m-0 gl-h-0 gl-border-none gl-p-0"
203-
@click="toggleCollapse"
204-
>
205-
<span class="gl-absolute gl-inset-0"></span>
206-
</button>
207198
<h2
208199
class="gl-m-0 gl-inline-flex gl-items-center gl-gap-3 gl-text-base gl-font-bold gl-leading-normal"
209200
:class="titleClass"
210201
data-testid="crud-title"
211202
>
212203
<gl-link
213204
v-if="anchorId"
214-
class="anchor gl-absolute gl-z-1 gl-no-underline"
205+
class="anchor gl-absolute gl-no-underline"
215206
:href="`#${anchorId}`"
216207
:aria-labelledby="anchorId"
217208
/>
@@ -240,7 +231,7 @@ export default {
240231
<template v-else>{{ description }}</template>
241232
</p>
242233
</div>
243-
<div class="gl-z-1 gl-flex gl-items-center gl-gap-3" data-testid="crud-actions">
234+
<div class="gl-flex gl-items-center gl-gap-3" data-testid="crud-actions">
244235
<slot name="actions" :show-form="showForm"></slot>
245236
<gl-button
246237
v-if="toggleText && !isFormUsedAndVisible"
@@ -252,7 +243,7 @@ export default {
252243
>
253244
<div
254245
v-if="isCollapsible"
255-
class="gl-border-l gl-pointer-events-none gl-absolute gl-right-5 gl-top-4 gl-h-6 gl-border-l-section gl-pl-3"
246+
class="gl-border-l gl-absolute gl-right-5 gl-top-4 gl-h-6 gl-border-l-section gl-pl-3"
256247
>
257248
<gl-button
258249
v-gl-tooltip
@@ -263,7 +254,7 @@ export default {
263254
:aria-label="toggleLabel"
264255
:aria-expanded="ariaExpandedAttr"
265256
:aria-controls="anchorId"
266-
class="gl-pointer-events-auto -gl-mr-2 gl-self-start"
257+
class="-gl-mr-2 gl-self-start"
267258
data-testid="crud-collapse-toggle"
268259
@click="toggleCollapse"
269260
/>

app/assets/javascripts/work_items/components/design_management/design_version_dropdown.vue

-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ export default {
113113
<template>
114114
<gl-collapsible-listbox
115115
is-check-centered
116-
class="gl-z-1"
117116
:items="allVersionsList"
118117
:toggle-text="dropdownText"
119118
:selected="designsVersion"

app/graphql/types/ci/job_type.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class JobType < BaseObject
2626
description: 'Name of the job.'
2727
field :needs, BuildNeedType.connection_type, null: true,
2828
description: 'References to builds that must complete before the jobs run.'
29-
field :pipeline, Types::Ci::PipelineType, null: true,
29+
field :pipeline, Types::Ci::PipelineInterface, null: true,
3030
description: 'Pipeline the job belongs to.'
3131

3232
field :runner, Types::Ci::RunnerType, null: true, description: 'Runner assigned to execute the job.'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
module Types
4+
module Ci
5+
# rubocop: disable GraphQL/GraphqlName -- Not a type
6+
# rubocop: disable Graphql/AuthorizeTypes -- Not a type
7+
class PipelineBaseField < ::Types::BaseField
8+
def initialize(**kwargs, &block)
9+
kwargs[:authorize] = :read_pipeline
10+
11+
super
12+
end
13+
end
14+
# rubocop: enable Graphql/AuthorizeTypes
15+
# rubocop: enable GraphQL/GraphqlName
16+
end
17+
end
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# frozen_string_literal: true
2+
3+
module Types
4+
module Ci
5+
# This inteface sets [authorize: :read_pipeline] (field-level authorization
6+
# via PipelineBaseField) for all defined fields to ensure implementing types
7+
# don't expose inherited fields without proper authorization.
8+
#
9+
# Implementing types can opt-out from this field-level auth and use
10+
# type-level auth by re-defining the field without the authorize argument.
11+
# For example, PipelineType uses :read_pipeline type-level auth and
12+
# redefines all fields in this interface to opt-out while
13+
# PipelineMinimalAccessType uses :read_pipeline_metadata type-level auth to
14+
# expose a set of defined fields and leaves inherited fields it does not
15+
# want to expose to use field-level auth using :read_pipeline.
16+
module PipelineInterface
17+
include BaseInterface
18+
19+
graphql_name 'PipelineInterface'
20+
21+
connection_type_class Types::CountableConnectionType
22+
23+
field_class ::Types::Ci::PipelineBaseField
24+
25+
field :id, GraphQL::Types::ID, null: true,
26+
description: 'ID of the pipeline.'
27+
field :iid, GraphQL::Types::String, null: true,
28+
description: 'Internal ID of the pipeline.'
29+
field :path, GraphQL::Types::String, null: true,
30+
description: "Relative path to the pipeline's page."
31+
field :project, Types::Projects::ProjectInterface, null: true,
32+
description: 'Project the pipeline belongs to.'
33+
field :user,
34+
type: 'Types::UserType',
35+
null: true,
36+
description: 'Pipeline user.'
37+
38+
def self.resolve_type(_object, _context)
39+
PipelineType
40+
end
41+
42+
def path
43+
::Gitlab::Routing.url_helpers.project_pipeline_path(object.project, object)
44+
end
45+
end
46+
end
47+
end
48+
49+
Types::Ci::PipelineInterface.prepend_mod

app/graphql/types/ci/pipeline_type.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module Ci
55
class PipelineType < BaseObject
66
graphql_name 'Pipeline'
77

8+
implements PipelineInterface
9+
810
connection_type_class Types::CountableConnectionType
911

1012
authorize :read_pipeline
@@ -239,10 +241,6 @@ def commit_path
239241
::Gitlab::Routing.url_helpers.project_commit_path(object.project, object.sha)
240242
end
241243

242-
def path
243-
::Gitlab::Routing.url_helpers.project_pipeline_path(object.project, object)
244-
end
245-
246244
def warning_messages
247245
BatchLoader::GraphQL.for(object).batch do |pipelines, loader|
248246
# rubocop: disable CodeReuse/ActiveRecord -- context specific

app/graphql/types/projects/project_interface.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Types
44
module Projects
5-
# This inteface sets [authorize: :read_project] (field-level authorization via
5+
# This interface sets [authorize: :read_project] (field-level authorization via
66
# ProjectBaseField) for all defined fields to ensure implementing types don't
77
# expose inherited fields without proper authorization.
88
#
@@ -29,6 +29,9 @@ module ProjectInterface
2929
field :description, GraphQL::Types::String,
3030
null: true,
3131
description: 'Short description of the project.'
32+
field :full_path, GraphQL::Types::ID,
33+
null: true,
34+
description: 'Full path of the project.'
3235
field :id, GraphQL::Types::ID, null: true,
3336
description: 'ID of the project.'
3437
field :name, GraphQL::Types::String,

app/models/protected_branch.rb

+6
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ def self.downcase_humanized_name
8383
name.underscore.humanize.downcase
8484
end
8585

86+
def self.default_branch_for(project)
87+
return unless project&.default_branch
88+
89+
project.protected_branches.detect { |branch| branch.name == project.default_branch }
90+
end
91+
8692
def default_branch?
8793
return false unless project.present?
8894

app/policies/ci/pipeline_policy.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Ci
44
class PipelinePolicy < BasePolicy
5-
delegate { @subject.project }
5+
delegate(:project) { @subject.project }
66

77
condition(:protected_ref) { ref_protected?(@user, @subject.project, @subject.tag?, @subject.ref) }
88

@@ -63,6 +63,10 @@ class PipelinePolicy < BasePolicy
6363
enable :read_pipeline_variable
6464
end
6565

66+
rule { can?(:read_pipeline) }.policy do
67+
enable :read_pipeline_metadata
68+
end
69+
6670
rule { project_allows_read_dependency }.policy do
6771
enable :read_dependency
6872
end

app/services/system_notes/issuables_service.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,16 @@ def change_issuable_contacts(added_count, removed_count)
179179
# "changed title from **Old** to **New**"
180180
#
181181
# Returns the created Note object
182-
def change_title(old_title)
183-
new_title = noteable.title.dup
182+
def change_title(org_title)
183+
new_title = ERB::Util.html_escape(noteable.title)
184+
old_title = ERB::Util.html_escape(org_title)
184185

185186
old_diffs, new_diffs = Gitlab::Diff::InlineDiff.new(old_title, new_title).inline_diffs
186187

187-
marked_old_title = Gitlab::Diff::InlineDiffMarkdownMarker.new(old_title).mark(old_diffs)
188-
marked_new_title = Gitlab::Diff::InlineDiffMarkdownMarker.new(new_title).mark(new_diffs)
188+
marked_old_title = Gitlab::Diff::InlineDiffMarker.new(old_title).mark(old_diffs)
189+
marked_new_title = Gitlab::Diff::InlineDiffMarker.new(new_title).mark(new_diffs)
189190

190-
body = "changed title from **#{marked_old_title}** to **#{marked_new_title}**"
191+
body = "<div>changed title from <code class=\"idiff\">#{marked_old_title}</code> to <code class=\"idiff\">#{marked_new_title}</code></div>"
191192

192193
track_issue_event(:track_issue_title_changed_action)
193194
work_item_activity_counter.track_work_item_title_changed_action(author: author) if noteable.is_a?(WorkItem)

0 commit comments

Comments
 (0)