Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fix: remove WORKFLOW_TRIGGER from safe block list for secrets (#SKY-8222) (#5005)
Celal Zamanoğlucbe40d01bf34
diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.pyindex 1145efa44..e5d38cfdf 100644--- a/skyvern/forge/sdk/workflow/models/block.py+++ b/skyvern/forge/sdk/workflow/models/block.py@@ -326,7 +326,6 @@ class Block(BaseModel, abc.ABC):is_safe_block_for_secrets = self.block_type in [BlockType.CODE,BlockType.HTTP_REQUEST,- BlockType.WORKFLOW_TRIGGER,]template = jinja_sandbox_env.from_string(potential_template)@@ -6219,9 +6218,7 @@ class WorkflowTriggerBlock(Block):workflow_run_context: WorkflowRunContext,) -> Any:"""Render a single Jinja2 template string, handling the | json filter marker."""- rendered = self.format_block_parameter_template_from_workflow_run_context(- value, workflow_run_context, force_include_secrets=True- )+ rendered = self.format_block_parameter_template_from_workflow_run_context(value, workflow_run_context)if rendered.startswith(_JSON_TYPE_MARKER) and rendered.endswith(_JSON_TYPE_MARKER):json_str = rendered[len(_JSON_TYPE_MARKER) : -len(_JSON_TYPE_MARKER)]try:@@ -6275,13 +6272,13 @@ class WorkflowTriggerBlock(Block):def format_potential_template_parameters(self, workflow_run_context: WorkflowRunContext) -> None:self.workflow_permanent_id = self.format_block_parameter_template_from_workflow_run_context(- self.workflow_permanent_id, workflow_run_context, force_include_secrets=True+ self.workflow_permanent_id, workflow_run_context)if self.payload:self.payload = self._render_templates_in_payload(self.payload, workflow_run_context)if self.browser_session_id:self.browser_session_id = self.format_block_parameter_template_from_workflow_run_context(- self.browser_session_id, workflow_run_context, force_include_secrets=True+ self.browser_session_id, workflow_run_context)async def execute(diff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.pyindex 17ab75d07..28c47c459 100644--- a/skyvern/forge/sdk/workflow/service.py+++ b/skyvern/forge/sdk/workflow/service.py@@ -1456,7 +1456,15 @@ class WorkflowService:try:start_label, label_to_block, default_next_map = self._build_workflow_graph(dag_blocks)except InvalidWorkflowDefinition as exc:- LOG.error("Workflow graph validation failed", error=str(exc), workflow_id=workflow.workflow_id)+ LOG.error(+ "DAG execution failed: workflow graph validation error",+ workflow_run_id=workflow_run.workflow_run_id,+ workflow_permanent_id=workflow.workflow_permanent_id,+ organization_id=organization.organization_id,+ workflow_id=workflow.workflow_id,+ error=str(exc),+ exc_info=True,+ )workflow_run = await self.mark_workflow_run_as_failed(workflow_run_id=workflow_run.workflow_run_id,failure_reason=str(exc),@@ -1475,8 +1483,10 @@ class WorkflowService:block = label_to_block.get(current_label)if not block:LOG.error(- "Unable to find block with label in workflow graph",+ "DAG execution failed: block label not found in workflow graph",workflow_run_id=workflow_run.workflow_run_id,+ workflow_permanent_id=workflow.workflow_permanent_id,+ organization_id=organization.organization_id,current_label=current_label,)workflow_run = await self.mark_workflow_run_as_failed(@@ -1540,6 +1550,14 @@ class WorkflowService:breakif next_label not in label_to_block:+ LOG.error(+ "DAG execution failed: next block label not found in workflow definition",+ workflow_run_id=workflow_run.workflow_run_id,+ workflow_permanent_id=workflow.workflow_permanent_id,+ organization_id=organization.organization_id,+ current_block_label=block.label,+ missing_block_label=next_label,+ )workflow_run = await self.mark_workflow_run_as_failed(workflow_run_id=workflow_run.workflow_run_id,failure_reason=f"Next block label {next_label} not found in workflow definition",@@ -1547,6 +1565,14 @@ class WorkflowService:breakif next_label in visited_labels:+ LOG.error(+ "DAG execution failed: cycle detected during traversal",+ workflow_run_id=workflow_run.workflow_run_id,+ workflow_permanent_id=workflow.workflow_permanent_id,+ organization_id=organization.organization_id,+ current_block_label=block.label,+ cycle_block_label=next_label,+ )workflow_run = await self.mark_workflow_run_as_failed(workflow_run_id=workflow_run.workflow_run_id,failure_reason=f"Cycle detected while traversing workflow definition at block {next_label}",