dinhanhx / dinhanhx/gpu-friendly-rag
🔒 Security: trust_remote_code=True allows arbitrary code execution from model hub
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Issue
### trust_remote_code=True (rag.py:10-14)
```python
embedding_model = AutoModel.from_pretrained("jinaai/jina-embeddings-v3", trust_remote_code=True)
rerank_model = AutoModelForSequenceClassification.from_pretrained(
"jinaai/jina-reranker-v2-base-multilingual", trust_remote_code=True,
)
```
`trust_remote_code=True` downloads and executes arbitrary Python code from the HuggingFace model hub. If the model repo is compromised, this becomes a remote code execution vector.
**Mitigation:** Pin the model revision hash:
```python
AutoModel.from_pretrained("jinaai/jina-embeddings-v3", trust_remote_code=True, revision="abc123")
```
Also applies to the same pattern in `setup_db.py` if it exists.
### Same context bug as cpu-ish-rag
The RAG retrieval likely has similar issues to cpu-ish-rag (see that repo's issues).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.