Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ef124c

Browse files
committed
fix(devtools): add event tagging to prevent DDOS
One common problem encountered by the devtools content script is that it accepted almost any message send over the message bus. Some websites like `auth.openai.com` were spamming the bus and DDOS the devtools app.By introducing event tagging and skipping non-devtools events we prevent DDOS of the Angular devtools content script by on forward tagged events.
1 parent7eb9fcd commit5ef124c

File tree

5 files changed

+5
-1
lines changed

5 files changed

+5
-1
lines changed

‎devtools/projects/shell-browser/src/app/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ ts_project(
173173
deps= [
174174
":chrome_message_bus_rjs",
175175
":same_page_message_bus_rjs",
176+
"//:node_modules/rxjs",
176177
"//devtools/projects/protocol:protocol_rjs",
177178
],
178179
)

‎devtools/projects/shell-browser/src/app/chrome-message-bus.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export class ChromeMessageBus extends MessageBus<Events> {
7474
topic,
7575
args,
7676
__ignore_ng_zone__:true,
77+
__NG_DEVTOOLS_EVENT__:true,
7778
});
7879
returntrue;
7980
}

‎devtools/projects/shell-browser/src/app/content-script.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ if (!backendInitialized) {
9494
}
9595

9696
constproxyEventFromWindowToDevToolsExtension=(event:MessageEvent)=>{
97-
if(event.source===window&&event.data){
97+
if(event.source===window&&event.data&&event.data.__NG_DEVTOOLS_EVENT__){
9898
try{
9999
chrome.runtime.sendMessage(event.data);
100100
}catch(e){

‎devtools/projects/shell-browser/src/app/same-page-message-bus.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export class SamePageMessageBus extends MessageBus<Events> {
7474
topic,
7575
args,
7676
__ignore_ng_zone__:true,
77+
__NG_DEVTOOLS_EVENT__:true,
7778
},
7879
'*',
7980
);

‎devtools/src/iframe-message-bus.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export class IFrameMessageBus extends MessageBus<Events> {
7878
// event listeners but also not prevent the NgZone in the devtools app
7979
// from updating its UI.
8080
__ignore_ng_zone__:this._source==='angular-devtools',
81+
__NG_DEVTOOLS_EVENT__:true,
8182
},
8283
'*',
8384
);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp