T09 · Insecure Skill Coding Practices
- Location
scripts/fetch-cpap.py:53- Finding
Configurable API Origin Can Receive PrismaAPP Credentials and Bearer Tokens
- Content
View full analysis
str: resp = http_post_form(f"{api_base}/connect/token", { "grant_type": "password", "username": email, "password": password, "scope": "profile offline_access", "tenant": "patientapp", "client_id": "patient-app-client", }) return resp["access_token"] # ── API ──────────────────────────────────────────────────────────────────────── def get_dashboard(token: str, api_base: str) -> dict: return http_get(f"{api_base}/api/Dashboard", token) def get_week(token: str, date_in_week: str, api_base: str) -> list[dict]: data = http_get(f"{api_base}/api/Dashboard/week?dateInWeek={date_in_week}", token) ``` The destination is read directly from configuration and then used for authentication: ```python api_base = cfg.get("api_base", "https://my.prismacloud.com").rstrip("/") ``` ```python token = login(cfg["email"], cfg["password"], api_base) ``` Authenticated requests also transmit the resulting token: ```python def http_get(url: str, token: str) -> dict: req = urllib.request.Request(url, headers={"Authorization": f"Bearer {token}", "Accept": "application/json"}) with urllib.request.urlopen(req, timeout=15) as r: return json.loads(r.read()) ``` ### Technical Analysis The Skill's declared functionality requires network access to the PrismaAPP service. Sending credentials to the official authentication endpoint and using a bearer token to retrieve CPAP records are therefore functionally necessary. However, the implementation does not enforce that `api_base` is the documented official origin, `https://my.prismacloud.com`. It accepts any configured ...[truncated 2237 chars]- Remediation
View remediation
