Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(security): enforce disabled flag on blocks in graph validation (#12059)

Otto062fe1aa7092
diff --git a/autogpt_platform/backend/backend/data/graph.py b/autogpt_platform/backend/backend/data/graph.py
index 0dc3eea887..2433a5d270 100644
--- a/autogpt_platform/backend/backend/data/graph.py
+++ b/autogpt_platform/backend/backend/data/graph.py
@@ -743,6 +743,11 @@ class GraphModel(Graph, GraphMeta):
# For invalid blocks, we still raise immediately as this is a structural issue
raise ValueError(f"Invalid block {node.block_id} for node #{node.id}")
+ if block.disabled:
+ raise ValueError(
+ f"Block {node.block_id} is disabled and cannot be used in graphs"
+ )
+
node_input_mask = (
nodes_input_masks.get(node.id, {}) if nodes_input_masks else {}
)
diff --git a/autogpt_platform/backend/backend/executor/manager.py b/autogpt_platform/backend/backend/executor/manager.py
index 8362dae828..7304653811 100644
--- a/autogpt_platform/backend/backend/executor/manager.py
+++ b/autogpt_platform/backend/backend/executor/manager.py
@@ -213,6 +213,9 @@ async def execute_node(
block_name=node_block.name,
)
+ if node_block.disabled:
+ raise ValueError(f"Block {node_block.id} is disabled and cannot be executed")
+
# Sanity check: validate the execution input.
input_data, error = validate_exec(node, data.inputs, resolve_input=False)
if input_data is None: