agentscope-ai / agentscope-ai/agentscope
security(app): reject file URLs in chat input
- Langage dominant
- Python
- Étoiles
- 31.6k
- Forks
- 3.5k
- Merge moyen
- 1 j 16 h
- PR mergées (30 j)
- 103
Description
## Problem
The Chat API accepts `DataBlock` URL sources from request JSON. A `file://` source reaches media formatters, which read the referenced path on the service host before embedding the bytes in a request to the configured model provider.
The service example is network-facing and its current identity dependency trusts a request header, so a remote caller able to run an agent can request a service-host path instead of uploading media content.
## Scope
Reject `file://` URL sources at the `ChatRequest` boundary. This preserves trusted SDK and workspace flows that intentionally use local files, while keeping remote URLs and base64 uploads available to API clients.
## Regression coverage
Validate that a request containing a `file://` source is rejected during request parsing before the agent or any formatter can run.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Focus on the Chat API request parsing path where `ChatRequest` is built from JSON. Add validation at this boundary so `file://` URL sources in `DataBlock` are rejected before media formatters or agent execution. Add or update request-level tests for chat input parsing to assert that `file://` inputs fail while remote URLs/base64 uploads still pass. The issue is done when parsing returns a clear error for file URLs and downstream formatter/agent code is never reached.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- api, security
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 73/100