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

feat: lavamoat #712

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2a86288
feat: pgs
andreabadesso Sep 4, 2024
704d089
feat: working react-app-rewired
andreabadesso Oct 15, 2024
a16df67
chore: generating policy
andreabadesso Oct 22, 2024
991441c
feat: added lockdown and config overrides adding ses
andreabadesso Nov 26, 2024
61f6365
chore: lavamoat policy overrides working
andreabadesso Dec 16, 2024
828ec61
chore: using path-browserify
andreabadesso Dec 19, 2024
8fcceab
chore: build passing
andreabadesso Dec 19, 2024
c6296ba
fix: axios failing to be imported
andreabadesso Dec 19, 2024
fe6071a
fix: Buffer missing from bitcore-lib
andreabadesso Dec 21, 2024
c1ad57e
fix: global modal not showing sometimes
andreabadesso Dec 21, 2024
915421e
chore: upgrade nodejs to v22
andreabadesso Dec 23, 2024
205b123
chore: using fixed versions
andreabadesso Dec 23, 2024
a79fc09
chore: stop hardcoding debugMode and removed process
andreabadesso Dec 23, 2024
786ac3b
chore: better pin modal
andreabadesso Dec 23, 2024
b4be97e
refactor: using path-browserify in transaction details
andreabadesso Dec 23, 2024
944b6c1
refactor: using path-browserify in helpers
andreabadesso Dec 23, 2024
2306201
refactor: removed walletconnect references
andreabadesso Dec 23, 2024
780a778
chore: only add lavamoat in production builds
andreabadesso Dec 23, 2024
7b8bc73
chore: watch-css on start script
andreabadesso Dec 23, 2024
9f841f9
chore: update lavamoat policy
andreabadesso Dec 23, 2024
34f7c64
docs: improved docs on lavamoat on dev
andreabadesso Jan 21, 2025
9eabaa4
refactor: removed performance from lavamoat config-overrides
andreabadesso Jan 21, 2025
6d3be4a
chore: added trace uncaught to dev and debug
andreabadesso Jan 21, 2025
b3601fe
fix: missing modalContext in App.js
andreabadesso Jan 21, 2025
64ad5b9
fix: missing return on getfullExplorerUrl
andreabadesso Jan 21, 2025
f2163ef
chore: added log to bn.js patch so the developer knows that something…
andreabadesso Jan 21, 2025
d0dcb80
refactor: focus pin input on modal pin shown
andreabadesso Jan 24, 2025
e8c3382
refactor: onSuccess -> onModalHidden on modal pin
andreabadesso Jan 24, 2025
ea644ef
refactor: modal title id
andreabadesso Jan 24, 2025
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
108 changes: 108 additions & 0 deletions config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
const webpack = require('webpack');
const LavaMoatPlugin = require('@lavamoat/webpack')
const fs = require('fs');
const path = require('path');

module.exports = function override(config, env) {
// Enable source maps for better debugging
config.devtool = 'source-map';

config.optimization = {
...config.optimization,
minimize: false,
concatenateModules: false
};

// Configure module resolution
config.resolve = {
...config.resolve,
fallback: {
url: require.resolve('url'),
fs: false,
assert: require.resolve('assert'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
buffer: require.resolve('buffer'),
stream: require.resolve('stream-browserify'),
vm: require.resolve('vm-browserify'),
path: require.resolve("path-browserify"),
worker_threads: false,
perf_hooks: false,
tls: false,
net: false
},
mainFields: ['browser', 'module', 'main'],
conditionNames: ['import', 'require', 'node', 'default'],
extensionAlias: {
'.js': ['.js', '.ts', '.tsx']
},
alias: {
'classic-level': false,
'level': false,
'pino-worker': false,
'pino/file': false,
'pino-pretty': false,
'axios': path.resolve(__dirname, 'node_modules/axios'),
// Add an alias for our buffer shim
'buffer-shim': path.resolve(__dirname, 'src/buffer-shim.js')
}
};

// Add a rule to handle axios imports
config.module.rules.push({
test: /[\\/]axios[\\/]/,
resolve: {
alias: {
'axios': path.resolve(__dirname, 'node_modules/axios')
}
}
});

config.module.rules.push({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment for this rule also

test: /\.m?js/,
resolve: {
fullySpecified: false
}
});

// Use null-loader for Node.js-specific packages
config.module.rules.push({
test: /[\\/](classic-level|pino)[\\/]/,
use: 'null-loader'
});

// Base plugins that we always want
const basePlugins = [
...config.plugins.filter(p => !(p instanceof webpack.ProvidePlugin)),
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer-shim', 'default']
}),
];

// Only add LavaMoat in production because LavaMoat does not work with the
// hot reloading feature in dev.
if (env === 'production') {
tuliomir marked this conversation as resolved.
Show resolved Hide resolved
config.plugins = [
new LavaMoatPlugin({
generatePolicy: true,
HtmlWebpackPluginInterop: true,
readableResourceIds: true,
diagnosticsVerbosity: 1,
lockdown: {
consoleTaming: 'unsafe',
errorTrapping: 'none',
unhandledRejectionTrapping: 'none',
overrideTaming: 'severe',
}
}),
...basePlugins
];
} else {
config.plugins = basePlugins;
}

return config;
}
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
pkgs.devshell.mkShell {
packages = with pkgs; [
nixpkgs-fmt
nodejs_20
nodejs_22
libusb1
];
};
Expand Down
Loading
Loading