fix(aiguard): resolve endpoint host correctly for regional Datadog sites#9040
Conversation
The AI Guard SDK client unconditionally prepended the `app.` subdomain to the configured site, producing an invalid host (e.g. `app.us3.datadoghq.com`) for regional data centers. Prepend `app.` only when the site is a single-level domain, mirroring the Python tracer logic. APPSEC-68649 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Overall package sizeSelf size: 6.31 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.2.0 | 104.26 kB | 843.44 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
|
BenchmarksBenchmark execution time: 2026-06-24 06:44:00 Comparing candidate commit 4db2ec1 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 1952 metrics, 13 unstable metrics.
|
…tes (#9040) The AI Guard SDK client unconditionally prepended the `app.` subdomain to the configured site, producing an invalid host (e.g. `app.us3.datadoghq.com`) for regional data centers. Prepend `app.` only when the site is a single-level domain, mirroring the Python tracer logic. APPSEC-68649 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tes (#9040) The AI Guard SDK client unconditionally prepended the `app.` subdomain to the configured site, producing an invalid host (e.g. `app.us3.datadoghq.com`) for regional data centers. Prepend `app.` only when the site is a single-level domain, mirroring the Python tracer logic. APPSEC-68649 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tes (#9040) The AI Guard SDK client unconditionally prepended the `app.` subdomain to the configured site, producing an invalid host (e.g. `app.us3.datadoghq.com`) for regional data centers. Prepend `app.` only when the site is a single-level domain, mirroring the Python tracer logic. APPSEC-68649 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What does this PR do?
Fixes AI Guard SDK endpoint resolution for regional Datadog sites. The client previously prepended the
app.subdomain to the configured site unconditionally, producing an invalid host such asapp.us3.datadoghq.comfor regional data centers.It now prepends
app.only when the site is a single-level domain (one dot), otherwise it uses the site as-is — mirroring the Python tracer logic:Resulting hosts:
datadoghq.com/datad0g.com/ddog-gov.com→https://app.<site>/api/v2/ai-guardus3.datadoghq.com/ap1.datadoghq.com→https://<site>/api/v2/ai-guardMotivation
AI Guard requests on regional sites were being sent to a non-existent
app.<region>.datadoghq.comhost.Change log entry
Fix AI Guard endpoint resolution for regional Datadog sites.
Additional Notes
endpoint discoverytest, which mutated shared config (delete newConfig.experimental.aiguard.endpointon a shallow copy) and would otherwise break sibling tests under the new code path. Added regional-site cases.🤖 Generated with Claude Code