- Location
- scripts/deploy_open_autoglm.py:47
- Finding
- Automatic Retrieval and Execution of Unpinned Upstream Code<![CDATA[
## Vulnerability Details
**File Location**: `scripts/clone_or_update_open_autoglm.py:7, 27-42`; `scripts/deploy_open_autoglm.py:47-50, 94-101`
**Vulnerability Type**: Unpinned remote payload retrieval and execution
**Risk Level**: Medium
### Vulnerable Code
```python
# scripts/clone_or_update_open_autoglm.py
REPO_URL = 'https://github.com/zai-org/Open-AutoGLM.git'
if (target_dir / '.git').exists():
print(f'[info] repo already exists, updating: {target_dir}')
pull = run([
'git', '-C', str(target_dir),
'-c', 'http.version=HTTP/1.1',
'pull', '--ff-only'
])
if pull.returncode == 0:
return 0
print('[warn] git pull failed, trying git fetch --all --prune as fallback')
fetch = run([
'git', '-C', str(target_dir),
'-c', 'http.version=HTTP/1.1',
'fetch', '--all', '--prune'
])
print(f'[info] cloning repo to: {target_dir}')
clone = run([
'git', '-c', 'http.version=HTTP/1.1',
'clone', REPO_URL, str(target_dir)
])
```
```python
# scripts/deploy_open_autoglm.py
clone_script = root_dir / 'scripts' / 'clone_or_update_open_autoglm.py'
clone = run([sys.executable, str(clone_script), str(repo_dir)])
if clone.returncode != 0:
return clone.returncode
upgrade_pip = run([
str(py), '-m', 'pip', 'install', '--upgrade', 'pip'
], cwd=str(repo_dir))
if upgrade_pip.returncode != 0:
return upgrade_pip.returncode
install_req = run([
str(py), '-m', 'pip', 'install', '-r', 'requirements.txt'
], cwd=str(repo_dir))
if install_req.returncode != 0:
return install_req.returncode
install_editable = run([
str(py), '-m', 'pip', 'install', '-e', '.'
], cwd=str(repo_dir))
if install_editable.returncode != 0:
return install_editable.returncode
```
### Technical Analysis
The deployment flow clones or updates the current branch of an external GitHub repository without pinning it to a reviewed commit hash or verifying a signed release. It then immediately trusts the retri
...[truncated 1942 chars]
- Remediation
- <![CDATA[
## Remediation Suggestions
1. Pin the upstream repository to a reviewed commit hash or immutable signed release tag.
2. After fetching, verify that `HEAD` matches the expected commit before installing or executing anything.
3. Prefer signed releases and validate Git signatures against an allowlisted maintainer key.
4. Replace unconstrained requirements with a lock file containing exact versions and cryptographic hashes.
5. Use `pip install --require-hashes` where supported.
6. Do not automatically update an existing deployment immediately before execution. Present the proposed revision and require explicit approval for revision changes.
7. Run build and installation operations in an isolated environment without model credentials or unnecessary device access.
8. Review packaging metadata and dependency changes before allowing a newly retrieved revision to execute.
]]>