T08 · Insecure Dependencies
Note
- Location
- scripts/docker_cleanup.py:445
- Finding
- Externally Loaded Stylesheet Without Subresource Integrity<![CDATA[ ## Vulnerability Details **File Location**: `scripts/docker_cleanup.py`, lines 445–448 **Vulnerability Type**: Unverified third-party web dependency **Risk Level**: Low ### Vulnerable Code ```python html = f"""<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><title>Docker Cleanup Report</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <style>body {{ font-family: 'Segoe UI', sans-serif; padding: 2rem; background: #1a1a2e; color: #e0e0e0; }} ``` ### Technical Analysis The generated HTML report loads Bootstrap CSS from the third-party jsDelivr CDN. The resource is not protected by a Subresource Integrity (`integrity`) attribute, so the browser cannot verify that the downloaded content matches an audited version. Although the URL pins Bootstrap to version `5.3.0`, delivery still depends on the CDN, DNS resolution, TLS trust chain, and the continued integrity of the hosted asset. The external request also conflicts with the documented expectation that the tool operates using standard-library functionality only, because opening the generated report introduces a runtime web dependency. CSS does not ordinarily provide direct arbitrary script execution in modern browsers. Nevertheless, malicious or compromised CSS could alter or conceal report content, create misleading visual elements, and trigger further external resource requests. Loading the report also discloses connection metadata—including the viewer's IP address, browser user agent, and access time—to the CDN. ### Attack Path 1. A user runs the tool with the `--report` option. 2. The script creates a local HTML report containing the external stylesheet reference. 3. The user opens that report in a web browser while connected to a network. 4. The browser automatically requests Bootstrap CSS from `cdn.jsdelivr.net`. 5. If the CDN asset, delivery infrastructure, DNS path, or trusted TLS endpoint has been compromised, attack ...[truncated 834 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. **Prefer a fully self-contained report.** Remove the external `<link>` element and inline the required CSS in the generated HTML. This eliminates network access and third-party availability or integrity risks when the report is opened. 2. **Alternatively, bundle the stylesheet locally.** Ship an audited Bootstrap CSS file with the project and embed its contents during report generation. Pin and periodically review the bundled version. 3. **If remote hosting is unavoidable, add Subresource Integrity.** Use a verified cryptographic hash and anonymous cross-origin mode: ```html <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" integrity="VERIFIED-SHA384-HASH" crossorigin="anonymous"> ``` The hash must be generated or obtained from a trusted source and independently verified against the exact referenced file. 4. **Apply a restrictive Content Security Policy.** For a self-contained report, add a policy that blocks network access and executable content, such as: ```html <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:"> ``` 5. **Document any retained network behavior.** If the external dependency remains, clearly disclose that opening the generated report contacts a third-party CDN. ]]>
