Skip to content

Commit

Permalink
Disable CSP reports and pings
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Jun 22, 2024
1 parent cee3ad4 commit 0947638
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src-main/windows/project-running-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ class ProjectRunningWindow extends AbtractWindow {
}

onBeforeRequest (details, callback) {
if (details.resourceType === 'cspReport' || details.resourceType === 'ping') {
return callback({
cancel: true
});
}

const parsed = new URL(details.url);

if (parsed.origin === 'https://cdn.assets.scratch.mit.edu' || parsed.origin === 'https://assets.scratch.mit.edu') {
Expand Down Expand Up @@ -149,7 +155,7 @@ class ProjectRunningWindow extends AbtractWindow {
break;

// Modify CSP frame-ancestors to allow embedding
// We modify the report-only header too so that we send fewer useless reports
// We modify the report-only header to reduce console spam
case 'content-security-policy':
case 'content-security-policy-report-only': {
// We try to add allowed origins rather than completely remove/replace to reduce possible security impact.
Expand Down

0 comments on commit 0947638

Please sign in to comment.