Skip to content

Commit 6916408

Browse files
yasinBursaliclaude
andcommitted
fix: add authentication to GPU endpoints (detailed, topology, history)
All three GPU router endpoints were missing Depends(verify_api_key), allowing unauthenticated access to GPU metrics, topology, and history data. Every other non-health endpoint in the dashboard API requires authentication via Bearer token. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7d2da71 commit 6916408

File tree

1 file changed

+6
-4
lines changed
  • dream-server/extensions/services/dashboard-api/routers

1 file changed

+6
-4
lines changed

dream-server/extensions/services/dashboard-api/routers/gpu.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
from datetime import datetime, timezone
99
from typing import Optional
1010

11-
from fastapi import APIRouter, HTTPException
11+
from fastapi import APIRouter, Depends, HTTPException
12+
13+
from security import verify_api_key
1214

1315
from gpu import (
1416
decode_gpu_assignment,
@@ -93,7 +95,7 @@ def _build_aggregate(gpus: list[IndividualGPU], backend: str) -> GPUInfo:
9395
# Endpoints
9496
# ============================================================================
9597

96-
@router.get("/api/gpu/detailed", response_model=MultiGPUStatus)
98+
@router.get("/api/gpu/detailed", response_model=MultiGPUStatus, dependencies=[Depends(verify_api_key)])
9799
async def gpu_detailed():
98100
"""Per-GPU metrics with service assignment info (cached 3 s)."""
99101
now = time.monotonic()
@@ -125,7 +127,7 @@ async def gpu_detailed():
125127
return result
126128

127129

128-
@router.get("/api/gpu/topology")
130+
@router.get("/api/gpu/topology", dependencies=[Depends(verify_api_key)])
129131
async def gpu_topology():
130132
"""GPU topology from config/gpu-topology.json (written by installer / dream-cli). Cached 300 s."""
131133
now = time.monotonic()
@@ -144,7 +146,7 @@ async def gpu_topology():
144146
return topo
145147

146148

147-
@router.get("/api/gpu/history")
149+
@router.get("/api/gpu/history", dependencies=[Depends(verify_api_key)])
148150
async def gpu_history():
149151
"""Rolling 5-minute per-GPU metrics history sampled every 5 s."""
150152
if not _GPU_HISTORY:

0 commit comments

Comments
 (0)