@berachain/config 0.1.24-beta.3 → 0.1.24-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bepolia.cjs +0 -1
- package/dist/bepolia.mjs +0 -1
- package/dist/{chunk-4RBW7LA7.mjs → chunk-5SH7AT43.mjs} +1 -1
- package/dist/{chunk-WRTYGXJM.cjs → chunk-AU3LYJAB.cjs} +26 -6
- package/dist/{chunk-ONKAV4AG.cjs → chunk-B2BTOQVP.cjs} +5 -5
- package/dist/{chunk-TJPHIVC5.mjs → chunk-IGYS2XEK.mjs} +2 -2
- package/dist/{chunk-3K6IUX3G.mjs → chunk-OWAB24JG.mjs} +1 -1
- package/dist/{chunk-ZG7CKYT4.cjs → chunk-SHM2VD4A.cjs} +10 -10
- package/dist/{chunk-BM46XQJA.mjs → chunk-VWRKCGMU.mjs} +22 -2
- package/dist/{chunk-4UCGQIWY.mjs → chunk-XA5DMTFW.mjs} +2 -2
- package/dist/{chunk-EPWUWEWI.cjs → chunk-ZJEZCW5Z.cjs} +3 -3
- package/dist/{chunk-3NQ3NFWW.cjs → chunk-ZTYHPIUW.cjs} +2 -2
- package/dist/index.cjs +0 -1
- package/dist/index.mjs +0 -1
- package/dist/internal/dedupeCspSources.d.ts +9 -0
- package/dist/internal/dedupeCspSources.d.ts.map +1 -0
- package/dist/internal/header-sources.cjs +258 -148
- package/dist/internal/header-sources.d.ts +108 -2
- package/dist/internal/header-sources.d.ts.map +1 -1
- package/dist/internal/header-sources.mjs +254 -144
- package/dist/internal/index.cjs +4 -7
- package/dist/internal/index.mjs +5 -8
- package/dist/internal/maintenance.cjs +1 -3
- package/dist/internal/maintenance.mjs +0 -2
- package/dist/internal/nextjs/index.cjs +7 -9
- package/dist/internal/nextjs/index.mjs +4 -6
- package/dist/internal/nextjs/utils/index.cjs +0 -1
- package/dist/internal/nextjs/utils/index.mjs +0 -1
- package/dist/internal/sentry/index.cjs +2 -3
- package/dist/internal/sentry/index.mjs +1 -2
- package/dist/internal/sentry/sentry.client.config.cjs +6 -8
- package/dist/internal/sentry/sentry.client.config.mjs +2 -4
- package/dist/internal/tailwind/index.cjs +1 -3
- package/dist/internal/tailwind/index.mjs +0 -2
- package/dist/internal/wagmi/index.cjs +8 -11
- package/dist/internal/wagmi/index.mjs +4 -7
- package/dist/mainnet.cjs +3 -5
- package/dist/mainnet.mjs +2 -4
- package/dist/{sentry.edge.config-F4334LEP.cjs → sentry.edge.config-3Y5ABKSB.cjs} +4 -6
- package/dist/{sentry.edge.config-JU55FF2U.mjs → sentry.edge.config-SIWSKDGR.mjs} +2 -4
- package/dist/{sentry.server.config-M77KFJ6J.mjs → sentry.server.config-HY6I2WQ5.mjs} +2 -4
- package/dist/{sentry.server.config-KFRT37Q3.cjs → sentry.server.config-ZXGUVYT6.cjs} +4 -6
- package/package.json +1 -1
- package/dist/chunk-2XYRGOX3.mjs +0 -64
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-7P6ASYW6.mjs +0 -9
- package/dist/chunk-ADH7F47T.cjs +0 -26
- package/dist/chunk-CAOMAWN5.mjs +0 -26
- package/dist/chunk-NX4FI7G3.cjs +0 -64
- package/dist/internal/edge-config/edgeConfig.codegen.d.ts +0 -344
- package/dist/internal/edge-config/edgeConfig.codegen.d.ts.map +0 -1
- package/dist/internal/edge-config/index.cjs +0 -37
- package/dist/internal/edge-config/index.d.ts +0 -5
- package/dist/internal/edge-config/index.d.ts.map +0 -1
- package/dist/internal/edge-config/index.mjs +0 -37
- package/dist/internal/edge-config/isFlagEnabled.d.ts +0 -17
- package/dist/internal/edge-config/isFlagEnabled.d.ts.map +0 -1
- package/dist/internal/edge-config/safeGetAll.d.ts +0 -15
- package/dist/internal/edge-config/safeGetAll.d.ts.map +0 -1
- package/dist/internal/edge-config/safeGetConfig.d.ts +0 -19
- package/dist/internal/edge-config/safeGetConfig.d.ts.map +0 -1
- package/dist/internal/flags/beraEdgeConfigAdapter.d.ts +0 -9
- package/dist/internal/flags/beraEdgeConfigAdapter.d.ts.map +0 -1
- package/dist/internal/flags/flags.d.ts +0 -29
- package/dist/internal/flags/flags.d.ts.map +0 -1
- package/dist/internal/flags/index.cjs +0 -206
- package/dist/internal/flags/index.d.ts +0 -2
- package/dist/internal/flags/index.d.ts.map +0 -1
- package/dist/internal/flags/index.mjs +0 -206
|
@@ -1,27 +1,80 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkB2BTOQVPcjs = require('../chunk-B2BTOQVP.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkYT7WZDGIcjs = require('../chunk-YT7WZDGI.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkSHM2VD4Acjs = require('../chunk-SHM2VD4A.cjs');
|
|
11
11
|
require('../chunk-MQOVN5NH.cjs');
|
|
12
|
-
require('../chunk-
|
|
12
|
+
require('../chunk-ZJEZCW5Z.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var _chunkWRTYGXJMcjs = require('../chunk-WRTYGXJM.cjs');
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
var _chunkADH7F47Tcjs = require('../chunk-ADH7F47T.cjs');
|
|
20
|
+
var _chunkAU3LYJABcjs = require('../chunk-AU3LYJAB.cjs');
|
|
23
21
|
require('../chunk-EYYJ2UZT.cjs');
|
|
24
|
-
|
|
22
|
+
|
|
23
|
+
// src/internal/dedupeCspSources.ts
|
|
24
|
+
function parseSource(raw) {
|
|
25
|
+
const schemeSplit = raw.indexOf("://");
|
|
26
|
+
if (schemeSplit === -1) {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
const scheme = raw.slice(0, schemeSplit).toLowerCase();
|
|
30
|
+
const rest = raw.slice(schemeSplit + 3);
|
|
31
|
+
const pathStart = rest.indexOf("/");
|
|
32
|
+
const host = (pathStart === -1 ? rest : rest.slice(0, pathStart)).toLowerCase();
|
|
33
|
+
const path = pathStart === -1 ? "/" : rest.slice(pathStart);
|
|
34
|
+
if (!host) {
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
37
|
+
return { raw, scheme, host, path };
|
|
38
|
+
}
|
|
39
|
+
function hostMatches(patternHost, targetHost) {
|
|
40
|
+
if (!patternHost.startsWith("*.")) {
|
|
41
|
+
return patternHost === targetHost;
|
|
42
|
+
}
|
|
43
|
+
const suffix = patternHost.slice(1);
|
|
44
|
+
return targetHost.endsWith(suffix) && targetHost.length > suffix.length;
|
|
45
|
+
}
|
|
46
|
+
function covers(pattern, target) {
|
|
47
|
+
if (pattern.scheme !== target.scheme) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (!hostMatches(pattern.host, target.host)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (pattern.path.endsWith("/")) {
|
|
54
|
+
return target.path.startsWith(pattern.path);
|
|
55
|
+
}
|
|
56
|
+
return target.path === pattern.path;
|
|
57
|
+
}
|
|
58
|
+
function dedupeCspSources(sources) {
|
|
59
|
+
const parsed = sources.map((raw) => ({ raw, parsed: parseSource(raw) }));
|
|
60
|
+
return parsed.filter(({ parsed: target }, i) => {
|
|
61
|
+
if (!target) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return !parsed.some(({ parsed: pattern }, j) => {
|
|
65
|
+
if (i === j || !pattern) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if (!covers(pattern, target)) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (covers(target, pattern)) {
|
|
72
|
+
return j < i;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
});
|
|
76
|
+
}).map(({ raw }) => raw);
|
|
77
|
+
}
|
|
25
78
|
|
|
26
79
|
// src/internal/sentry/getSentryKeys.ts
|
|
27
80
|
function getSentryKeys({
|
|
@@ -47,8 +100,8 @@ function getSentryKeys({
|
|
|
47
100
|
`https://${org}.ingest.us.sentry.io/api/${projectId}/security/?sentry_key=${key}`
|
|
48
101
|
);
|
|
49
102
|
cspEndpoint.searchParams.set("sentry_key", key);
|
|
50
|
-
cspEndpoint.searchParams.set("sentry_env",
|
|
51
|
-
cspEndpoint.searchParams.set("sentry_release",
|
|
103
|
+
cspEndpoint.searchParams.set("sentry_env", _chunkB2BTOQVPcjs.sentryEnvironment);
|
|
104
|
+
cspEndpoint.searchParams.set("sentry_release", _chunkB2BTOQVPcjs.sentryRelease);
|
|
52
105
|
return {
|
|
53
106
|
dsn: match[0],
|
|
54
107
|
projectId,
|
|
@@ -60,146 +113,200 @@ function getSentryKeys({
|
|
|
60
113
|
}
|
|
61
114
|
|
|
62
115
|
// src/internal/header-sources.ts
|
|
116
|
+
var config = _chunkSHM2VD4Acjs.chainConfigs[_chunkAU3LYJABcjs.defaultChainId];
|
|
117
|
+
var modules = {
|
|
118
|
+
berachain: {
|
|
119
|
+
connect: [
|
|
120
|
+
"https://*.berachain.com/",
|
|
121
|
+
"https://*.berachain-staging.com/",
|
|
122
|
+
"https://raw.githubusercontent.com/berachain/metadata/",
|
|
123
|
+
`${_chunkAU3LYJABcjs.imageBaseUrl}/`,
|
|
124
|
+
"https://*.quiknode.pro",
|
|
125
|
+
_chunkAU3LYJABcjs.goldskyBaseUrl,
|
|
126
|
+
// Subgraph queries are served by same-origin typed REST endpoints under
|
|
127
|
+
// /api/honey/* and /api/pol/* (covered by 'self'), not direct browser
|
|
128
|
+
// requests to the upstream URLs.
|
|
129
|
+
config.pol.bribeBoostApi,
|
|
130
|
+
_chunkYT7WZDGIcjs.getUriFromLink.call(void 0, config.api),
|
|
131
|
+
_chunkAU3LYJABcjs.jsonRpcUrl,
|
|
132
|
+
_chunkAU3LYJABcjs.publicJsonRpcUrl,
|
|
133
|
+
_chunkAU3LYJABcjs.alchemyJsonRpcUrl,
|
|
134
|
+
"https://api.routescan.io/v2/network/"
|
|
135
|
+
],
|
|
136
|
+
img: [
|
|
137
|
+
// trailing slash so sub-paths (e.g. /bend-curators/x.png/public) match;
|
|
138
|
+
// CSP path-matches exactly without it
|
|
139
|
+
`${_chunkAU3LYJABcjs.imageBaseUrl}/`,
|
|
140
|
+
"https://raw.githubusercontent.com/berachain/metadata/"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
beranames: {
|
|
144
|
+
connect: [
|
|
145
|
+
// avatars
|
|
146
|
+
"https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/"
|
|
147
|
+
],
|
|
148
|
+
img: [
|
|
149
|
+
"https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/"
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
swapAggregators: {
|
|
153
|
+
connect: [
|
|
154
|
+
`${config.bex.aggregatorsProxyUrl}/`,
|
|
155
|
+
"https://open-api.openocean.finance/",
|
|
156
|
+
"https://api.haiku.trade/",
|
|
157
|
+
"https://api.fly.trade/",
|
|
158
|
+
"https://api.enso.finance/"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
walletConnect: {
|
|
162
|
+
connect: [
|
|
163
|
+
"wss://relay.walletconnect.com/",
|
|
164
|
+
"wss://relay.walletconnect.org/",
|
|
165
|
+
"https://verify.walletconnect.org/v3/public-key"
|
|
166
|
+
],
|
|
167
|
+
frame: [
|
|
168
|
+
"https://verify.walletconnect.com/",
|
|
169
|
+
"https://verify.walletconnect.org/"
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
coinbaseWallet: {
|
|
173
|
+
connect: [
|
|
174
|
+
"wss://www.walletlink.org/rpc",
|
|
175
|
+
"https://www.walletlink.org/events",
|
|
176
|
+
"https://chain-proxy.wallet.coinbase.com/"
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
metamask: {
|
|
180
|
+
connect: [
|
|
181
|
+
"wss://metamask-sdk.api.cx.metamask.io/socket.io/",
|
|
182
|
+
"https://metamask-sdk.api.cx.metamask.io"
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
thirdweb: {
|
|
186
|
+
connect: ["https://*.thirdweb.com/"],
|
|
187
|
+
// export pk iframe
|
|
188
|
+
frame: ["https://embedded-wallet.thirdweb.com/"]
|
|
189
|
+
},
|
|
190
|
+
dynamic: {
|
|
191
|
+
connect: ["https://app.dynamicauth.com/api"]
|
|
192
|
+
},
|
|
193
|
+
porto: {
|
|
194
|
+
connect: ["https://rpc.porto.sh"],
|
|
195
|
+
frame: ["https://id.porto.sh"]
|
|
196
|
+
},
|
|
197
|
+
binance: {
|
|
198
|
+
connect: ["https://wallet.binance.com/tonbridge/"]
|
|
199
|
+
},
|
|
200
|
+
tron: {
|
|
201
|
+
connect: ["https://api.trongrid.io/"]
|
|
202
|
+
},
|
|
203
|
+
layerZero: {
|
|
204
|
+
connect: [
|
|
205
|
+
"https://api-mainnet.layerzero-scan.com/",
|
|
206
|
+
"https://api-testnet.layerzero-scan.com/"
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
pelagus: {
|
|
210
|
+
img: ["https://pelaguswallet.io/docs/img"]
|
|
211
|
+
},
|
|
212
|
+
externalRpcs: {
|
|
213
|
+
// non-Berachain chains read by wallets/bridges
|
|
214
|
+
connect: [
|
|
215
|
+
"https://api.avax.network/ext/bc/C/rpc",
|
|
216
|
+
"https://polygon-rpc.com",
|
|
217
|
+
"https://mainnet.optimism.io/",
|
|
218
|
+
"https://arb1.arbitrum.io/rpc",
|
|
219
|
+
"https://mainnet.base.org/",
|
|
220
|
+
"https://eth.merkle.io"
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
tokenIcons: {
|
|
224
|
+
img: [
|
|
225
|
+
"https://assets.coingecko.com/coins/images/",
|
|
226
|
+
"https://coin-images.coingecko.com/coins/images/",
|
|
227
|
+
"https://icons.llama.fi/",
|
|
228
|
+
"https://icons.llamao.fi/",
|
|
229
|
+
"https://static.debank.com/",
|
|
230
|
+
"https://raw.githubusercontent.com/trustwallet/assets/"
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
bend: {
|
|
234
|
+
connect: [
|
|
235
|
+
// used to fetch tokens
|
|
236
|
+
"https://cdn.whisk.so/"
|
|
237
|
+
],
|
|
238
|
+
img: ["https://cdn.whisk.so/", "https://cdn.morpho.org/"]
|
|
239
|
+
},
|
|
240
|
+
pyth: {
|
|
241
|
+
connect: ["https://hermes.pyth.network/v2/"]
|
|
242
|
+
},
|
|
243
|
+
fonts: {
|
|
244
|
+
font: [
|
|
245
|
+
"https://cdn.jsdelivr.net/npm/@fontsource/",
|
|
246
|
+
// collected by sentry (needed by browser extensions)
|
|
247
|
+
"https://fonts.gstatic.com",
|
|
248
|
+
"https://use.typekit.net/"
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
sentry: {
|
|
252
|
+
// csp reporting
|
|
253
|
+
connect: ["https://*.sentry.io/"]
|
|
254
|
+
},
|
|
255
|
+
posthog: {
|
|
256
|
+
// toolbar + heatmaps
|
|
257
|
+
connect: ["https://*.posthog.com"],
|
|
258
|
+
img: ["https://*.posthog.com"],
|
|
259
|
+
frame: ["https://*.posthog.com"],
|
|
260
|
+
font: ["https://*.posthog.com"],
|
|
261
|
+
style: ["https://*.posthog.com"]
|
|
262
|
+
},
|
|
263
|
+
vercel: {
|
|
264
|
+
// toolbar + live comments
|
|
265
|
+
connect: ["https://vercel.live", "wss://ws-us3.pusher.com"],
|
|
266
|
+
img: ["https://vercel.live", "https://vercel.com"],
|
|
267
|
+
frame: ["https://vercel.live/"],
|
|
268
|
+
font: ["https://vercel.live", "https://assets.vercel.com"],
|
|
269
|
+
style: ["https://vercel.live"]
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
var headerSourceModules = modules;
|
|
63
273
|
function getContentSecurityPolicy({
|
|
64
274
|
isDevelopment,
|
|
65
275
|
nonce,
|
|
66
276
|
cspReporting,
|
|
277
|
+
modules: enabledModules = {},
|
|
67
278
|
...args
|
|
68
279
|
}) {
|
|
69
280
|
const defaultSrc = [];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
"https://verify.walletconnect.org/v3/public-key",
|
|
100
|
-
"https://api.routescan.io/v2/network/",
|
|
101
|
-
"wss://metamask-sdk.api.cx.metamask.io/socket.io/",
|
|
102
|
-
"https://metamask-sdk.api.cx.metamask.io",
|
|
103
|
-
"https://app.dynamicauth.com/api",
|
|
104
|
-
"https://www.walletlink.org/events",
|
|
105
|
-
"https://api.trongrid.io/",
|
|
106
|
-
"https://api-mainnet.layerzero-scan.com/",
|
|
107
|
-
"https://api-testnet.layerzero-scan.com/",
|
|
108
|
-
"https://chain-proxy.wallet.coinbase.com/",
|
|
109
|
-
"https://wallet.binance.com/tonbridge/",
|
|
110
|
-
"https://*.thirdweb.com/",
|
|
111
|
-
"https://eth.merkle.io/",
|
|
112
|
-
"https://cdn.whisk.so/",
|
|
113
|
-
// use to fetch tokens
|
|
114
|
-
// POSTHOG TOOLBAR
|
|
115
|
-
"https://*.posthog.com",
|
|
116
|
-
// VERCEL TOOLBAR
|
|
117
|
-
"https://vercel.live",
|
|
118
|
-
"wss://ws-us3.pusher.com",
|
|
119
|
-
// PYTH
|
|
120
|
-
"https://hermes.pyth.network/v2/",
|
|
121
|
-
// PORTO WALLET
|
|
122
|
-
"https://rpc.porto.sh",
|
|
123
|
-
// external rpc urls
|
|
124
|
-
"https://api.avax.network/ext/bc/C/rpc",
|
|
125
|
-
"https://polygon-rpc.com",
|
|
126
|
-
"https://mainnet.optimism.io/",
|
|
127
|
-
"https://arb1.arbitrum.io/rpc",
|
|
128
|
-
"wss://www.walletlink.org/rpc",
|
|
129
|
-
"https://eth.merkle.io",
|
|
130
|
-
"https://mainnet.base.org/",
|
|
131
|
-
// enso api
|
|
132
|
-
"https://api.enso.finance/",
|
|
133
|
-
"wss://www.walletlink.org/rpc"
|
|
134
|
-
].concat(_nullishCoalesce(args.connectionSources, () => ( []))).filter((link) => {
|
|
135
|
-
if (!link) {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
const url = _chunkYT7WZDGIcjs.getUriFromLink.call(void 0, link);
|
|
139
|
-
if (!url || url.trim() === "") {
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
if (url.startsWith(_chunkWRTYGXJMcjs.goldskyBaseUrl) && url !== _chunkWRTYGXJMcjs.goldskyBaseUrl) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
return true;
|
|
146
|
-
});
|
|
147
|
-
const pictureSources = [
|
|
148
|
-
_chunkWRTYGXJMcjs.imageBaseUrl,
|
|
149
|
-
"https://raw.githubusercontent.com/berachain/metadata/",
|
|
150
|
-
"https://assets.coingecko.com/coins/images/",
|
|
151
|
-
"https://coin-images.coingecko.com/coins/images/",
|
|
152
|
-
"https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/",
|
|
153
|
-
"https://icons.llama.fi/",
|
|
154
|
-
"https://icons.llamao.fi/",
|
|
155
|
-
"https://static.debank.com/",
|
|
156
|
-
"https://cdn.whisk.so/",
|
|
157
|
-
// bend
|
|
158
|
-
"https://cdn.morpho.org/",
|
|
159
|
-
// bend
|
|
160
|
-
"https://raw.githubusercontent.com/trustwallet/assets/",
|
|
161
|
-
// bend
|
|
162
|
-
"https://pelaguswallet.io/docs/img",
|
|
163
|
-
// POSTHOG TOOLBAR
|
|
164
|
-
"https://*.posthog.com",
|
|
165
|
-
// VERCEL TOOLBAR
|
|
166
|
-
"https://vercel.live",
|
|
167
|
-
"https://vercel.com"
|
|
168
|
-
].concat(_nullishCoalesce(args.pictureSources, () => ( []))).filter((url) => {
|
|
169
|
-
if (!url || url.trim() === "") {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
return true;
|
|
173
|
-
});
|
|
174
|
-
const frameSources = [
|
|
175
|
-
"https://verify.walletconnect.com/",
|
|
176
|
-
"https://verify.walletconnect.org/",
|
|
177
|
-
// thirdweb export pk iframe
|
|
178
|
-
"https://embedded-wallet.thirdweb.com/",
|
|
179
|
-
// POSTHOG TOOLBAR
|
|
180
|
-
"https://*.posthog.com",
|
|
181
|
-
// VERCEL TOOLBAR
|
|
182
|
-
"https://vercel.live/",
|
|
183
|
-
// PORTO WALLET
|
|
184
|
-
"https://id.porto.sh"
|
|
185
|
-
].concat(_nullishCoalesce(args.frameSources, () => ( [])));
|
|
186
|
-
const fontSources = [
|
|
187
|
-
"https://cdn.jsdelivr.net/npm/@fontsource/",
|
|
188
|
-
// POSTHOG TOOLBAR
|
|
189
|
-
"https://*.posthog.com",
|
|
190
|
-
// VERCEL TOOLBAR
|
|
191
|
-
"https://vercel.live",
|
|
192
|
-
"https://assets.vercel.com",
|
|
193
|
-
// collected by sentry (need by browsers extensions)
|
|
194
|
-
"https://fonts.gstatic.com",
|
|
195
|
-
"https://use.typekit.net/"
|
|
196
|
-
].concat(_nullishCoalesce(args.fontSources, () => ( [])));
|
|
197
|
-
const styleSources = [
|
|
198
|
-
// POSTHOG TOOLBAR
|
|
199
|
-
"https://*.posthog.com",
|
|
200
|
-
// VERCEL TOOLBAR
|
|
201
|
-
"https://vercel.live"
|
|
202
|
-
].concat(_nullishCoalesce(args.styleSources, () => ( [])));
|
|
281
|
+
function collect(directive) {
|
|
282
|
+
return Object.entries(headerSourceModules).filter(
|
|
283
|
+
([module]) => enabledModules[module] !== false
|
|
284
|
+
).flatMap(([, sources]) => _nullishCoalesce(sources[directive], () => ( []))).filter((url) => Boolean(_optionalChain([url, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()])));
|
|
285
|
+
}
|
|
286
|
+
const connectionSources = dedupeCspSources(
|
|
287
|
+
collect("connect").concat(_nullishCoalesce(args.connectionSources, () => ( []))).filter((link) => {
|
|
288
|
+
const url = _chunkYT7WZDGIcjs.getUriFromLink.call(void 0, link);
|
|
289
|
+
if (!url || url.trim() === "") {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
if (url.startsWith(_chunkAU3LYJABcjs.goldskyBaseUrl) && url !== _chunkAU3LYJABcjs.goldskyBaseUrl) {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
return true;
|
|
296
|
+
})
|
|
297
|
+
);
|
|
298
|
+
const pictureSources = dedupeCspSources(
|
|
299
|
+
collect("img").concat(_nullishCoalesce(args.pictureSources, () => ( [])))
|
|
300
|
+
);
|
|
301
|
+
const frameSources = dedupeCspSources(
|
|
302
|
+
collect("frame").concat(_nullishCoalesce(args.frameSources, () => ( [])))
|
|
303
|
+
);
|
|
304
|
+
const fontSources = dedupeCspSources(
|
|
305
|
+
collect("font").concat(_nullishCoalesce(args.fontSources, () => ( [])))
|
|
306
|
+
);
|
|
307
|
+
const styleSources = dedupeCspSources(
|
|
308
|
+
collect("style").concat(_nullishCoalesce(args.styleSources, () => ( [])))
|
|
309
|
+
);
|
|
203
310
|
let cspHeader = `
|
|
204
311
|
default-src 'self' ${defaultSrc.join(" ")};
|
|
205
312
|
base-uri 'self';
|
|
@@ -223,7 +330,7 @@ function getContentSecurityPolicy({
|
|
|
223
330
|
}
|
|
224
331
|
var staticPictureSources = [
|
|
225
332
|
// Only add image delivery URL if it exists and can be processed
|
|
226
|
-
|
|
333
|
+
`${_chunkAU3LYJABcjs.imageBaseUrl}/`,
|
|
227
334
|
"https://raw.githubusercontent.com/berachain/metadata/",
|
|
228
335
|
"https://assets.coingecko.com/coins/images/",
|
|
229
336
|
"https://berachain.ghost.io/content/images/"
|
|
@@ -234,9 +341,10 @@ var staticPictureSources = [
|
|
|
234
341
|
return true;
|
|
235
342
|
});
|
|
236
343
|
function cspMiddleware({
|
|
237
|
-
response
|
|
344
|
+
response,
|
|
345
|
+
modules: modules2
|
|
238
346
|
}) {
|
|
239
|
-
const sentryCspEndpoint = _optionalChain([getSentryKeys, 'call',
|
|
347
|
+
const sentryCspEndpoint = _optionalChain([getSentryKeys, 'call', _5 => _5(), 'optionalAccess', _6 => _6.cspEndpoint]);
|
|
240
348
|
const nonce = Buffer.from(crypto.randomUUID()).toString("base64");
|
|
241
349
|
const isDevelopment = process.env.NODE_ENV === "development";
|
|
242
350
|
const headers = [
|
|
@@ -244,8 +352,9 @@ function cspMiddleware({
|
|
|
244
352
|
key: "Content-Security-Policy",
|
|
245
353
|
value: getContentSecurityPolicy({
|
|
246
354
|
isDevelopment,
|
|
247
|
-
cspReporting: _optionalChain([sentryCspEndpoint, 'optionalAccess',
|
|
248
|
-
nonce
|
|
355
|
+
cspReporting: _optionalChain([sentryCspEndpoint, 'optionalAccess', _7 => _7.toString, 'call', _8 => _8()]),
|
|
356
|
+
nonce,
|
|
357
|
+
modules: modules2
|
|
249
358
|
})
|
|
250
359
|
},
|
|
251
360
|
{
|
|
@@ -280,4 +389,5 @@ function cspMiddleware({
|
|
|
280
389
|
|
|
281
390
|
|
|
282
391
|
|
|
283
|
-
|
|
392
|
+
|
|
393
|
+
exports.cspMiddleware = cspMiddleware; exports.getContentSecurityPolicy = getContentSecurityPolicy; exports.headerSourceModules = headerSourceModules; exports.staticPictureSources = staticPictureSources;
|
|
@@ -1,7 +1,110 @@
|
|
|
1
1
|
import type { NextRequest, NextResponse } from "next/server";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* CSP allowlists contributed by one integration, keyed by directive.
|
|
4
|
+
*/
|
|
5
|
+
interface HeaderSources {
|
|
6
|
+
/** connect-src */
|
|
7
|
+
connect?: Array<string | undefined>;
|
|
8
|
+
/** img-src */
|
|
9
|
+
img?: string[];
|
|
10
|
+
/** frame-src */
|
|
11
|
+
frame?: string[];
|
|
12
|
+
/** font-src */
|
|
13
|
+
font?: string[];
|
|
14
|
+
/** style-src */
|
|
15
|
+
style?: string[];
|
|
16
|
+
}
|
|
17
|
+
declare const modules: {
|
|
18
|
+
readonly berachain: {
|
|
19
|
+
readonly connect: ["https://*.berachain.com/", "https://*.berachain-staging.com/", "https://raw.githubusercontent.com/berachain/metadata/", "https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/", "https://*.quiknode.pro", "https://api.goldsky.com/api/public/project_clq1h5ct0g4a201x18tfte5iv/subgraphs/", string, string, string, string, string | undefined, "https://api.routescan.io/v2/network/"];
|
|
20
|
+
readonly img: ["https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/", "https://raw.githubusercontent.com/berachain/metadata/"];
|
|
21
|
+
};
|
|
22
|
+
readonly beranames: {
|
|
23
|
+
readonly connect: ["https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/"];
|
|
24
|
+
readonly img: ["https://beranames-assets-berachain.s3.eu-central-003.backblazeb2.com/"];
|
|
25
|
+
};
|
|
26
|
+
readonly swapAggregators: {
|
|
27
|
+
readonly connect: [`${string}/`, "https://open-api.openocean.finance/", "https://api.haiku.trade/", "https://api.fly.trade/", "https://api.enso.finance/"];
|
|
28
|
+
};
|
|
29
|
+
readonly walletConnect: {
|
|
30
|
+
readonly connect: ["wss://relay.walletconnect.com/", "wss://relay.walletconnect.org/", "https://verify.walletconnect.org/v3/public-key"];
|
|
31
|
+
readonly frame: ["https://verify.walletconnect.com/", "https://verify.walletconnect.org/"];
|
|
32
|
+
};
|
|
33
|
+
readonly coinbaseWallet: {
|
|
34
|
+
readonly connect: ["wss://www.walletlink.org/rpc", "https://www.walletlink.org/events", "https://chain-proxy.wallet.coinbase.com/"];
|
|
35
|
+
};
|
|
36
|
+
readonly metamask: {
|
|
37
|
+
readonly connect: ["wss://metamask-sdk.api.cx.metamask.io/socket.io/", "https://metamask-sdk.api.cx.metamask.io"];
|
|
38
|
+
};
|
|
39
|
+
readonly thirdweb: {
|
|
40
|
+
readonly connect: ["https://*.thirdweb.com/"];
|
|
41
|
+
readonly frame: ["https://embedded-wallet.thirdweb.com/"];
|
|
42
|
+
};
|
|
43
|
+
readonly dynamic: {
|
|
44
|
+
readonly connect: ["https://app.dynamicauth.com/api"];
|
|
45
|
+
};
|
|
46
|
+
readonly porto: {
|
|
47
|
+
readonly connect: ["https://rpc.porto.sh"];
|
|
48
|
+
readonly frame: ["https://id.porto.sh"];
|
|
49
|
+
};
|
|
50
|
+
readonly binance: {
|
|
51
|
+
readonly connect: ["https://wallet.binance.com/tonbridge/"];
|
|
52
|
+
};
|
|
53
|
+
readonly tron: {
|
|
54
|
+
readonly connect: ["https://api.trongrid.io/"];
|
|
55
|
+
};
|
|
56
|
+
readonly layerZero: {
|
|
57
|
+
readonly connect: ["https://api-mainnet.layerzero-scan.com/", "https://api-testnet.layerzero-scan.com/"];
|
|
58
|
+
};
|
|
59
|
+
readonly pelagus: {
|
|
60
|
+
readonly img: ["https://pelaguswallet.io/docs/img"];
|
|
61
|
+
};
|
|
62
|
+
readonly externalRpcs: {
|
|
63
|
+
readonly connect: ["https://api.avax.network/ext/bc/C/rpc", "https://polygon-rpc.com", "https://mainnet.optimism.io/", "https://arb1.arbitrum.io/rpc", "https://mainnet.base.org/", "https://eth.merkle.io"];
|
|
64
|
+
};
|
|
65
|
+
readonly tokenIcons: {
|
|
66
|
+
readonly img: ["https://assets.coingecko.com/coins/images/", "https://coin-images.coingecko.com/coins/images/", "https://icons.llama.fi/", "https://icons.llamao.fi/", "https://static.debank.com/", "https://raw.githubusercontent.com/trustwallet/assets/"];
|
|
67
|
+
};
|
|
68
|
+
readonly bend: {
|
|
69
|
+
readonly connect: ["https://cdn.whisk.so/"];
|
|
70
|
+
readonly img: ["https://cdn.whisk.so/", "https://cdn.morpho.org/"];
|
|
71
|
+
};
|
|
72
|
+
readonly pyth: {
|
|
73
|
+
readonly connect: ["https://hermes.pyth.network/v2/"];
|
|
74
|
+
};
|
|
75
|
+
readonly fonts: {
|
|
76
|
+
readonly font: ["https://cdn.jsdelivr.net/npm/@fontsource/", "https://fonts.gstatic.com", "https://use.typekit.net/"];
|
|
77
|
+
};
|
|
78
|
+
readonly sentry: {
|
|
79
|
+
readonly connect: ["https://*.sentry.io/"];
|
|
80
|
+
};
|
|
81
|
+
readonly posthog: {
|
|
82
|
+
readonly connect: ["https://*.posthog.com"];
|
|
83
|
+
readonly img: ["https://*.posthog.com"];
|
|
84
|
+
readonly frame: ["https://*.posthog.com"];
|
|
85
|
+
readonly font: ["https://*.posthog.com"];
|
|
86
|
+
readonly style: ["https://*.posthog.com"];
|
|
87
|
+
};
|
|
88
|
+
readonly vercel: {
|
|
89
|
+
readonly connect: ["https://vercel.live", "wss://ws-us3.pusher.com"];
|
|
90
|
+
readonly img: ["https://vercel.live", "https://vercel.com"];
|
|
91
|
+
readonly frame: ["https://vercel.live/"];
|
|
92
|
+
readonly font: ["https://vercel.live", "https://assets.vercel.com"];
|
|
93
|
+
readonly style: ["https://vercel.live"];
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export type HeaderSourceModule = keyof typeof modules;
|
|
97
|
+
/**
|
|
98
|
+
* CSP sources grouped by the integration that needs them. All modules are
|
|
99
|
+
* enabled by default; consumers opt out per module via `modules` on
|
|
100
|
+
* {@link getContentSecurityPolicy} / {@link cspMiddleware}.
|
|
101
|
+
*/
|
|
102
|
+
export declare const headerSourceModules: Record<HeaderSourceModule, HeaderSources>;
|
|
103
|
+
export declare function getContentSecurityPolicy({ isDevelopment, nonce, cspReporting, modules: enabledModules, ...args }: {
|
|
3
104
|
isDevelopment: boolean;
|
|
4
105
|
nonce: string;
|
|
106
|
+
/** per-module toggle; all modules default to `true`, set `false` to exclude one from every directive */
|
|
107
|
+
modules?: Partial<Record<HeaderSourceModule, boolean>>;
|
|
5
108
|
frameSources?: string[];
|
|
6
109
|
fontSources?: string[];
|
|
7
110
|
pictureSources?: string[];
|
|
@@ -13,8 +116,11 @@ export declare function getContentSecurityPolicy({ isDevelopment, nonce, cspRepo
|
|
|
13
116
|
* Static picture sources that are used in static-monobera.
|
|
14
117
|
*/
|
|
15
118
|
export declare const staticPictureSources: string[];
|
|
16
|
-
export declare function cspMiddleware({ response, }: {
|
|
119
|
+
export declare function cspMiddleware({ response, modules, }: {
|
|
17
120
|
request: NextRequest;
|
|
18
121
|
response: NextResponse;
|
|
122
|
+
/** per-module toggle; all modules default to `true`, set `false` to exclude one from the CSP */
|
|
123
|
+
modules?: Partial<Record<HeaderSourceModule, boolean>>;
|
|
19
124
|
}): NextResponse<unknown>;
|
|
125
|
+
export {};
|
|
20
126
|
//# sourceMappingURL=header-sources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-sources.d.ts","sourceRoot":"","sources":["../../src/internal/header-sources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"header-sources.d.ts","sourceRoot":"","sources":["../../src/internal/header-sources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgB7D;;GAEG;AACH,UAAU,aAAa;IACrB,kBAAkB;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,gBAAgB;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,gBAAgB;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0JqC,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,OAAO,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,kBAAkB,EAAE,aAAa,CACjE,CAAC;AAEV,wBAAgB,wBAAwB,CAAC,EACvC,aAAa,EACb,KAAK,EACL,YAAY,EACZ,OAAO,EAAE,cAAmB,EAC5B,GAAG,IAAI,EACR,EAAE;IACD,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,wGAAwG;IACxG,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAwET;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAWvC,CAAC;AAEH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,OAAO,GACR,EAAE;IACD,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,gGAAgG;IAChG,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC;CACxD,yBA8CA"}
|