Advisory

GHSA-527g-ff96-x6wj

Details, part 2 of 2. The advisory

Details

Affected Versions

  • Ecosystem: npm
  • Package: @apostrophecms/ai-helper
  • Confirmed affected range: >= 1.0.0-beta.10, <= 1.0.0-beta.12
  • Latest release checked: 1.0.0-beta.12 (npm registry, dist-tag latest)
  • Fix status: not fixed

The vulnerable pattern was introduced in 1.0.0-beta.10: earlier releases through 1.0.0-beta.9 fetched the stored provider URL directly (fetch(url)) with no req.baseUrl resolution and no uploadfs-relative construction, so they are not affected by this pattern. Inspection of the published tarballs for 1.0.0-beta.10, 1.0.0-beta.11, and 1.0.0-beta.12 confirms the full chain (Host-derived base resolution, unguarded accept route, base64 insert without a stored url) is present and unchanged through the latest published release. This package publishes only on the prerelease (beta) channel, and the latest published version remains vulnerable.

Suggested Fix

Do not treat req.baseUrl as a trusted origin for a server-side fetch. Enforce the same authorization on the accept route that the generate route applies, and add an ownership or scope check so a record can only be accepted by a user permitted to act on it. Independently, constrain the fetch target: resolve the storage-relative path against a server-configured, trusted base (for example the configured storage base URL) rather than the request-derived req.baseUrl, and reject or allowlist any resulting origin before calling fetch. Ensure the remediation covers both the base64 (no stored url) representation and the stored-url representation, and any other caller that reaches aiHelperImageUrl or aiHelperFetchImage. As an interim mitigation without a code change, configure a global base URL so the resolved origin is fixed, and place egress controls on the server so outbound requests cannot reach sensitive internal hosts or metadata endpoints.

Reported by zx (GitHub: @manus-pi).

Sources & licences