SMOODEV-1840: Edge security-headers policy on SmooaiNextEdge (0.2.0)#6
Merged
Conversation
…aiNextEdge (0.2.0) Security headers belong at the CloudFront edge, not next.config.ts: the edge covers paths the origin never serves (static assets, optimized images, error responses) and applies uniformly to every @smooai/deploy consumer. Adds a ResponseHeadersPolicy attached to all three cache behaviors with a sensible default baseline (HSTS, nosniff, frame-options, referrer-policy, permissions-policy). CSP is opt-in to avoid breaking sites with a strict untested policy. Controlled via the new securityHeaders prop. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a CloudFront
ResponseHeadersPolicytoSmooaiNextEdge, attached to all three cache behaviors (HTML,/_next/static/*,/_next/image*).Why the edge, not
next.config.ts: the edge layer covers paths the origin never serves (static assets, optimized images, error responses) and applies uniformly to every@smooai/deployconsumer — security headers are an edge concern.Default baseline (on by default): HSTS (2yr, includeSubDomains, preload),
X-Content-Type-Options: nosniff,X-Frame-Options: SAMEORIGIN,Referrer-Policy: strict-origin-when-cross-origin,Permissions-Policy: camera=(), microphone=(), geolocation=().New
securityHeadersprop:falseto disable, or an object to override. CSP is opt-in (contentSecurityPolicy+ optionalcspReportOnly) — a strict policy needs an inline-script audit first, so it's omitted by default.Typecheck passes. Takes effect on the next prod SST deploy. Bumps to 0.2.0.
🤖 Generated with Claude Code