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
fed0f156
Commit
fed0f156
authored
May 29, 2020
by
Olena Horal-Koretska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stored XSS on the Error Tracking page
parent
3871933b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
41 deletions
+40
-41
app/assets/javascripts/error_tracking/components/stacktrace_entry.vue
...avascripts/error_tracking/components/stacktrace_entry.vue
+23
-34
changelogs/unreleased/security-xss-error-tracking.yml
changelogs/unreleased/security-xss-error-tracking.yml
+5
-0
spec/frontend/error_tracking/components/stacktrace_entry_spec.js
...ontend/error_tracking/components/stacktrace_entry_spec.js
+12
-7
No files found.
app/assets/javascripts/error_tracking/components/stacktrace_entry.vue
View file @
fed0f156
<
script
>
import
{
escape
}
from
'
lodash
'
;
import
{
GlTooltip
}
from
'
@gitlab/ui
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
GlTooltip
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
FileIcon
from
'
~/vue_shared/components/file_icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
...
...
@@ -11,6 +9,7 @@ export default {
ClipboardButton
,
FileIcon
,
Icon
,
GlSprintf
,
},
directives
:
{
GlTooltip
,
...
...
@@ -57,36 +56,6 @@ export default {
collapseIcon
()
{
return
this
.
isExpanded
?
'
chevron-down
'
:
'
chevron-right
'
;
},
errorFnText
()
{
return
this
.
errorFn
?
sprintf
(
__
(
`%{spanStart}in%{spanEnd} %{errorFn}`
),
{
errorFn
:
`<strong>
${
escape
(
this
.
errorFn
)}
</strong>`
,
spanStart
:
`<span class="text-tertiary">`
,
spanEnd
:
`</span>`
,
},
false
,
)
:
''
;
},
errorPositionText
()
{
return
this
.
errorLine
?
sprintf
(
__
(
`%{spanStart}at line%{spanEnd} %{errorLine}%{errorColumn}`
),
{
errorLine
:
`<strong>
${
this
.
errorLine
}
</strong>`
,
errorColumn
:
this
.
errorColumn
?
`:<strong>
${
this
.
errorColumn
}
</strong>`
:
``
,
spanStart
:
`<span class="text-tertiary">`
,
spanEnd
:
`</span>`
,
},
false
,
)
:
''
;
},
errorInfo
()
{
return
`
${
this
.
errorFnText
}
${
this
.
errorPositionText
}
`
;
},
},
methods
:
{
isHighlighted
(
lineNum
)
{
...
...
@@ -132,7 +101,27 @@ export default {
:text=
"filePath"
css-class=
"btn-default btn-transparent btn-clipboard position-static"
/>
<span
v-html=
"errorInfo"
></span>
<gl-sprintf
v-if=
"errorFn"
:message=
"__('%
{spanStart}in%{spanEnd} %{errorFn}')">
<template
#span
="
{content}">
<span
class=
"gl-text-gray-400"
>
{{
content
}}
</span>
</
template
>
<
template
#errorFn
>
<strong>
{{
errorFn
}}
</strong>
</
template
>
</gl-sprintf>
<gl-sprintf
:message=
"__('%{spanStart}at line%{spanEnd} %{errorLine}%{errorColumn}')"
>
<
template
#span=
"{content}"
>
<span
class=
"gl-text-gray-400"
>
{{
content
}}
</span>
</
template
>
<
template
#errorLine
>
<strong>
{{
errorLine
}}
</strong>
</
template
>
<
template
#errorColumn
>
<strong
v-if=
"errorColumn"
>
:
{{
errorColumn
}}
</strong>
</
template
>
</gl-sprintf>
</div>
</div>
...
...
changelogs/unreleased/security-xss-error-tracking.yml
0 → 100644
View file @
fed0f156
---
title
:
Stored XSS on the Error Tracking page
merge_request
:
author
:
type
:
security
spec/frontend/error_tracking/components/stacktrace_entry_spec.js
View file @
fed0f156
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlSprintf
}
from
'
@gitlab/ui
'
;
import
StackTraceEntry
from
'
~/error_tracking/components/stacktrace_entry.vue
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
FileIcon
from
'
~/vue_shared/components/file_icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
trimText
}
from
'
helpers/text_helper
'
;
describe
(
'
Stacktrace Entry
'
,
()
=>
{
let
wrapper
;
...
...
@@ -21,6 +23,9 @@ describe('Stacktrace Entry', () => {
errorLine
:
24
,
...
props
,
},
stubs
:
{
GlSprintf
,
},
});
}
...
...
@@ -53,7 +58,7 @@ describe('Stacktrace Entry', () => {
const
extraInfo
=
{
errorLine
:
34
,
errorFn
:
'
errorFn
'
,
errorColumn
:
77
};
mountComponent
({
expanded
:
false
,
lines
:
[],
...
extraInfo
});
expect
(
wrapper
.
find
(
Icon
).
exists
()).
toBe
(
false
);
expect
(
findFileHeaderContent
(
)).
toContain
(
expect
(
trimText
(
findFileHeaderContent
()
)).
toContain
(
`in
${
extraInfo
.
errorFn
}
at line
${
extraInfo
.
errorLine
}
:
${
extraInfo
.
errorColumn
}
`
,
);
});
...
...
@@ -61,17 +66,17 @@ describe('Stacktrace Entry', () => {
it
(
'
should render only lineNo:columnNO when there is no errorFn
'
,
()
=>
{
const
extraInfo
=
{
errorLine
:
34
,
errorFn
:
null
,
errorColumn
:
77
};
mountComponent
({
expanded
:
false
,
lines
:
[],
...
extraInfo
});
expect
(
findFileHeaderContent
()).
not
.
toContain
(
`in
${
extraInfo
.
errorFn
}
`
);
expect
(
findFileHeaderContent
()).
toContain
(
`
${
extraInfo
.
errorLine
}
:
${
extraInfo
.
errorColumn
}
`
);
const
fileHeaderContent
=
trimText
(
findFileHeaderContent
());
expect
(
fileHeaderContent
).
not
.
toContain
(
`in
${
extraInfo
.
errorFn
}
`
);
expect
(
fileHeaderContent
).
toContain
(
`
${
extraInfo
.
errorLine
}
:
${
extraInfo
.
errorColumn
}
`
);
});
it
(
'
should render only lineNo when there is no errorColumn
'
,
()
=>
{
const
extraInfo
=
{
errorLine
:
34
,
errorFn
:
'
errorFn
'
,
errorColumn
:
null
};
mountComponent
({
expanded
:
false
,
lines
:
[],
...
extraInfo
});
expect
(
findFileHeaderContent
()).
toContain
(
`in
${
extraInfo
.
errorFn
}
at line
${
extraInfo
.
errorLine
}
`
,
);
expect
(
findFileHeaderContent
()).
not
.
toContain
(
`:
${
extraInfo
.
errorColumn
}
`
);
const
fileHeaderContent
=
trimText
(
findFileHeaderContent
());
expect
(
fileHeaderContent
).
toContain
(
`in
${
extraInfo
.
errorFn
}
at line
${
extraInfo
.
errorLine
}
`
);
expect
(
fileHeaderContent
).
not
.
toContain
(
`:
${
extraInfo
.
errorColumn
}
`
);
});
});
});
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