MCPcopy Index your code
hub / github.com/simstudioai/sim / buildCSPString

Function buildCSPString

apps/sim/lib/core/security/csp.ts:173–183  ·  view source on GitHub ↗
(directives: CSPDirectives)

Source from the content-addressed store, hash-verified

171 * Build CSP string from directives object
172 */
173export function buildCSPString(directives: CSPDirectives): string {
174 return Object.entries(directives)
175 .map(([directive, sources]) => {
176 if (!sources || sources.length === 0) return ''
177 const validSources = sources.filter((source: string) => source && source.trim() !== '')
178 if (validSources.length === 0) return ''
179 return `${directive} ${validSources.join(' ')}`
180 })
181 .filter(Boolean)
182 .join('; ')
183}
184
185/**
186 * Generate runtime CSP header with dynamic environment variables.

Callers 4

csp.test.tsFile · 0.90
generateRuntimeCSPFunction · 0.85
getMainCSPPolicyFunction · 0.85
getChatEmbedCSPPolicyFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected