{"record":{"id":"e1920e9c1cd44f82","repo":"Budibase/budibase","slug":"error-getting-status","errorCode":null,"errorMessage":"Error getting status","messagePattern":"Error getting status","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/backend-core/src/accounts/accounts.ts","lineNumber":78,"sourceCode":"  const json: CloudAccount[] = await response.json()\n  return json[0]\n}\n\nexport const getStatus = async (): Promise<\n  HealthStatusResponse | undefined\n> => {\n  if (EXIT_EARLY) {\n    return\n  }\n  const response = await api.get(`/api/status`, {\n    headers: {\n      [Header.API_KEY]: env.ACCOUNT_PORTAL_API_KEY,\n    },\n  })\n  const json = await response.json()\n\n  if (response.status !== 200) {\n    throw new Error(`Error getting status`)\n  }\n\n  return json\n}\n","sourceCodeStart":60,"sourceCodeEnd":83,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/backend-core/src/accounts/accounts.ts#L60-L83","documentation":"While paging drives, the @odata.nextLink returned by Graph must point at https://graph.microsoft.com/v1.0/... (checked by isAllowedSharePointNextLink). If a nextLink is not a valid URL on that exact host/port/path prefix, the loop throws this HTTPError instead of following it. This is a server-side SSRF guard against following attacker-influenced pagination URLs.","triggerScenarios":"A response payload's '@odata.nextLink' is a relative URL, a different host (e.g. a proxy or national cloud like graph.microsoft.us), an http:// URL, or unparseable garbage.","commonSituations":"Requests routed through a corporate proxy that rewrites Graph URLs; mocking layers returning hand-crafted nextLinks; Graph national-sovereign clouds (different hostname) not supported by this allowlist; tampered/MITM responses.","solutions":["Ensure requests reach graph.microsoft.com directly — remove or fix proxies that rewrite response URLs.","If using a sovereign cloud (graph.microsoft.us, graph.microsoft.de), the built-in allowlist does not cover it; host against the global cloud or adjust SHAREPOINT_API_BASE.","Check for network middleboxes/traffic interception altering the response body.","Reproduce the failing nextLink by logging payload['@odata.nextLink'] and validate it parses to https://graph.microsoft.com/v1.0/."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const isSafeNextLink = (link: string) => {\n  try {\n    const u = new URL(link)\n    return u.protocol === \"https:\" && u.hostname === \"graph.microsoft.com\" && u.pathname.startsWith(\"/v1.0/\")\n  } catch { return false }\n}\n// call listSharePointDrives only in environments where Graph responses are not rewritten","typeGuard":"const isValidNextLink = (v: unknown): v is string =>\n  typeof v === \"string\" && (() => { try { const u = new URL(v); return u.protocol === \"https:\" && u.hostname === \"graph.microsoft.com\" && u.pathname.startsWith(\"/v1.0/\") } catch { return false } })()","tryCatchPattern":"try {\n  await listSharePointDrives(token, siteId)\n} catch (e) {\n  if (e instanceof Error && e.message === \"Invalid SharePoint pagination URL\") {\n    // environment is rewriting Graph responses — check proxy/TLS appliances\n  } else throw e\n}","preventionTips":["Do not route Microsoft Graph traffic through response-rewriting proxies or API gateways.","In tests, mock Graph with absolute nextLinks on graph.microsoft.com.","Confirm the tenant uses the global Graph cloud, not a sovereign endpoint.","Monitor for TLS-intercepting appliances in the deployment network."],"tags":["sharepoint","microsoft-graph","pagination","ssrf","validation"],"backgroundTag":"invalid-pagination-url","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}