mirror of
https://github.com/kccleoc/seedpgp-web.git
synced 2026-03-07 09:57:50 +08:00
Implement security patches: CSP headers, console disabling, key rotation, clipboard security, network blocking, log cleanup, and PGP validation
This commit is contained in:
48
src/main.tsx
48
src/main.tsx
@@ -1,24 +1,38 @@
|
||||
import './polyfills';
|
||||
|
||||
// Suppress OpenPGP.js AES cipher warnings
|
||||
const originalWarn = console.warn;
|
||||
const originalError = console.error;
|
||||
// Production: Disable all console output (prevents seed recovery via console history)
|
||||
if (import.meta.env.PROD) {
|
||||
console.log = () => { };
|
||||
console.error = () => { };
|
||||
console.warn = () => { };
|
||||
console.debug = () => { };
|
||||
console.info = () => { };
|
||||
console.trace = () => { };
|
||||
console.time = () => { };
|
||||
console.timeEnd = () => { };
|
||||
}
|
||||
|
||||
console.warn = (...args: any[]) => {
|
||||
const msg = args[0]?.toString() || '';
|
||||
if (msg.includes('AES-CBC') || msg.includes('AES-CTR') || msg.includes('authentication')) {
|
||||
return;
|
||||
}
|
||||
originalWarn.apply(console, args);
|
||||
};
|
||||
// Development: Suppress OpenPGP.js AES cipher warnings
|
||||
if (import.meta.env.DEV) {
|
||||
const originalWarn = console.warn;
|
||||
const originalError = console.error;
|
||||
|
||||
console.error = (...args: any[]) => {
|
||||
const msg = args[0]?.toString() || '';
|
||||
if (msg.includes('AES-CBC') || msg.includes('AES-CTR') || msg.includes('authentication')) {
|
||||
return;
|
||||
}
|
||||
originalError.apply(console, args);
|
||||
};
|
||||
console.warn = (...args: any[]) => {
|
||||
const msg = args[0]?.toString() || '';
|
||||
if (msg.includes('AES-CBC') || msg.includes('AES-CTR') || msg.includes('authentication')) {
|
||||
return;
|
||||
}
|
||||
originalWarn.apply(console, args);
|
||||
};
|
||||
|
||||
console.error = (...args: any[]) => {
|
||||
const msg = args[0]?.toString() || '';
|
||||
if (msg.includes('AES-CBC') || msg.includes('AES-CTR') || msg.includes('authentication')) {
|
||||
return;
|
||||
}
|
||||
originalError.apply(console, args);
|
||||
};
|
||||
}
|
||||
|
||||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
|
||||
Reference in New Issue
Block a user