mirror of
https://github.com/hoxu/gitstats.git
synced 2026-03-01 18:23:26 +01:00
Remove backticks from author names passed to gnuplot.
Without this, author names containing `touch /tmp/vulnerable` would cause said file to appear after generating statistics for the given repository. This is not an optimal solution. Instead of blacklisting characters we should either whitelist some, or find a safe escape mechanism for gnuplot.
This commit is contained in:
6
gitstats
6
gitstats
@@ -1314,7 +1314,8 @@ plot """
|
||||
plots = []
|
||||
for a in self.authors_to_plot:
|
||||
i = i + 1
|
||||
plots.append("""'lines_of_code_by_author.dat' using 1:%d title "%s" w lines""" % (i, a.replace("\"", "\\\"")))
|
||||
author = a.replace("\"", "\\\"").replace("`", "")
|
||||
plots.append("""'lines_of_code_by_author.dat' using 1:%d title "%s" w lines""" % (i, author))
|
||||
f.write(", ".join(plots))
|
||||
f.write('\n')
|
||||
|
||||
@@ -1341,7 +1342,8 @@ plot """
|
||||
plots = []
|
||||
for a in self.authors_to_plot:
|
||||
i = i + 1
|
||||
plots.append("""'commits_by_author.dat' using 1:%d title "%s" w lines""" % (i, a.replace("\"", "\\\"")))
|
||||
author = a.replace("\"", "\\\"").replace("`", "")
|
||||
plots.append("""'commits_by_author.dat' using 1:%d title "%s" w lines""" % (i, author))
|
||||
f.write(", ".join(plots))
|
||||
f.write('\n')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user