summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-08-06 16:45:02 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2015-08-19 17:33:18 +0100
commit85f1cd2bdcfef93f8e843c735742150bfa199856 (patch)
tree9c8bd651afdded72c2460ccd117e567bd8247662
parentaab30f1c979b863cb38ac1140f1f35cb7f0bdafc (diff)
downloadgitlab-ci-85f1cd2bdcfef93f8e843c735742150bfa199856.tar.gz
Require the variable key to be set and uniquevariable-fix
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/variable.rb3
2 files changed, 4 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index a7c9289..1b6ad24 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,7 @@ v7.14.0 (unreleased)
- Added support for CI skipped status
- Fix broken yaml error saving
- Rename type(s) to stage(s)
+ - Require variable keys to be not-empty and unique
v7.13.1
- Fix: user could steal specific runner
diff --git a/app/models/variable.rb b/app/models/variable.rb
index b40fcbf..559b9f2 100644
--- a/app/models/variable.rb
+++ b/app/models/variable.rb
@@ -14,5 +14,8 @@
class Variable < ActiveRecord::Base
belongs_to :project
+ validates_presence_of :key
+ validates_uniqueness_of :key
+
attr_encrypted :value, mode: :per_attribute_iv_and_salt, key: GitlabCi::Application.secrets.db_key_base
end