murano/murano/common
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
..
helpers Update from global requirements 2015-02-25 16:09:22 +03:00
messaging Resolve H305 pep8 issue 2015-02-05 12:10:22 +03:00
__init__.py Rename muranoapi to murano 2014-05-27 15:14:44 +04:00
auth_utils.py Nova Network support 2015-04-08 13:09:21 +03:00
config.py Initial implementation of Plugable Classes 2015-03-19 14:06:24 +00:00
consts.py Rename muranoapi to murano 2014-05-27 15:14:44 +04:00
engine.py Fix for cross-tenant package and class isolation 2015-04-14 20:58:49 +03:00
exceptions.py Update from global requirements 2015-02-25 16:09:22 +03:00
i18n.py Use oslo.i18n for translation 2015-02-19 18:51:22 +03:00
plugin_loader.py Initial implementation of Plugable Classes 2015-03-19 14:06:24 +00:00
policy.py Update API policy 2015-03-02 15:28:14 +03:00
rpc.py Fixes silent deletion of environments 2014-08-19 12:52:52 +04:00
server.py Adds API to obtain action result 2015-03-02 14:08:36 +03:00
statservice.py Use oslo.i18n for translation 2015-02-19 18:51:22 +03:00
utils.py Use oslo.i18n for translation 2015-02-19 18:51:22 +03:00
uuidutils.py Rename muranoapi to murano 2014-05-27 15:14:44 +04:00
wsgi.py Use oslo.i18n for translation 2015-02-19 18:51:22 +03:00
xmlutils.py Update from oslo incubator 2014-12-10 09:29:14 +00:00