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
cde5bf83
Commit
cde5bf83
authored
Jan 28, 2020
by
Olena Horal-Koretska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Escape special chars in Sentry error header
parent
f8c31914
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
12 deletions
+40
-12
app/assets/javascripts/error_tracking/components/error_details.vue
...s/javascripts/error_tracking/components/error_details.vue
+13
-12
changelogs/unreleased/security-safe-sentry-error-culprit.yml
changelogs/unreleased/security-safe-sentry-error-culprit.yml
+5
-0
spec/frontend/error_tracking/components/error_details_spec.js
.../frontend/error_tracking/components/error_details_spec.js
+22
-0
No files found.
app/assets/javascripts/error_tracking/components/error_details.vue
View file @
cde5bf83
...
@@ -110,16 +110,6 @@ export default {
...
@@ -110,16 +110,6 @@ export default {
'
errorStatus
'
,
'
errorStatus
'
,
]),
]),
...
mapGetters
(
'
details
'
,
[
'
stacktrace
'
]),
...
mapGetters
(
'
details
'
,
[
'
stacktrace
'
]),
reported
()
{
return
sprintf
(
__
(
'
Reported %{timeAgo} by %{reportedBy}
'
),
{
reportedBy
:
`<strong class="error-details-meta-culprit">
${
this
.
error
.
culprit
}
</strong>`
,
timeAgo
:
this
.
timeFormatted
(
this
.
stacktraceData
.
date_received
),
},
false
,
);
},
firstReleaseLink
()
{
firstReleaseLink
()
{
return
`
${
this
.
error
.
externalBaseUrl
}
/releases/
${
this
.
error
.
firstReleaseShortVersion
}
`
;
return
`
${
this
.
error
.
externalBaseUrl
}
/releases/
${
this
.
error
.
firstReleaseShortVersion
}
`
;
},
},
...
@@ -229,8 +219,19 @@ export default {
...
@@ -229,8 +219,19 @@ export default {
</gl-alert>
</gl-alert>
<div
class=
"error-details-header d-flex py-2 justify-content-between"
>
<div
class=
"error-details-header d-flex py-2 justify-content-between"
>
<div
class=
"error-details-meta my-auto"
>
<div
<span
v-if=
"!loadingStacktrace && stacktrace"
v-html=
"reported"
></span>
v-if=
"!loadingStacktrace && stacktrace"
class=
"error-details-meta my-auto"
data-qa-selector=
"reported_text"
>
<gl-sprintf
:message=
"__('Reported %{timeAgo} by %{reportedBy}')"
>
<
template
#reportedBy
>
<strong
class=
"error-details-meta-culprit"
>
{{
error
.
culprit
}}
</strong>
</
template
>
<
template
#timeAgo
>
{{
timeFormatted
(
stacktraceData
.
date_received
)
}}
</
template
>
</gl-sprintf>
</div>
</div>
<div
class=
"error-details-actions"
>
<div
class=
"error-details-actions"
>
<div
class=
"d-inline-flex bv-d-sm-down-none"
>
<div
class=
"d-inline-flex bv-d-sm-down-none"
>
...
...
changelogs/unreleased/security-safe-sentry-error-culprit.yml
0 → 100644
View file @
cde5bf83
---
title
:
Escape special chars in Sentry error header
merge_request
:
author
:
type
:
security
spec/frontend/error_tracking/components/error_details_spec.js
View file @
cde5bf83
...
@@ -130,6 +130,28 @@ describe('ErrorDetails', () => {
...
@@ -130,6 +130,28 @@ describe('ErrorDetails', () => {
expect
(
wrapper
.
findAll
(
'
button
'
).
length
).
toBe
(
3
);
expect
(
wrapper
.
findAll
(
'
button
'
).
length
).
toBe
(
3
);
});
});
describe
(
'
unsafe chars for culprit field
'
,
()
=>
{
const
findReportedText
=
()
=>
wrapper
.
find
(
'
[data-qa-selector="reported_text"]
'
);
const
culprit
=
'
<script>console.log("surprise!")</script>
'
;
beforeEach
(()
=>
{
store
.
state
.
details
.
loadingStacktrace
=
false
;
wrapper
.
setData
({
error
:
{
culprit
,
},
});
});
it
(
'
should not convert interpolated text to html entities
'
,
()
=>
{
expect
(
findReportedText
().
findAll
(
'
script
'
).
length
).
toEqual
(
0
);
expect
(
findReportedText
().
findAll
(
'
strong
'
).
length
).
toEqual
(
1
);
});
it
(
'
should render text instead of converting to html entities
'
,
()
=>
{
expect
(
findReportedText
().
text
()).
toContain
(
culprit
);
});
});
describe
(
'
Badges
'
,
()
=>
{
describe
(
'
Badges
'
,
()
=>
{
it
(
'
should show language and error level badges
'
,
()
=>
{
it
(
'
should show language and error level badges
'
,
()
=>
{
wrapper
.
setData
({
wrapper
.
setData
({
...
...
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