Harden entry safety, unify runtime config, bound document unpacking
Shared-IP safety: entry autoban and entry notifications default off, and a shared IP is treated as review evidence only. ban_user/ban_cluster refuse reason=entry_ip_collision (also with the legacy flag set to 1), so token status and quota are never touched; explicit admin moderation still works. Reproducible startup: new bot/runtime_config.py and scripts/run.py load the repository .env (or --env-file) without shell interpolation, normalize config/DB/upstream aliases, and make the bot, Mini App, gateway, econ cap, account admin, mk_daemon, entry admin and key notifications resolve the same paths. "run.py <target> --check" is an offline preflight that starts nothing and reports placeholders, missing upstream DB and invalid data directories. Resource limits: aggregate Office decompression, a 400 read-entry cap and a per-row XLSX cell budget stop early; truncated or corrupt archives are reported instead of raising. Deploy and docs: only source-backed systemd units remain, and deploy/runtime.env.example documents the environment contract including the 0600 session-secret file rules. Removed the destructive "cp bot/iishko_bot.py bot/grok_bot.py" instruction, the unused generated site/ snapshot and the unsupported iishko-ts staging unit; corrected .env.example, README, ARCHITECTURE, SECURITY, docs/native-gateway.md and iishko-ts/README.md. Tests: entry safety, runtime bootstrap, economy paths, file intake, deploy contract, abilities_guard CLI, and a startup smoke that launches all three components through scripts/run.py with non-loopback network blocked. Every config reader, selfcheck included, accepts a UTF-8 BOM. Verified on this tree: pytest 716 passed + 322 subtests, node --test 73/73, go test and go vet clean, selfcheck --source-only ok, gitleaks worktree and history 0 findings. No production or live-split changes are included.
This commit is contained in:
+13
-9
@@ -3,15 +3,13 @@
|
||||
# cp .env.example .env
|
||||
|
||||
# === Layout ===
|
||||
# Root of the runtime tree that bot/gateway modules are resolved from.
|
||||
# Use an ABSOLUTE path: commerce/key-daemon code resolves modules from it.
|
||||
IISHKO_APP_ROOT=/absolute/path/to/this/repo/bot
|
||||
# Bot module directory; scripts/run.py resolves relative paths from the repo root.
|
||||
IISHKO_APP_ROOT=./bot
|
||||
# Optional override of the bot source file. Default: $IISHKO_APP_ROOT/grok_bot.py
|
||||
IISHKO_BOT_SOURCE=
|
||||
# Module search path for a local run (production flattens both dirs together):
|
||||
# POSIX: export PYTHONPATH=bot:gateway
|
||||
# Windows: set PYTHONPATH=bot;gateway
|
||||
PYTHONPATH=bot:gateway
|
||||
# scripts/run.py sets the cross-platform module path; no manual PYTHONPATH needed.
|
||||
# Direct starts from the repo root: POSIX PYTHONPATH="$PWD/bot:$PWD/gateway:$PWD/bot/webapp"
|
||||
# PowerShell: $env:PYTHONPATH="$PWD/bot;$PWD/gateway;$PWD/bot/webapp"
|
||||
|
||||
# === Bot identity ===
|
||||
GROK_BOT_TOKEN=REPLACE_ME_TELEGRAM_BOT_TOKEN
|
||||
@@ -22,9 +20,12 @@ GROK_BOT_ALLOW_LOCAL=1 # 1 only for a local single-instanc
|
||||
IISHKO_BOT_DB=./bot.db # bot SQLite: users, keys, economy
|
||||
GROK_BOT_DB=./bot.db # legacy alias of IISHKO_BOT_DB
|
||||
GATE_BOT_DB=./bot.db # gateway-side alias of the same file
|
||||
IISHKO_GW_DB=./one-api.db # external New API SQLite (read-only use)
|
||||
IISHKO_GW_DB=./one-api.db # external New API SQLite; economy/key operations WRITE here
|
||||
IISHKO_SKIN_DB=./skin.db # skin/site accounts
|
||||
# GATE_TG_DB is the legacy alias; IISHKO_SKIN_DB takes precedence.
|
||||
TG_SID_SECRET_FILE=./.local/tg-sid-secret # private login/session secret, never commit
|
||||
GATE_NEWAPI_DB=./one-api.db # legacy alias of IISHKO_GW_DB
|
||||
IISHKO_ECON_STATE=./econ_cap_state.json # shared economy pause/cap state
|
||||
|
||||
# === Upstream (external New API / one-api, AGPL-3.0, not bundled) ===
|
||||
IISHKO_UPSTREAM=http://127.0.0.1:48000 # canonical upstream base URL
|
||||
@@ -68,10 +69,13 @@ IISHKO_SRV_EXCLUDED_IPS=
|
||||
# reading an existing wallet and grants keeps working.
|
||||
|
||||
# === Other optional features, off by default ===
|
||||
IISHKO_ENTRY_AUTOBAN=0 # IP-collision autoban touches balances/keys
|
||||
IISHKO_ENTRY_AUTOBAN=0 # legacy API compatibility; no automatic IP enforcement
|
||||
IISHKO_BC_PREMIUM_AUTOFILL=0 # cosmetic broadcast emoji autofill
|
||||
IISHKO_SANDBOX_ENABLED=0 # external command/file execution surface
|
||||
IISHKO_NOTIFICATIONS_ENABLED=0 # outbound Telegram notifications
|
||||
# Optional delivery kill switches; only meaningful after NOTIFICATIONS_ENABLED=1:
|
||||
# IISHKO_SUPPORT_DELIVERY_ENABLED=0 # suppress support and entry alerts
|
||||
# IISHKO_ENTRY_DELIVERY_ENABLED=0 # suppress entry alerts only
|
||||
IISHKO_MEMORY_OFF=1 # 1 = no persistent chat context in RAM
|
||||
|
||||
# === Media / payments providers (disabled while empty) ===
|
||||
|
||||
Reference in New Issue
Block a user