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
a45db29d
Commit
a45db29d
authored
Nov 05, 2019
by
Fabio Pitino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render HTML tags in job log
parent
f2876fb0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
changelogs/unreleased/render-html-tags-in-job-log.yml
changelogs/unreleased/render-html-tags-in-job-log.yml
+5
-0
lib/gitlab/ci/ansi2json/converter.rb
lib/gitlab/ci/ansi2json/converter.rb
+1
-3
spec/lib/gitlab/ci/ansi2json_spec.rb
spec/lib/gitlab/ci/ansi2json_spec.rb
+4
-4
No files found.
changelogs/unreleased/render-html-tags-in-job-log.yml
0 → 100644
View file @
a45db29d
---
title
:
Do not escape HTML tags in Ansi2json as they are escaped in the frontend
merge_request
:
19610
author
:
type
:
fixed
lib/gitlab/ci/ansi2json/converter.rb
View file @
a45db29d
...
...
@@ -66,14 +66,12 @@ module Gitlab
elsif
scan_token
(
scanner
,
/\e(([@-_])(.*?)?)?$/
)
# stop scanning
scanner
.
terminate
elsif
scan_token
(
scanner
,
/</
)
@state
.
current_line
<<
'<'
elsif
scan_token
(
scanner
,
/\r?\n/
)
flush_current_line
elsif
scan_token
(
scanner
,
/\r/
)
# drop last line
@state
.
current_line
.
clear!
elsif
scan_token
(
scanner
,
/.[^\e
<
\r\ns]*/m
)
elsif
scan_token
(
scanner
,
/.[^\e\r\ns]*/m
)
# this is a join from all previous tokens and first letters
# it always matches at least one character `.`
# it matches everything that is not start of:
...
...
spec/lib/gitlab/ci/ansi2json_spec.rb
View file @
a45db29d
...
...
@@ -224,17 +224,17 @@ describe Gitlab::Ci::Ansi2json do
end
end
it
'pr
events XSS injection
'
do
trace
=
"
#{
section_start
}
section_end:1:2<
script>alert('XSS Hack!');</script
>
#{
section_end
}
"
it
'pr
ints HTML tags as is
'
do
trace
=
"
#{
section_start
}
section_end:1:2<
div>hello</div
>
#{
section_end
}
"
expect
(
convert_json
(
trace
)).
to
eq
([
{
offset:
0
,
content:
[{
text:
"section_end:1:2
<script>alert('XSS Hack!');</script
>"
}],
content:
[{
text:
"section_end:1:2
<div>hello</div
>"
}],
section:
'prepare-script'
,
section_header:
true
},
{
offset:
9
5
,
offset:
7
5
,
content:
[],
section:
'prepare-script'
,
section_duration:
'01:03'
...
...
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