BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
941a2d27
Commit
941a2d27
authored
Sep 06, 2017
by
Jacob Schatz
Committed by
Robert Speicher
Sep 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'fix-comment-reflection' into 'security-9-5'
Fix Live Comment XSS Vulnerability See merge request gitlab/gitlabhq!2183
parent
bc10afb6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
notes.js
app/assets/javascripts/notes.js
+7
-4
notes_spec.js
spec/javascripts/notes_spec.js
+14
-0
No files found.
app/assets/javascripts/notes.js
View file @
941a2d27
...
...
@@ -1272,16 +1272,16 @@ export default class Notes {
`<li id="
${
uniqueId
}
" class="note being-posted fade-in-half timeline-entry">
<div class="timeline-entry-inner">
<div class="timeline-icon">
<a href="/
${
currentUsername
}
">
<a href="/
${
_
.
escape
(
currentUsername
)
}
">
<img class="avatar s40" src="
${
currentUserAvatar
}
" />
</a>
</div>
<div class="timeline-content
${
discussionClass
}
">
<div class="note-header">
<div class="note-header-info">
<a href="/
${
currentUsername
}
">
<span class="hidden-xs">
${
currentUserFullname
}
</span>
<span class="note-headline-light">
@
${
currentUsername
}
</span>
<a href="/
${
_
.
escape
(
currentUsername
)
}
">
<span class="hidden-xs">
${
_
.
escape
(
currentUsername
)
}
</span>
<span class="note-headline-light">
${
_
.
escape
(
currentUsername
)
}
</span>
</a>
</div>
</div>
...
...
@@ -1295,6 +1295,9 @@ export default class Notes {
</li>`
);
$tempNote
.
find
(
'.hidden-xs'
).
text
(
_
.
escape
(
currentUserFullname
));
$tempNote
.
find
(
'.note-headline-light'
).
text
(
`@
${
_
.
escape
(
currentUsername
)}
`
);
return
$tempNote
;
}
...
...
spec/javascripts/notes_spec.js
View file @
941a2d27
...
...
@@ -770,6 +770,20 @@ import '~/notes';
expect
(
$tempNote
.
prop
(
'nodeName'
)).
toEqual
(
'LI'
);
expect
(
$tempNote
.
find
(
'.timeline-content'
).
hasClass
(
'discussion'
)).
toBeTruthy
();
});
it
(
'should return a escaped user name'
,
()
=>
{
const
currentUserFullnameXSS
=
'Foo <script>alert("XSS")</script>'
;
const
$tempNote
=
this
.
notes
.
createPlaceholderNote
({
formContent
:
sampleComment
,
uniqueId
,
isDiscussionNote
:
false
,
currentUsername
,
currentUserFullname
:
currentUserFullnameXSS
,
currentUserAvatar
,
});
const
$tempNoteHeader
=
$tempNote
.
find
(
'.note-header'
);
expect
(
$tempNoteHeader
.
find
(
'.hidden-xs'
).
text
().
trim
()).
toEqual
(
'Foo <script>alert("XSS")</script>'
);
});
});
describe
(
'createPlaceholderSystemNote'
,
()
=>
{
...
...
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