T08 · Insecure Dependencies
- Location
scripts/lib/base.sh:247- Finding
Remote executable modules are downloaded through an unauthenticated mirror path and installed as persistent agent extensions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/lib/base.sh:247-278
Related Execution Path:scripts/agents/prime_agent.sh:24-48
Vulnerability Type: Unauthenticated remote executable dependency installation
Risk Level: HighComplete Code Snippet
bash # scripts/lib/base.sh:247-278 ov_sync_shared_files() { local persist_src="$1" [[ -z "$persist_src" ]] && return 1 # Already synced — nothing to do if [[ -d "$persist_src/shared" && -f "$persist_src/shared/ov-http.mjs" ]]; then return 0 fi local _sha; _sha=$(ov_plugin_upstream_sha 2>/dev/null || echo "") [[ -z "$_sha" ]] && return 0 local _shared_dir="$persist_src/shared" mkdir -p "$_shared_dir" local _f _url _src_paths=( "agent-plugins/servers/shared" "examples/claude-code-memory-plugin/scripts/shared" ) local _needed="ov-http.mjs capture-utils.mjs plugin-config.mjs config-schema.mjs credentials.mjs debug-log.mjs input-filters.mjs mcp-proxy-config.mjs mcp-proxy-core.mjs pending-queue.mjs profile-inject.mjs recall-compress-core.mjs recall-core.mjs retryable.mjs session-model.mjs uri-guard.mjs workspace-identity.mjs workspace-peer.mjs workspace-config.mjs workspace-registry.mjs agent-hook-runtime.mjs async-writer.mjs batch-send.mjs doctor-core.mjs setup-wizard.mjs" for _f in $_needed; do [[ -f "$_shared_dir/$_f" ]] && continue for _src in "${_src_paths[@]}"; do for _base in "${GH_RAW_MIRRORS[@]}"; do _url="${_base}/${OV_PLUGIN_REPO_PATH}/${_sha}/${_src}/${_f}" if "$OV_CURL_BIN" -fsS --connect-timeout 10 --max-time 25 "$_url" -o "$_shared_dir/$_f" 2>/dev/null; then break fi done [[ -f "$_shared_dir/$_f" ]] && break done done log_ok "shared/ files synced (${_sha:0:7})" }The downloaded files subsequently enter an executable extension:
bash # scripts/agents/prime_agent.sh:24-48 ov_plugin_provision "pi-coding-agent-extension" "$persist_src" || return 1 if [[ "${DRY_RUN:-false}" ! ...[truncated 3708 chars]- Remediation
View remediation
Remediation Suggestions
- Route every shared-module download through the same verified provisioning mechanism used by
_ov_download_files. - Obtain the expected repository tree and blob hashes from an authenticated source, then verify each downloaded file before moving it into the extension directory.
- Download the complete set into a newly created staging directory with restrictive permissions.
- Reject the entire update if any file is missing, has an unexpected path, or fails hash verification.
- Atomically replace the persistent extension only after all files pass validation.
- Do not treat a mirror-provided commit identifier and mirror-provided content as independent trust anchors.
- Record the verified commit and per-file hashes in installation metadata and validate them before copying the extension into a live agent directory.
- Make
ov_sync_shared_filesreturn failure when required modules cannot be securely obtained instead of continuing with a partial extension.
- Route every shared-module download through the same verified provisioning mechanism used by
