diff options
Diffstat (limited to 'src/buildstream')
-rw-r--r-- | src/buildstream/element.py | 5 | ||||
-rw-r--r-- | src/buildstream/plugins/elements/filter.py | 2 | ||||
-rw-r--r-- | src/buildstream/plugins/elements/import.py | 2 | ||||
-rw-r--r-- | src/buildstream/plugins/elements/junction.py | 1 | ||||
-rw-r--r-- | src/buildstream/plugins/elements/stack.py | 1 |
5 files changed, 11 insertions, 0 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index fa4f63bff..16f1fdfbf 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -185,6 +185,8 @@ class Element(Plugin): *Since: 1.4* """ + BST_ALLOW_SHELL = True + def __init__(self, context, project, meta, plugin_conf): self.__cache_key_dict = None # Dict for cache key calculation @@ -1957,6 +1959,9 @@ class Element(Plugin): def _shell(self, scope=None, directory=None, *, mounts=None, isolate=False, prompt=None, command=None, usebuildtree=False): + if scope == Scope.BUILD and self.BST_ALLOW_SHELL == False: + raise ElementError("{} does not allow build shell access".format(self)) + with self._prepare_sandbox(scope, directory, shell=True, usebuildtree=usebuildtree) as sandbox: environment = self.get_environment() environment = copy.copy(environment) diff --git a/src/buildstream/plugins/elements/filter.py b/src/buildstream/plugins/elements/filter.py index 45847e685..7f786a497 100644 --- a/src/buildstream/plugins/elements/filter.py +++ b/src/buildstream/plugins/elements/filter.py @@ -166,6 +166,8 @@ class FilterElement(Element): # Filter elements do not run any commands BST_RUN_COMMANDS = False + BST_ALLOW_SHELL = False + def configure(self, node): self.node_validate(node, [ 'include', 'exclude', 'include-orphans' diff --git a/src/buildstream/plugins/elements/import.py b/src/buildstream/plugins/elements/import.py index 61e353dbc..3885fa314 100644 --- a/src/buildstream/plugins/elements/import.py +++ b/src/buildstream/plugins/elements/import.py @@ -44,6 +44,8 @@ class ImportElement(Element): # Import elements do not run any commands BST_RUN_COMMANDS = False + BST_ALLOW_SHELL = False + def configure(self, node): self.node_validate(node, [ 'source', 'target' diff --git a/src/buildstream/plugins/elements/junction.py b/src/buildstream/plugins/elements/junction.py index 4222de360..d3f8cf5ff 100644 --- a/src/buildstream/plugins/elements/junction.py +++ b/src/buildstream/plugins/elements/junction.py @@ -173,6 +173,7 @@ class JunctionElement(Element): # Junctions are not allowed any dependencies BST_FORBID_BDEPENDS = True BST_FORBID_RDEPENDS = True + BST_ALLOW_SHELL = False def configure(self, node): self.path = self.node_get_member(node, str, 'path', default='') diff --git a/src/buildstream/plugins/elements/stack.py b/src/buildstream/plugins/elements/stack.py index 97517ca48..e4eba2c86 100644 --- a/src/buildstream/plugins/elements/stack.py +++ b/src/buildstream/plugins/elements/stack.py @@ -32,6 +32,7 @@ class StackElement(Element): # This plugin has been modified to avoid the use of Sandbox.get_directory BST_VIRTUAL_DIRECTORY = True + BST_ALLOW_SHELL = False def configure(self, node): pass |