summaryrefslogtreecommitdiff
path: root/lib/ci
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-19 12:38:03 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-09-19 12:38:10 +0200
commitb51ededc5fef05f94a632aa7651b5a1f7395bd4e (patch)
tree74a4e49d7c005d67823ec206c65ab75fed5e62d6 /lib/ci
parent0ca43b1b86edea69656582b2a8febb0d41f7ef01 (diff)
downloadgitlab-ce-b51ededc5fef05f94a632aa7651b5a1f7395bd4e.tar.gz
Don't leak build tokens in build logs
Diffstat (limited to 'lib/ci')
-rw-r--r--lib/ci/mask_secret.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ci/mask_secret.rb b/lib/ci/mask_secret.rb
new file mode 100644
index 00000000000..3da04edde70
--- /dev/null
+++ b/lib/ci/mask_secret.rb
@@ -0,0 +1,9 @@
+module Ci::MaskSecret
+ class << self
+ def mask(value, token)
+ return value unless value.present? && token.present?
+
+ value.gsub(token, 'x' * token.length)
+ end
+ end
+end