mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
perf(core): improved app security, fixes #666
This commit is contained in:
11
src/main/libs/misc/validateSender.ts
Normal file
11
src/main/libs/misc/validateSender.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { WebFrameMain } from 'electron';
|
||||
import * as path from 'path';
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||
const indexPath = path.resolve(__dirname, 'index.html').split(path.sep).join('/');
|
||||
|
||||
export function validateSender (frame: WebFrameMain) {
|
||||
const frameUrl = new URL(frame.url);
|
||||
if ((isDevelopment && frameUrl.host === 'localhost:9080') || frameUrl.href.replace('file:///', '').replace('file://localhost', '') === indexPath) return true;
|
||||
return false;
|
||||
}
|
Reference in New Issue
Block a user