mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 04:36:11 +10:00
Fix: CI token removal regression from build trace
This commit is contained in:
committed by
Robert Speicher
parent
9a26120c71
commit
38b0bd31e3
+10
-7
@@ -145,12 +145,6 @@ module Ci
|
||||
html ||= ''
|
||||
end
|
||||
|
||||
def trace
|
||||
if project && read_attribute(:trace).present?
|
||||
read_attribute(:trace).gsub(project.token, 'xxxxxx')
|
||||
end
|
||||
end
|
||||
|
||||
def started?
|
||||
!pending? && !canceled? && started_at
|
||||
end
|
||||
@@ -225,7 +219,7 @@ module Ci
|
||||
end
|
||||
end
|
||||
|
||||
def trace
|
||||
def raw_trace
|
||||
if File.exist?(path_to_trace)
|
||||
File.read(path_to_trace)
|
||||
else
|
||||
@@ -234,6 +228,15 @@ module Ci
|
||||
end
|
||||
end
|
||||
|
||||
def trace
|
||||
trace = raw_trace
|
||||
if project && trace.present?
|
||||
trace.gsub(project.token, 'xxxxxx')
|
||||
else
|
||||
trace
|
||||
end
|
||||
end
|
||||
|
||||
def trace=(trace)
|
||||
unless Dir.exists? dir_to_trace
|
||||
FileUtils.mkdir_p dir_to_trace
|
||||
|
||||
@@ -177,6 +177,17 @@ describe Ci::Build do
|
||||
it { is_expected.to include(text) }
|
||||
it { expect(subject.length).to be >= text.length }
|
||||
end
|
||||
|
||||
context 'if build.trace hides token' do
|
||||
let(:token) { 'my_secret_token' }
|
||||
|
||||
before do
|
||||
build.project.update_attributes(token: token)
|
||||
build.update_attributes(trace: token)
|
||||
end
|
||||
|
||||
it { is_expected.to_not include(token) }
|
||||
end
|
||||
end
|
||||
|
||||
describe :timeout do
|
||||
|
||||
Reference in New Issue
Block a user