T09 · Insecure Skill Coding Practices
- Location
scripts/hyfceph-service-client.mjs:342- Finding
Configurable Portal Destination Can Expose API Credentials and Medical Data
- Content
View full analysis
Vulnerability Details
File Location:
scripts/hyfceph-service-client.mjs, lines 342-559
Vulnerability Type: Unvalidated network destination for sensitive data
Risk Level: HighVulnerable Code
js const { values, positionals } = parseArgs({ options: { 'api-key': { type: 'string' }, 'portal-base-url': { type: 'string', default: DEFAULT_PORTAL_BASE_URL }, // ... }, }); const requestedPortalBaseUrl = String(values['portal-base-url'] || '').trim(); let portalBaseUrl = ensureTrailingSlash(String( requestedPortalBaseUrl || process.env.HYFCEPH_PORTAL_BASE_URL || DEFAULT_PORTAL_BASE_URL ).trim());js async function validateApiKey(portalBaseUrl, apiKey) { const endpoint = new URL('api/validate-key', portalBaseUrl).toString(); return requestJson(endpoint, { method: 'POST', body: { apiKey }, }); }js const endpoint = new URL( overlapMode ? 'api/measure/overlap' : imagePath ? 'api/measure/image' : (shareUrl ? 'api/measure/share-url' : 'api/measure/current-case'), portalBaseUrl, ).toString(); const requestBody = overlapMode ? await (async () => { const resolvedBaseImagePath = path.resolve(imagePath); const resolvedCompareImagePath = path.resolve(compareImagePath); const [baseImageBuffer, compareImageBuffer] = await Promise.all([ fs.readFile(resolvedBaseImagePath), fs.readFile(resolvedCompareImagePath), ]); return { baseFileName: path.basename(resolvedBaseImagePath), baseMimeType: mimeTypeFromPath(resolvedBaseImagePath), baseImageBase64: baseImageBuffer.toString('base64'), compareFileName: path.basename(resolvedCompareImagePath), compareMimeType: mimeTypeFromPath(resolvedCompareImagePath), compareImageBase64: compareImageBuffer.toString('base64'), alignMode, genera ...[truncated 3009 chars]- Remediation
View remediation
Remediation Suggestions
- Pin production requests to
https://hyfceph.52ortho.com/. - Normalize the URL and require the protocol to be
https:. - Enforce an exact hostname allowlist and reject URLs containing unexpected ports, credentials, or alternate hosts.
- Remove the custom portal option from normal public operation. If it is needed for development, require an explicit development flag and interactive warning.
- Store the portal origin with the credential and refuse to send a saved key to any different origin.
- Require explicit credential entry when changing destinations.
- Apply redirect restrictions so that authentication headers and request bodies cannot be forwarded to a different origin.
- Document clearly that images and patient names leave the local system and obtain user confirmation before the first upload.
- Pin production requests to
