T08 · Insecure Dependencies
- Location
assets/dashboard.html:316- Finding
Third-Party CDN Script Executes Alongside Embedded Reproductive Health Data
- Content
View full analysis
``` The dashboard generator embeds the complete user dataset into the same document: ```python injection = f""" """ # Insert before html = template.replace("", injection + "") Path(output_path).write_text(html, encoding="utf-8") ``` ### Technical Analysis The generated dashboard loads Chart.js from a third-party CDN without a Subresource Integrity (`integrity`) hash. The remotely served script executes with the same document privileges as the application's own JavaScript. At the same time, the dashboard contains a plaintext JavaScript representation of the complete health dataset. This can include menstrual dates, pregnancy or postpartum state, medical conditions, medications, symptoms, mood scores, events, and free-form notes. Pinning the URL to a package version does not provide cryptographic verification of the returned content. A compromise of the CDN, package distribution process, origin account, DNS path, or HTTPS termination infrastructure could cause modified JavaScript to execute when the dashboard is opened. Such code could directly read `userData`, `analysisResult`, and `recommendations`. This des ...[truncated 1587 chars]- Remediation
View remediation
``` 3. Deploy a restrictive Content Security Policy that limits script and connection destinations. Prefer a policy that does not permit arbitrary inline scripts. 4. Minimize the data placed in the dashboard. Embed only the aggregate values required to render charts, rather than the complete user profile and raw notes. 5. Generate dashboards that function fully offline so opening sensitive reports never requires contacting third parties. 6. Document that exported dashboards contain sensitive information and should not be shared or opened in untrusted environments. ]]>
