Skip to content

Commit e7077dd

Browse files
committed
fix(amazonq): deny restoreTabMessage/contextCommandData messages from cwc chat
1 parent cda61ec commit e7077dd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/amazonq/src/lsp/chat/activation.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ export async function activate(languageClient: LanguageClient, encryptionKey: Bu
4545

4646
provider.onDidResolveWebview(() => {
4747
const disposable = DefaultAmazonQAppInitContext.instance.getAppsToWebViewMessageListener().onMessage((msg) => {
48+
/**
49+
* codewhispers app handler is still registered because the activation flow hasn't been refactored.
50+
* We need to explicitly deny events like restoreTabMessage, otherwise they will be forwarded to the frontend
51+
*
52+
*/
53+
if (msg.sender === 'CWChat' && ['restoreTabMessage', 'contextCommandData'].includes(msg.type)) {
54+
return
55+
}
4856
provider.webview?.postMessage(msg).then(undefined, (e) => {
4957
getLogger().error('webView.postMessage failed: %s', (e as Error).message)
5058
})

0 commit comments

Comments
 (0)