Skip to content

Commit f466dc6

Browse files
committed
added react grab URL to CSP if FF is enabled, removed dead db hook
1 parent 43a486b commit f466dc6

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
lines changed

apps/sim/lib/auth/auth.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -453,33 +453,6 @@ export const auth = betterAuth({
453453
}
454454
}
455455
},
456-
// afterEmailVerification is called by link-based verification (kept for backwards compatibility)
457-
afterEmailVerification: async (user) => {
458-
if (isHosted && user.email) {
459-
try {
460-
const html = await renderWelcomeEmail(user.name || undefined)
461-
const { from, replyTo } = getPersonalEmailFrom()
462-
463-
await sendEmail({
464-
to: user.email,
465-
subject: getEmailSubject('welcome'),
466-
html,
467-
from,
468-
replyTo,
469-
emailType: 'transactional',
470-
})
471-
472-
logger.info('[emailVerification.afterEmailVerification] Welcome email sent', {
473-
userId: user.id,
474-
})
475-
} catch (error) {
476-
logger.error('[emailVerification.afterEmailVerification] Failed to send welcome email', {
477-
userId: user.id,
478-
error,
479-
})
480-
}
481-
}
482-
},
483456
},
484457
emailAndPassword: {
485458
enabled: true,

apps/sim/lib/core/security/csp.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { env, getEnv } from '../config/env'
2-
import { isDev } from '../config/feature-flags'
2+
import { isDev, isReactGrabEnabled } from '../config/feature-flags'
33

44
/**
55
* Content Security Policy (CSP) configuration builder
@@ -40,6 +40,7 @@ export const buildTimeCSPDirectives: CSPDirectives = {
4040
'https://*.google.com',
4141
'https://apis.google.com',
4242
'https://assets.onedollarstats.com',
43+
...(isReactGrabEnabled ? ['https://unpkg.com'] : []),
4344
],
4445

4546
'style-src': ["'self'", "'unsafe-inline'", 'https://fonts.googleapis.com'],
@@ -166,10 +167,11 @@ export function generateRuntimeCSP(): string {
166167
const dynamicDomainsStr = uniqueDynamicDomains.join(' ')
167168
const brandLogoDomain = brandLogoDomains[0] || ''
168169
const brandFaviconDomain = brandFaviconDomains[0] || ''
170+
const reactGrabScript = isReactGrabEnabled ? 'https://unpkg.com' : ''
169171

170172
return `
171173
default-src 'self';
172-
script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.google.com https://apis.google.com https://assets.onedollarstats.com;
174+
script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.google.com https://apis.google.com https://assets.onedollarstats.com ${reactGrabScript};
173175
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
174176
img-src 'self' data: blob: https://*.googleusercontent.com https://*.google.com https://*.atlassian.com https://cdn.discordapp.com https://*.githubusercontent.com https://*.s3.amazonaws.com https://s3.amazonaws.com https://*.amazonaws.com https://*.blob.core.windows.net https://github.com/* https://collector.onedollarstats.com ${brandLogoDomain} ${brandFaviconDomain};
175177
media-src 'self' blob:;

0 commit comments

Comments
 (0)