Skip to content

Commit

Permalink
fix(external_messaging_name): Fix untrusted external messaging name c…
Browse files Browse the repository at this point in the history
…heck (#963)

* Name can be missing on external messages

* Fixes order to prioritize the sender since data is untrusted
  • Loading branch information
sleekslush authored Apr 25, 2024
1 parent 4b20b0b commit 9f8359c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ globalThis.__plasmoInternalPortMap = new Map()
${importSection}
chrome.runtime.onMessageExternal.addListener((request, sender, sendResponse) => {
switch (request.name) {
switch (request?.name) {
${externalMessageSection}
default:
break
Expand Down Expand Up @@ -97,8 +97,8 @@ const getHandlerList = async (

const getMessageCode = (name: string, importName: string) => `case "${name}":
${importName}({
sender,
...request
...request,
sender
}, {
send: (p) => sendResponse(p)
})
Expand Down

0 comments on commit 9f8359c

Please sign in to comment.