[ARVADOS] updated: 1.1.3-178-gbe4418d
Git user
git at public.curoverse.com
Mon Mar 12 11:25:02 EDT 2018
Summary of changes:
services/api/app/models/container_request.rb | 10 ++++++++++
services/api/test/unit/container_request_test.rb | 11 +++++++++++
2 files changed, 21 insertions(+)
via be4418d2b701a98cee784615f5784b3fa2d4a4fb (commit)
from b77abbed6a747e46b98b1e8478158b27ff320151 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit be4418d2b701a98cee784615f5784b3fa2d4a4fb
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Mon Mar 12 11:23:48 2018 -0400
13143: Prohibit identical path in mounts + secret_mounts.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index a1d5722..7b46994 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -29,6 +29,7 @@ class ContainerRequest < ArvadosModel
validates :priority, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1000 }
validate :validate_state_change
validate :check_update_whitelist
+ validate :secret_mounts_key_conflict
before_save :scrub_secret_mounts
after_save :update_priority
after_save :finalize_if_needed
@@ -259,6 +260,15 @@ class ContainerRequest < ArvadosModel
super(permitted)
end
+ def secret_mounts_key_conflict
+ secret_mounts.each do |k, v|
+ if mounts.has_key?(k)
+ errors.add(:secret_mounts, 'conflict with non-secret mounts')
+ return false
+ end
+ end
+ end
+
def scrub_secret_mounts
if self.state == Final
self.secret_mounts = {}
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index 70bcc74..059d72e 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -904,4 +904,15 @@ class ContainerRequestTest < ActiveSupport::TestCase
assert_not_nil cr1.container_uuid
assert_equal cr1.container_uuid, cr2.container_uuid
end
+
+ test "conflicting key in mounts and secret_mounts" do
+ sm = {'/secret/foo' => {'kind' => 'text', 'content' => secret_string}}
+ set_user_from_auth :active
+ cr = create_minimal_req!
+ assert_equal false, cr.update_attributes(state: "Committed",
+ priority: 1,
+ mounts: cr.mounts.merge(sm),
+ secret_mounts: sm)
+ assert_equal [:secret_mounts], cr.errors.messages.keys
+ end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list