You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(preview): infer <site>.deco.site as an allowed draft preview host (#1224)
* feat(preview): infer <site>.deco.site as an allowed draft preview host
The draft-preview allowlist (DECO_ALLOWED_PREVIEW_HOSTS / site-block
previewHosts) required per-site opt-in, but DECO_SITE_NAME isn't always
in the env. Derive the deco-hosted preview domain from the site name the
runtime already resolves (opts.site ?? DECO_SITE_NAME ?? …) and register
it via setDecoSiteHost at Deco.init.
<site>.deco.site is merged ON TOP of the env/site-block list (never
replacing it) so a signed draft grant can preview on deco-operated infra
out of the box. The random dev fallback registers nothing, and a custom
production domain is never inferred — it stays inert.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(preview): add kill switch and document threat model for inferred host
Address review of the `<site>.deco.site` inference:
- `DECO_ALLOWED_PREVIEW_HOSTS=none` is now a kill switch that disables
preview entirely (inferred host + site block included), restoring the
env var's "stop a bad rollout without a deploy" escape hatch — which the
merge-on-top had removed for the inferred host.
- Document the post-change threat model: a named site is no longer inert
by default, the request host is spoofable, so the signed `?__draft=`
grant is the sole remaining gate; host-scoping only bounds blast radius.
- Fix the now-stale `isDraftPreviewEnabled` docstring.
- Tests: kill switch, and undefined (random dev fallback) registering no host.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments