T09 · Insecure Skill Coding Practices
- Location
scripts/n8n_tester.py:187- Finding
Misleading Dry-Run Operation Executes the Workflow Against the Configured n8n Instance
- Content
View full analysis
Vulnerability Details
File Location:
scripts/n8n_tester.py, lines 187-199
Vulnerability Type: Unsafe test implementation with unintended external side effects
Risk Level: MediumComplete Code Snippet
python def dry_run(self, workflow_id: str, test_data: Dict = None, test_data_file: str = None) -> Dict: """Execute workflow with test data""" # Load test data if from file if test_data_file: with open(test_data_file, 'r') as f: test_data = json.load(f) print(f"Running workflow {workflow_id} with test data...") # Execute workflow execution_result = self.client.execute_workflow(workflow_id, data=test_data) execution_id = execution_result.get('data', {}).get('executionId')The invoked client method also performs a real API request:
python def execute_workflow(self, workflow_id: str, data: Dict = None) -> Dict: """Manually trigger workflow execution""" payload = {'workflowId': workflow_id} if data: payload['data'] = data return self._request('POST', f'workflows/{workflow_id}/execute', json=payload)Technical Analysis
The operation is exposed as a “dry-run,” but it does not simulate, isolate, mock, or otherwise suppress workflow side effects. It calls
execute_workflow, which sends a real authenticatedPOSTrequest to the configured n8n instance and initiates the selected workflow.This behavior is especially dangerous because the documentation recommends using dry-run testing before activation and describes it as testing with sample or mock data. An operator may therefore reasonably expect that the command cannot affect production systems. In practice, any nodes reached by the workflow can perform their normal actions, including:
- Sending email or chat messages.
- Creating or modifying database records.
- Charging or interacting with payment systems.
- Posting to external services.
- Invoking webhooks and third-party APIs.
- Deleting or altering ...[truncated 1900 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not describe real execution as a dry-run. Rename the current operation to an explicit name such as
execute-test-dataif real execution is intentional. - Implement genuine isolation. A dry-run should clone the workflow into a dedicated test project or instance, replace side-effecting nodes with mocks, and use test-only credentials.
- Require an explicit opt-in for real execution. Add a flag such as
--allow-real-executionand display the destination n8n URL and workflow identifier before sending the request. - Protect production instances. Refuse dry-run operations against production URLs unless a separate override is supplied. Prefer a dedicated
N8N_TEST_BASE_URLand test API key. - Add node-level safety checks. Inspect the workflow before execution and block or prominently warn about email, payment, database-write, HTTP request, command, deletion, and other side-effecting nodes.
- Use least-privilege test credentials. Test workflows should not inherit production credentials and should only access sandbox accounts and disposable datasets.
- Correct the documentation. Clearly state that the existing command initiates a real workflow execution and may cause external side effects. Remove claims that imply mock execution until actual simulation exists.
- Add regression tests. Verify that the dry-run path cannot call the production execution endpoint and that side-effecting integrations are mocked or rejected.
- Do not describe real execution as a dry-run. Rename the current operation to an explicit name such as
