Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: filter all requests not just xhr, all requests are potentially harmfull (can spy on the user via header, etc...) #16259

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/suite-desktop-core/src/libs/request-interceptor.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { session } from 'electron';

// Should be used for all webRequest.on* events as there can be only
// one listener for each of them, but sometimes we need to bind more
// of them
/**
* Should be used for all webRequest.on* events as there can be only
* one listener for each of them, but sometimes we need to bind more
* of them.
*/
export const createInterceptor = (): RequestInterceptor => {
let beforeRequestListeners: BeforeRequestListener[] = [];
const filter = { urls: ['*://*/*'] };
Expand Down
10 changes: 0 additions & 10 deletions packages/suite-desktop-core/src/modules/request-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,7 @@ export const SERVICE_NAME = 'request-filter';
export const init: ModuleInit = ({ interceptor }) => {
const { logger } = global;

const resourceTypeFilter = ['xhr']; // What resource types we want to filter
interceptor.onBeforeRequest(details => {
if (!resourceTypeFilter.includes(details.resourceType)) {
logger.debug(
SERVICE_NAME,
`${details.url} was allowed because its resource type (${details.resourceType}) is not filtered`,
);

return;
}

const { hostname } = new URL(details.url);

if (allowedDomains.find(d => hostname.endsWith(d)) !== undefined) {
Expand Down
Loading