Files
bal-server/.env.example
svatantrya 4fc0790fe7 security: fix audit points 5-9 + optimize echo_push/info endpoints
- Point 5 (SSRF): Add URL validation for WELIST_SERVER_URL (src/validation.rs)
- Point 6 (DB Access): Add DB path validation, symlink check, WAL mode (open_db)
- Point 8 (HTTPS): Extract nginx config, add deployment checklist, bind warnings
- Point 9 (Input Validation): Add NETWORKS check (404 for unknown), txid 64-hex validation
- Optimize echo_push: parse transactions outside DB lock, batch duplicate check, N+1 xpub lookup eliminated via HashSet cache
- Optimize echo_info: derive BIP32 address outside DB lock, minimize lock duration
- Fix echo_stats SQL injection via parameter binding + add idx_stats_chain index
- New regression tests: ssrf_tests, db_path_validation, input_validation_tests
2026-07-16 18:59:30 -04:00

57 lines
2.2 KiB
Plaintext

# Gitea API Token for releases
# Get this from your gitea settings: https://bitcoin-after.life/gitea/user-settings/applications
# DO NOT commit the real token to git!
# This file is in .gitignore and should not be committed to git
GITEA_API_TOKEN=your_gitea_api_token_here
# Example: GITEA_API_TOKEN=5cfa8c33e337ebaadb355c0ffa2d053d521ee43b
# (replace with your actual token after revoking the old one)
# === bal-server ===
# !!! WARNING: Never bind to 0.0.0.0 in production. Use 127.0.0.1 and place
# Nginx with TLS in front. Direct exposure will leak transaction data !!!
RUST_LOG=info
BAL_SERVER_DB_FILE=/var/bal/bal.db
BAL_SERVER_BIND_ADDRESS=127.0.0.1
BAL_SERVER_BIND_PORT=9137
BAL_SERVER_INFO="BAL server production"
BAL_SERVER_PUB_KEY_PATH=/var/bal/public_key.pem
BAL_SERVER_BITCOIN_ADDRESS="your_bitcoin_or_xpub_address"
BAL_SERVER_BITCOIN_FIXED_FEE=50000
# Actix Web DoS Protection Settings
BAL_SERVER_ACTIX_MAX_BODY_SIZE=1048576
BAL_SERVER_ACTIX_TIMEOUT_SECS=5
BAL_SERVER_ACTIX_PUSHTXS_PER_SEC=1
BAL_SERVER_ACTIX_PUSHTXS_BURST=3
BAL_SERVER_ACTIX_SEARCHTX_PER_SEC=5
BAL_SERVER_ACTIX_SEARCHTX_BURST=10
BAL_SERVER_ACTIX_INFO_PER_SEC=20
BAL_SERVER_ACTIX_INFO_BURST=30
BAL_SERVER_ACTIX_DEFAULT_PER_SEC=50
BAL_SERVER_ACTIX_DEFAULT_BURST=100
BAL_SERVER_ACTIX_WORKERS=4
BAL_SERVER_ACTIX_MAX_CONNECTIONS=100
# === bal-pusher ===
BAL_PUSHER_DB_FILE=/var/bal/bal.db
BAL_PUSHER_BITCOIN_DIR=/home/bal/.bitcoin
BAL_PUSHER_SEND_STATS=false
BAL_SERVER_URL=http://127.0.0.1:9137
SSL_KEY_PATH=/var/bal/private_key.pem
WELIST_SERVER_URL=https://welist.bitcoin-after.life
# ZMQ endpoints per network (default: localhost only)
BAL_PUSHER_BITCOIN_ZMQ_HASHBLOCK=tcp://127.0.0.1:28332
BAL_PUSHER_REGTEST_ZMQ_HASHBLOCK=tcp://127.0.0.1:23332
BAL_PUSHER_TESTNET_ZMQ_HASHBLOCK=tcp://127.0.0.1:24332
BAL_PUSHER_TESTNET4_ZMQ_HASHBLOCK=tcp://127.0.0.1:22332
BAL_PUSHER_SIGNET_ZMQ_HASHBLOCK=tcp://127.0.0.1:21332
# RPC endpoints per network (default: localhost only)
BAL_PUSHER_BITCOIN_RPC_URL=http://127.0.0.1:8332
BAL_PUSHER_REGTEST_RPC_URL=http://127.0.0.1:18443
BAL_PUSHER_TESTNET_RPC_URL=http://127.0.0.1:18332
BAL_PUSHER_TESTNET4_RPC_URL=http://127.0.0.1:48332
BAL_PUSHER_SIGNET_RPC_URL=http://127.0.0.1:38332