deb-murano/murano
Alexander Tivelkov f18661b586 Fix for cross-tenant package and class isolation
The database constraints which were present were enforcing the global
uniqueness of package FQNs and the names of classes defined in them.
This behavior was not correct, as the uniqueness should be enforced per
tenant, so the same package may be uploaded into two isolated tenants
without affecting each other.

This behavior lead to a very serious security issue: any tenant could
upload a package, leave it private and thus block all other tenants of
the cloud from uploading the package with the same name or even other
packages which contain at least one class in common with it. This could
be used to intentionally block all the operations of Murano on any
public environments.

This fix modifies the package name constraint to be unique only in
combination with owner_id, i.e. makes packages unique per tenant. Also
it removes the class name uniquness check from database (as there is no
cross-DB way to check it in a proper way) and adds a check method in
db.api module instead.

As the packages may be made public, this introduces a potential
collision: if the user owns some package, and there is a public package
with the same fully-qualified-name (or defining same class(es)) then the
class loader of the engine will have to choise between these packages
and/or classes defined in them.
To resolve this collision this commit adds a logic to fetch all the
patching packages and then pick the best match. Packages owned by the
current tenant are the most preferred, then the engine will pick public
packages, and non-owned non-public packages are the least preferred
(there may be no such packages now, they may appear when we add other
ways of package sharing).

Closes-bug: #1440094
Change-Id: I5c9b49642dfb6e955cf0c98b42f418da3b82060a
2015-04-14 20:58:49 +03:00
..
api Fix for cross-tenant package and class isolation 2015-04-14 20:58:49 +03:00
cmd Use oslo.i18n for translation 2015-02-19 18:51:22 +03:00
common Fix for cross-tenant package and class isolation 2015-04-14 20:58:49 +03:00
db Fix for cross-tenant package and class isolation 2015-04-14 20:58:49 +03:00
dsl Safely encode yaql expressions to support unicode expressions 2015-03-31 09:34:01 +00:00
engine Fix for cross-tenant package and class isolation 2015-04-14 20:58:49 +03:00
locale Rename muranoapi to murano 2014-05-27 15:14:44 +04:00
openstack Use oslo.i18n for translation 2015-02-19 18:51:22 +03:00
packages Fix error with package tags type 2015-03-13 11:43:40 +03:00
policy Policy enforcement 'services' relationship 2015-04-07 13:28:13 +02:00
services Fixed 500 error in get_result API handler 2015-03-26 15:59:19 +00:00
tests Fix for cross-tenant package and class isolation 2015-04-14 20:58:49 +03:00
__init__.py Extract version definition to a separate file 2014-11-10 13:02:56 +04:00
context.py Update API policy 2015-03-02 15:28:14 +03:00
opts.py fix typo 2015-03-09 16:12:11 +09:00
utils.py Functional tests for environment template functionality 2015-03-18 09:08:18 +01:00
version.py Extract version definition to a separate file 2014-11-10 13:02:56 +04:00