T08 · Insecure Dependencies
- Location
scripts/submit_dataify_facebook_events.py:9- Finding
Unverified External Local Module Executes with API Token Access
- Content
View full analysis
Vulnerability Details
File Location:
scripts/submit_dataify_facebook_events.py, lines 9-13 and 200
Vulnerability Type: Unsafe import from an unaudited, externally writable sibling directory
Risk Level: HighVulnerable Code
python TASK_RUNTIME_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "dataify-task-operations", "scripts")) if TASK_RUNTIME_DIR not in sys.path: sys.path.insert(0, TASK_RUNTIME_DIR) from task_runtime import complete_taskThe imported function later receives the API token:
python if not args.no_wait: try: final_result = complete_task(task_id, api_token, args.wait_timeout) except RuntimeError as exc: print(str(exc), file=sys.stderr) return 1 print(json.dumps(final_result, ensure_ascii=False, indent=2))Technical Analysis
The script constructs a path outside the audited project, gives that path the highest Python import priority by inserting it at index zero of
sys.path, and importstask_runtimefrom it. The referenceddataify-task-operationscomponent is not included in the audited artifact, so its provenance, integrity, permissions, and behavior cannot be verified.Python executes a module's top-level code during import. Therefore, a malicious or compromised
task_runtime.pycan execute arbitrary code as soon as this script starts. In addition, the importedcomplete_taskfunction is explicitly passed the user'sDATAIFY_API_TOKEN, giving the external component direct access to a sensitive credential.This exceeds a safely auditable privilege boundary: asynchronous task completion may require a runtime component, but that component should be packaged, pinned, and integrity-verified rather than dynamically imported from an unaudited sibling directory.
Attack Path
- An attacker obtains write access to the expected sibling path: `../../dataify-task-operations/script ...[truncated 1150 chars]
- Remediation
View remediation
Remediation Suggestions
- Package the task runtime within the audited Skill or install it as a normal, versioned Python dependency.
- Remove the
sys.path.insert(0, ...)modification and use an explicit package import. - Pin the dependency to a reviewed version and verify its integrity with a cryptographic hash or signed release.
- Ensure the dependency installation directory is not writable by less-privileged users.
- Avoid passing the raw API token to a broad runtime interface. Expose only the minimum operation required and keep credential handling in a small, reviewed module.
- If an external runtime remains necessary, validate its resolved path and ownership before importing it, and fail closed when verification is unavailable.
- Add automated tests that verify
task_runtimeresolves only to the approved package location.
