feat(capture_server): auth Bearer + bind localhost + anti-path-traversal
- Token obligatoire (RPA_API_TOKEN) sur /capture et /file-action - Bind 127.0.0.1 par défaut, 0.0.0.0 exige token (fail-closed) - /health reste public pour monitoring - VWB backend injecte le Bearer pour les proxys distants - hmac.compare_digest pour comparaison temps constant Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -136,8 +136,18 @@ def capture_windows():
|
||||
agent_port = int(os.environ.get('RPA_WINDOWS_AGENT_PORT', '5006'))
|
||||
agent_url = f'http://{agent_host}:{agent_port}/capture'
|
||||
|
||||
# Auth : l'agent exige un Bearer token (meme RPA_API_TOKEN que le streaming)
|
||||
api_token = os.environ.get('RPA_API_TOKEN', '')
|
||||
headers = {'Authorization': f'Bearer {api_token}'} if api_token else {}
|
||||
|
||||
try:
|
||||
resp = http_client.get(agent_url, timeout=10)
|
||||
resp = http_client.get(agent_url, headers=headers, timeout=10)
|
||||
if resp.status_code == 401:
|
||||
return jsonify({
|
||||
'error': 'Agent Windows : authentification refusee',
|
||||
'hint': 'Verifiez que RPA_API_TOKEN est defini et identique '
|
||||
'cote backend VWB et cote agent Windows.',
|
||||
}), 401
|
||||
if resp.ok:
|
||||
return jsonify(resp.json())
|
||||
return jsonify({
|
||||
|
||||
Reference in New Issue
Block a user