Commit f8c18c42 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'philipcunningham-add-missing-validation-225406' into 'master'

Validate for presence of dast_site_profile_id

See merge request gitlab-org/gitlab!57309
parents fc25343d b713c947
......@@ -18,6 +18,8 @@ module Dast
key: Settings.attr_encrypted_db_key_base_32,
encode: false # No need to encode for binary column https://github.com/attr-encrypted/attr_encrypted#the-encode-encode_iv-encode_salt-and-default_encoding-options
validates :dast_site_profile_id, presence: true
# Secret variables must be masked to prevent them being readable in CI jobs
validates :masked, inclusion: { in: [true] }
validates :variable_type, inclusion: { in: ['env_var'] }
......
......@@ -27,6 +27,7 @@ RSpec.describe Dast::SiteProfileSecretVariable, type: :model do
it { is_expected.to be_valid }
it { is_expected.to include_module(Ci::Maskable) }
it { is_expected.to include_module(Ci::HasVariable) }
it { is_expected.to validate_presence_of(:dast_site_profile_id) }
it { is_expected.to validate_inclusion_of(:masked).in_array([true]) }
it { is_expected.to validate_uniqueness_of(:key).scoped_to(:dast_site_profile_id).with_message(/\(\w+\) has already been taken/) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment