diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-23 14:05:21 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-23 14:05:21 -0800 |
commit | 8cc3d37dfd9505277510e83e7d4f4c534aa8d844 (patch) | |
tree | 850a9557fb724515e2efe97e2dfc690e83fe0aa9 | |
parent | c26c1b6c054d5c55795c683658612e0f14ccfa43 (diff) | |
download | gitlab-ci-8cc3d37dfd9505277510e83e7d4f4c534aa8d844.tar.gz |
Dont expose CI project token in build trace
-rw-r--r-- | app/helpers/builds_helper.rb | 4 | ||||
-rw-r--r-- | app/models/build.rb | 6 | ||||
-rw-r--r-- | app/views/builds/show.html.haml | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/app/helpers/builds_helper.rb b/app/helpers/builds_helper.rb index bfe26de..6266174 100644 --- a/app/helpers/builds_helper.rb +++ b/app/helpers/builds_helper.rb @@ -44,8 +44,4 @@ module BuildsHelper 'icon-circle light' end end - - def truncate_project_token(string) - string.gsub(@project.token, 'xxxxxx') - end end diff --git a/app/models/build.rb b/app/models/build.rb index 3fb336d..97e989a 100644 --- a/app/models/build.rb +++ b/app/models/build.rb @@ -145,6 +145,12 @@ class Build < ActiveRecord::Base html ||= '' end + def trace + if project + read_attribute(:trace).gsub(project.token, 'xxxxxx') + end + end + def started? !pending? && !canceled? && started_at end diff --git a/app/views/builds/show.html.haml b/app/views/builds/show.html.haml index 080aec4..d1a0844 100644 --- a/app/views/builds/show.html.haml +++ b/app/views/builds/show.html.haml @@ -69,7 +69,7 @@ %pre.trace#build-trace %code.bash = preserve do - = raw truncate_project_token(@build.trace_html) + = raw @build.trace_html .col-md-3 - if @build.coverage |