Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6c520f98
Commit
6c520f98
authored
Jul 14, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent guests from linking issues with errors
Changelog: security
parent
a35e8a20
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
0 deletions
+49
-0
app/services/issues/base_service.rb
app/services/issues/base_service.rb
+3
-0
spec/services/issues/create_service_spec.rb
spec/services/issues/create_service_spec.rb
+21
-0
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+25
-0
No files found.
app/services/issues/base_service.rb
View file @
6c520f98
...
...
@@ -48,6 +48,9 @@ module Issues
params
.
delete
(
:created_at
)
unless
moved_issue
||
current_user
.
can?
(
:set_issue_created_at
,
project
)
params
.
delete
(
:updated_at
)
unless
moved_issue
||
current_user
.
can?
(
:set_issue_updated_at
,
project
)
# Only users with permission to handle error data can add it to issues
params
.
delete
(
:sentry_issue_attributes
)
unless
current_user
.
can?
(
:update_sentry_issue
,
project
)
issue
.
system_note_timestamp
=
params
[
:created_at
]
||
params
[
:updated_at
]
end
...
...
spec/services/issues/create_service_spec.rb
View file @
6c520f98
...
...
@@ -226,6 +226,27 @@ RSpec.describe Issues::CreateService do
end
end
context
'when sentry identifier is given'
do
before
do
sentry_attributes
=
{
sentry_issue_attributes:
{
sentry_issue_identifier:
42
}
}
opts
.
merge!
(
sentry_attributes
)
end
it
'does not assign the sentry error'
do
expect
(
issue
.
sentry_issue
).
to
eq
(
nil
)
end
context
'user is reporter or above'
do
before
do
project
.
add_reporter
(
user
)
end
it
'assigns the sentry error'
do
expect
(
issue
.
sentry_issue
).
to
be_kind_of
(
SentryIssue
)
end
end
end
it
'executes issue hooks when issue is not confidential'
do
opts
=
{
title:
'Title'
,
description:
'Description'
,
confidential:
false
}
...
...
spec/services/issues/update_service_spec.rb
View file @
6c520f98
...
...
@@ -82,6 +82,31 @@ RSpec.describe Issues::UpdateService, :mailer do
expect
(
issue
.
milestone
).
to
eq
milestone
end
context
'when sentry identifier is given'
do
before
do
sentry_attributes
=
{
sentry_issue_attributes:
{
sentry_issue_identifier:
42
}
}
opts
.
merge!
(
sentry_attributes
)
end
it
'assigns the sentry error'
do
update_issue
(
opts
)
expect
(
issue
.
sentry_issue
).
to
be_kind_of
(
SentryIssue
)
end
context
'user is a guest'
do
before
do
project
.
add_guest
(
user
)
end
it
'does not assign the sentry error'
do
update_issue
(
opts
)
expect
(
issue
.
sentry_issue
).
to
eq
(
nil
)
end
end
end
context
'when issue type is not incident'
do
before
do
update_issue
(
opts
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment