Skip to content

Commit 9019ffe

Browse files
committed
fix: update Content Security Policy to remove redundant webview.cspSource references
1 parent 7e6cd48 commit 9019ffe

File tree

1 file changed

+2
-96
lines changed

1 file changed

+2
-96
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 2 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ export class ClineProvider
682682
`img-src ${webview.cspSource} https://storage.googleapis.com https://img.clerk.com data:`,
683683
`media-src ${webview.cspSource}`,
684684
`script-src 'unsafe-eval' ${webview.cspSource} https://* https://*.posthog.com http://${localServerUrl} http://0.0.0.0:${localPort} 'nonce-${nonce}'`,
685-
`connect-src ${webview.cspSource} https://* https://*.posthog.com ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort}`,
685+
`connect-src https://* https://*.posthog.com ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort}`,
686686
]
687687

688688
return /*html*/ `
@@ -764,7 +764,7 @@ export class ClineProvider
764764
<meta charset="utf-8">
765765
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
766766
<meta name="theme-color" content="#000000">
767-
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; font-src ${webview.cspSource} data:; style-src ${webview.cspSource} 'unsafe-inline'; img-src ${webview.cspSource} https://storage.googleapis.com https://img.clerk.com data:; media-src ${webview.cspSource}; script-src ${webview.cspSource} 'wasm-unsafe-eval' 'nonce-${nonce}' https://us-assets.i.posthog.com 'strict-dynamic'; connect-src ${webview.cspSource} https://openrouter.ai https://api.requesty.ai https://us.i.posthog.com https://us-assets.i.posthog.com;">
767+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; font-src ${webview.cspSource} data:; style-src ${webview.cspSource} 'unsafe-inline'; img-src ${webview.cspSource} https://storage.googleapis.com https://img.clerk.com data:; media-src ${webview.cspSource}; script-src ${webview.cspSource} 'wasm-unsafe-eval' 'nonce-${nonce}' https://us-assets.i.posthog.com 'strict-dynamic'; connect-src https://openrouter.ai https://api.requesty.ai https://us.i.posthog.com https://us-assets.i.posthog.com;">
768768
<link rel="stylesheet" type="text/css" href="${stylesUri}">
769769
<link href="${codiconsUri}" rel="stylesheet" />
770770
<script nonce="${nonce}">
@@ -1732,100 +1732,6 @@ export class ClineProvider
17321732
includeDiagnosticMessages: stateValues.includeDiagnosticMessages ?? true,
17331733
maxDiagnosticMessages: stateValues.maxDiagnosticMessages ?? 50,
17341734
}
1735-
1736-
// Return the same structure as before
1737-
return {
1738-
apiConfiguration: providerSettings,
1739-
lastShownAnnouncementId: stateValues.lastShownAnnouncementId,
1740-
customInstructions: stateValues.customInstructions,
1741-
apiModelId: stateValues.apiModelId,
1742-
alwaysAllowReadOnly: stateValues.alwaysAllowReadOnly ?? false,
1743-
alwaysAllowReadOnlyOutsideWorkspace: stateValues.alwaysAllowReadOnlyOutsideWorkspace ?? false,
1744-
alwaysAllowWrite: stateValues.alwaysAllowWrite ?? false,
1745-
alwaysAllowWriteOutsideWorkspace: stateValues.alwaysAllowWriteOutsideWorkspace ?? false,
1746-
alwaysAllowWriteProtected: stateValues.alwaysAllowWriteProtected ?? false,
1747-
alwaysAllowExecute: stateValues.alwaysAllowExecute ?? false,
1748-
alwaysAllowBrowser: stateValues.alwaysAllowBrowser ?? false,
1749-
alwaysAllowMcp: stateValues.alwaysAllowMcp ?? false,
1750-
alwaysAllowModeSwitch: stateValues.alwaysAllowModeSwitch ?? false,
1751-
alwaysAllowSubtasks: stateValues.alwaysAllowSubtasks ?? false,
1752-
alwaysAllowFollowupQuestions: stateValues.alwaysAllowFollowupQuestions ?? false,
1753-
alwaysAllowUpdateTodoList: stateValues.alwaysAllowUpdateTodoList ?? false,
1754-
followupAutoApproveTimeoutMs: stateValues.followupAutoApproveTimeoutMs ?? 60000,
1755-
allowedMaxRequests: stateValues.allowedMaxRequests,
1756-
autoCondenseContext: stateValues.autoCondenseContext ?? true,
1757-
autoCondenseContextPercent: stateValues.autoCondenseContextPercent ?? 100,
1758-
taskHistory: stateValues.taskHistory,
1759-
allowedCommands: stateValues.allowedCommands,
1760-
soundEnabled: stateValues.soundEnabled ?? false,
1761-
ttsEnabled: stateValues.ttsEnabled ?? false,
1762-
ttsSpeed: stateValues.ttsSpeed ?? 1.0,
1763-
diffEnabled: stateValues.diffEnabled ?? true,
1764-
enableCheckpoints: stateValues.enableCheckpoints ?? true,
1765-
soundVolume: stateValues.soundVolume,
1766-
browserViewportSize: stateValues.browserViewportSize ?? "900x600",
1767-
screenshotQuality: stateValues.screenshotQuality ?? 75,
1768-
remoteBrowserHost: stateValues.remoteBrowserHost,
1769-
remoteBrowserEnabled: stateValues.remoteBrowserEnabled ?? false,
1770-
cachedChromeHostUrl: stateValues.cachedChromeHostUrl as string | undefined,
1771-
fuzzyMatchThreshold: stateValues.fuzzyMatchThreshold ?? 1.0,
1772-
writeDelayMs: stateValues.writeDelayMs ?? 1000,
1773-
terminalOutputLineLimit: stateValues.terminalOutputLineLimit ?? 500,
1774-
terminalShellIntegrationTimeout:
1775-
stateValues.terminalShellIntegrationTimeout ?? Terminal.defaultShellIntegrationTimeout,
1776-
terminalShellIntegrationDisabled: stateValues.terminalShellIntegrationDisabled ?? false,
1777-
terminalCommandDelay: stateValues.terminalCommandDelay ?? 0,
1778-
terminalPowershellCounter: stateValues.terminalPowershellCounter ?? false,
1779-
terminalZshClearEolMark: stateValues.terminalZshClearEolMark ?? true,
1780-
terminalZshOhMy: stateValues.terminalZshOhMy ?? false,
1781-
terminalZshP10k: stateValues.terminalZshP10k ?? false,
1782-
terminalZdotdir: stateValues.terminalZdotdir ?? false,
1783-
terminalCompressProgressBar: stateValues.terminalCompressProgressBar ?? true,
1784-
mode: stateValues.mode ?? defaultModeSlug,
1785-
language: stateValues.language ?? formatLanguage(vscode.env.language),
1786-
mcpEnabled: stateValues.mcpEnabled ?? true,
1787-
enableMcpServerCreation: stateValues.enableMcpServerCreation ?? true,
1788-
alwaysApproveResubmit: stateValues.alwaysApproveResubmit ?? false,
1789-
requestDelaySeconds: Math.max(5, stateValues.requestDelaySeconds ?? 10),
1790-
currentApiConfigName: stateValues.currentApiConfigName ?? "default",
1791-
listApiConfigMeta: stateValues.listApiConfigMeta ?? [],
1792-
pinnedApiConfigs: stateValues.pinnedApiConfigs ?? {},
1793-
modeApiConfigs: stateValues.modeApiConfigs ?? ({} as Record<Mode, string>),
1794-
customModePrompts: stateValues.customModePrompts ?? {},
1795-
customSupportPrompts: stateValues.customSupportPrompts ?? {},
1796-
enhancementApiConfigId: stateValues.enhancementApiConfigId,
1797-
experiments: stateValues.experiments ?? experimentDefault,
1798-
autoApprovalEnabled: stateValues.autoApprovalEnabled ?? false,
1799-
customModes,
1800-
maxOpenTabsContext: stateValues.maxOpenTabsContext ?? 20,
1801-
maxWorkspaceFiles: stateValues.maxWorkspaceFiles ?? 200,
1802-
openRouterUseMiddleOutTransform: stateValues.openRouterUseMiddleOutTransform ?? true,
1803-
browserToolEnabled: stateValues.browserToolEnabled ?? true,
1804-
telemetrySetting: stateValues.telemetrySetting || "unset",
1805-
showRooIgnoredFiles: stateValues.showRooIgnoredFiles ?? true,
1806-
maxReadFileLine: stateValues.maxReadFileLine ?? -1,
1807-
maxConcurrentFileReads: stateValues.maxConcurrentFileReads ?? 5,
1808-
historyPreviewCollapsed: stateValues.historyPreviewCollapsed ?? false,
1809-
cloudUserInfo,
1810-
cloudIsAuthenticated,
1811-
sharingEnabled,
1812-
organizationAllowList,
1813-
// Explicitly add condensing settings
1814-
condensingApiConfigId: stateValues.condensingApiConfigId,
1815-
customCondensingPrompt: stateValues.customCondensingPrompt,
1816-
codebaseIndexModels: stateValues.codebaseIndexModels ?? EMBEDDING_MODEL_PROFILES,
1817-
codebaseIndexConfig: stateValues.codebaseIndexConfig ?? {
1818-
codebaseIndexEnabled: true,
1819-
codebaseIndexQdrantUrl: "http://localhost:6333",
1820-
codebaseIndexEmbedderProvider: "openai",
1821-
codebaseIndexEmbedderBaseUrl: "",
1822-
codebaseIndexEmbedderModelId: "",
1823-
},
1824-
profileThresholds: stateValues.profileThresholds ?? {},
1825-
// Add diagnostic message settings
1826-
includeDiagnosticMessages: stateValues.includeDiagnosticMessages ?? true,
1827-
maxDiagnosticMessages: stateValues.maxDiagnosticMessages ?? 50,
1828-
}
18291735
}
18301736

18311737
async updateTaskHistory(item: HistoryItem): Promise<HistoryItem[]> {

0 commit comments

Comments
 (0)