Skip to content

Commit 968db25

Browse files
BarbatosBarbatos
authored andcommitted
docs(config): add recommended security settings for public-facing nodes
- node.http.maxRequestBodySize: 5MB default - node.jsonrpc: maxBatchSize, maxResponseSize, maxRequestTimeout, maxAddressSize with geth-aligned defaults - rate.limiter.http: recommended QPS for TriggerConstantContractServlet and EstimateEnergyServlet - global.qps / global.ip.qps: recommended values in comments - vm.maxEnergyLimitForConstant / maxConcurrentConstantCalls: recommended values in comments
1 parent 303e774 commit 968db25

1 file changed

Lines changed: 36 additions & 2 deletions

File tree

framework/src/main/resources/config.conf

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ node {
176176

177177
maxHttpConnectNumber = 50
178178

179+
http {
180+
# Maximum HTTP request body size in bytes, default 5MB (aligned with geth).
181+
# Rejects oversized requests before buffering. Set to 0 to disable.
182+
# maxRequestBodySize = 5242880
183+
}
184+
179185
minParticipationRate = 15
180186

181187
# allowShieldedTransactionApi = true
@@ -375,6 +381,17 @@ node {
375381
maxSubTopics = 1000
376382
# Allowed maximum number for blockFilter
377383
maxBlockFilterNum = 50000
384+
# Maximum number of requests in a JSON-RPC batch, default 1000 (aligned with geth).
385+
# Set to 0 to disable limit.
386+
# maxBatchSize = 1000
387+
# Maximum response size in bytes, default 25MB (aligned with geth).
388+
# Set to 0 to disable limit.
389+
# maxResponseSize = 26214400
390+
# Maximum request processing time in seconds, default 30 (aligned with geth).
391+
# maxRequestTimeout = 30
392+
# Maximum number of addresses in eth_getLogs filter, default 1000 (aligned with geth).
393+
# Set to 0 to disable limit.
394+
# maxAddressSize = 1000
378395
}
379396

380397
# Disabled api list, it will work for http, rpc and pbft, both FullNode and SolidityNode,
@@ -413,6 +430,19 @@ rate.limiter = {
413430
# component = "ListWitnessesServlet",
414431
# strategy = "QpsRateLimiterAdapter",
415432
# paramString = "qps=1"
433+
# },
434+
435+
# Recommended: rate limit constant call endpoints to mitigate DoS.
436+
# constant calls are free (no TRX cost) and can consume significant CPU.
437+
# {
438+
# component = "TriggerConstantContractServlet",
439+
# strategy = "QpsRateLimiterAdapter",
440+
# paramString = "qps=20"
441+
# },
442+
# {
443+
# component = "EstimateEnergyServlet",
444+
# strategy = "QpsRateLimiterAdapter",
445+
# paramString = "qps=10"
416446
# }
417447
],
418448

@@ -442,9 +472,9 @@ rate.limiter = {
442472
# disconnect = 1.0
443473
}
444474

445-
# global qps, default 50000
475+
# global qps, default 50000. Recommended: 10000 for public-facing nodes.
446476
global.qps = 50000
447-
# IP-based global qps, default 10000
477+
# IP-based global qps, default 10000. Recommended: 1000 for public-facing nodes.
448478
global.ip.qps = 10000
449479
}
450480

@@ -688,7 +718,11 @@ trx.reference.block = "solid" // "head" or "solid"
688718

689719
vm = {
690720
supportConstant = false
721+
# Maximum energy for constant calls. Recommended: 10000000 for public-facing nodes.
722+
# Default 100000000 (~100s CPU per call). Lower values reduce DoS attack surface.
691723
maxEnergyLimitForConstant = 100000000
724+
# Maximum concurrent constant calls. Default 8. Set to 0 to disable limit.
725+
# maxConcurrentConstantCalls = 8
692726
minTimeRatio = 0.0
693727
maxTimeRatio = 5.0
694728
saveInternalTx = false

0 commit comments

Comments
 (0)