mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-07-26 22:25:41 +00:00
27b4057bd4
Audit remediation (build/supply-chain/quality):
- Add `@pezkuwi/api-augment` import in main.tsx -> tsc errors 416->328 (Codec-typed
on-chain reads now augmented); add `typecheck` script + a non-blocking Typecheck CI
step (flip to blocking once errors reach 0).
- CI: `npm install` -> `npm ci` (lockfile enforced) in web + security-audit jobs; add a
Backend Indexer job (npm ci + node --check + non-blocking high/critical audit). No
live tests run in CI (they need a live chain) — a mockable CI test subset is a
follow-up.
- Vulns: bump dompurify ^3.4.12 + postcss ^8.5.23 (web prod highs cleared; only the
react-router v7 open-redirect remains, deferred as a breaking major); backend tar
^7.5.22 + ws ^8.21.1 (clears the critical tar advisory). Lockfiles regenerated.
- Prod build now drops console/debugger (vite esbuild.drop); NotificationBell realtime
subscription now returns cleanup + uses a per-user channel (fixes leak); ProfileSettings
language codes aligned to i18n config (ku-kurmanji/ku-sorani).
- Root package.json sdk-ui path env-driven (${SDK_UI_DIR}); generate-docs rustup path
resolved dynamically; Docker image license label MIT (matches LICENSE). Removed scratch
files (mimari.txt, _scratch_credit_serok.mjs).
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
// Suppress console output in production
|
|
// Must be at the very top before any imports
|
|
if (typeof window !== 'undefined' && import.meta.env.PROD) {
|
|
// Suppress console.log, debug, info in production
|
|
const noop = () => {};
|
|
console.log = noop;
|
|
console.debug = noop;
|
|
console.info = noop;
|
|
|
|
// Filter noisy warnings but keep important ones
|
|
const originalWarn = console.warn;
|
|
const suppressedPatterns = [
|
|
'RPC methods not decorated',
|
|
'Unknown signed extensions',
|
|
'API/INIT:',
|
|
'REGISTRY:',
|
|
'StorageWeightReclaim',
|
|
];
|
|
|
|
console.warn = (...args: unknown[]) => {
|
|
const msg = String(args[0] || '');
|
|
if (suppressedPatterns.some(pattern => msg.includes(pattern))) {
|
|
return;
|
|
}
|
|
originalWarn.apply(console, args);
|
|
};
|
|
}
|
|
|
|
// Augment @pezkuwi/api types so api.query/tx/rpc return typed values
|
|
// instead of the generic `Codec`. Must be imported before any api usage.
|
|
import '@pezkuwi/api-augment';
|
|
|
|
import { createRoot } from 'react-dom/client'
|
|
import App from './App.tsx'
|
|
import './index.css'
|
|
import './i18n/config'
|
|
|
|
// Add window.ethereum type declaration
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
declare global {
|
|
interface Window {
|
|
ethereum?: any;
|
|
Buffer: any;
|
|
global: any;
|
|
}
|
|
}
|
|
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
|
|
// All providers are now in App.tsx for better organization
|
|
createRoot(document.getElementById("root")!).render(<App />);
|