You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor: Use stdin for voice agent config to improve security
This commit refactors the fallback mechanism for creating voice agent subprocesses to eliminate a potential command injection vulnerability.
Previously, user-provided data was passed as command-line arguments when launching a new agent process directly. This exposed the application to argument injection risks.
The new implementation aligns the fallback behavior with the more secure pattern used by the process pool:
- Session configuration is now passed as a single JSON object via the subprocess's stdin.
- The agent script (`app.agents.voice.automatic`) now handles being launched with no arguments by reading this configuration from stdin.
This change ensures that user-controlled data is no longer part of the command line, mitigating the security risk and making the process creation mechanism more robust and consistent.
Copy file name to clipboardExpand all lines: docs/POOL_IMPLEMENTATION.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,16 +100,16 @@ The pool sizes are now configurable via environment variables. You can set them
100
100
101
101
```bash
102
102
# The number of voice agent processes to keep ready in the pool.
103
-
VOICE_AGENT_POOL_SIZE=3
103
+
AUTOMATIC_VOICE_AGENT_POOL_SIZE=3
104
104
105
105
# The maximum number of voice agent processes the pool can scale up to.
106
-
VOICE_AGENT_MAX_POOL_SIZE=3
106
+
AUTOMATIC_VOICE_AGENT_MAX_POOL_SIZE=3
107
107
108
108
# The number of Daily.co rooms to keep ready in the pool.
109
-
DAILY_ROOM_POOL_SIZE=5
109
+
AUTOMATIC_DAILY_ROOM_POOL_SIZE=5
110
110
111
111
# The maximum number of Daily.co rooms the pool can scale up to.
112
-
DAILY_ROOM_MAX_POOL_SIZE=5
112
+
AUTOMATIC_DAILY_ROOM_MAX_POOL_SIZE=5
113
113
```
114
114
115
115
### Multi-Pod Setup
@@ -242,7 +242,7 @@ curl -X POST http://localhost:8000/agent/voice/automatic/cleanup/{session_id}
242
242
-[ ]**Model Pre-warming**: Investigate pre-loading heavy models (like STT, VAD) into memory when a process is created, rather than on the first session assignment. This could further reduce the initial session delay.
243
243
-[ ]**Shared Model Cache**: For multi-process setups, explore using a shared memory cache (e.g., Redis, Memcached) for models to reduce the overall memory footprint.
244
244
-[ ]**Asynchronous Model Loading**: Load non-critical models asynchronously after the primary connection is established to improve perceived performance.
245
-
-[ ]**Auto-scaling of pool sizes**: Implement logic to dynamically adjust `VOICE_AGENT_POOL_SIZE` and `DAILY_ROOM_POOL_SIZE` based on real-time load and demand.
245
+
-[ ]**Auto-scaling of pool sizes**: Implement logic to dynamically adjust `AUTOMATIC_VOICE_AGENT_POOL_SIZE` and `AUTOMATIC_DAILY_ROOM_POOL_SIZE` based on real-time load and demand.
246
246
-[ ]**Advanced Health Checks**: Implement more sophisticated health checks that not only verify if a process is running but also check its responsiveness and resource consumption.
247
247
-[ ]**Performance Metrics Dashboard**: Create a dedicated dashboard (e.g., using Grafana) to visualize pool statistics, connection times, and resource utilization over time.
0 commit comments