@@ -5,6 +5,7 @@ import { serveStatic } from "@hono/node-server/serve-static";
55import { captureException , close } from "@sentry/node" ;
66import { isoBase64URL } from "@simplewebauthn/server/helpers" ;
77import { Hono } from "hono" ;
8+ import { secureHeaders } from "hono/secure-headers" ;
89import { trimTrailingSlash } from "hono/trailing-slash" ;
910import type { UnofficialStatusCode } from "hono/utils/http-status" ;
1011
@@ -78,7 +79,52 @@ app.get("/.well-known/farcaster.json", (c) =>
7879 } ,
7980 } ) ,
8081) ;
81- app . use (
82+
83+ const frontend = new Hono ( ) ;
84+ frontend . use (
85+ secureHeaders ( {
86+ xFrameOptions : false ,
87+ referrerPolicy : "strict-origin-when-cross-origin" ,
88+ reportingEndpoints : [
89+ {
90+ name : "sentry" ,
91+ url : `https://o1351734.ingest.us.sentry.io/api/4506186349674496/security/?sentry_key=ac8875331e4cecd67dd0a7519a36dfeb&sentry_environment=${
92+ { "web.exactly.app" : "production" } [ domain ] ?? "development"
93+ } `,
94+ } ,
95+ ] ,
96+ contentSecurityPolicy : {
97+ defaultSrc : [ "'self'" ] ,
98+ fontSrc : [ "'self'" ] ,
99+ imgSrc : [ "'self'" , "data:" , "https://avatars.githubusercontent.com" ] ,
100+ styleSrc : [ "'self'" , "'unsafe-inline'" ] ,
101+ scriptSrc : [
102+ "'self'" ,
103+ "'unsafe-inline'" ,
104+ "https://cdn.onesignal.com" ,
105+ "https://api.onesignal.com" ,
106+ "https://widget.intercom.io" ,
107+ "https://js.intercomcdn.com" ,
108+ ] ,
109+ connectSrc : [
110+ "'self'" ,
111+ "https://li.quest" ,
112+ "https://*.g.alchemy.com" ,
113+ "https://assets.smold.app" ,
114+ "https://api.onesignal.com" ,
115+ "https://api-iam.intercom.io" ,
116+ "https://*.ingest.us.sentry.io" ,
117+ "https://raw.githubusercontent.com" ,
118+ "wss://nexus-websocket-a.intercom.io/" ,
119+ ] ,
120+ frameAncestors : [ "https://farcaster.xyz" ] ,
121+ objectSrc : [ "'none'" ] ,
122+ baseUri : [ "'none'" ] ,
123+ reportTo : "sentry" ,
124+ } ,
125+ } ) ,
126+ ) ;
127+ frontend . use (
82128 serveStatic ( {
83129 root : "app" ,
84130 rewriteRequestPath : ( path ) => {
@@ -91,7 +137,7 @@ app.use(
91137 } ,
92138 } ) ,
93139) ;
94- app . use (
140+ frontend . use (
95141 serveStatic ( {
96142 root : "app" ,
97143 rewriteRequestPath : ( path ) => {
@@ -104,6 +150,7 @@ app.use(
104150 } ,
105151 } ) ,
106152) ;
153+ app . route ( "/" , frontend ) ;
107154
108155app . onError ( ( error , c ) => {
109156 captureException ( error , { level : "error" , tags : { unhandled : true } } ) ;
0 commit comments