Repository navigation
Conversation
… deploy - Add utils/redact.py and apply it to logs, Telegram sends, crash alerts, the automation digest, and web3 provider errors so RPC/API keys never reach Telegram, the alerts DB/API, or journald. - Run the emergency dispatch hook even when Telegram delivery fails; retry Telegram 429s once after retry_after; truncate by UTF-16 length; share the parse-error plain-text retry with the test-chat path. - Add Alert.dispatch so unconfirmed signals notify without moving funds: stables depegs need two consecutive breaches, 3Jane/Cap PPS drops need a minimum size. Sign a sent_at timestamp into the dispatch body for replay protection. - Per-task timeouts in jobs.yaml (default 3600s, stables 300s) and timeouts on git fetch/reset and uv sync so a hang can't freeze a profile or code sync; timeouts on Gauntlet requests. - Deploy: API unit loads no secrets and cannot read /etc/monitoring; Caddy fails closed on an empty token list; install.sh no longer stores personal gh tokens; CI pins actions to SHAs with read-only permissions. - Explainer: treat supplied context as untrusted and label AI summaries unverified. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes from a security and stability review of the monitoring box. I reproduced the first two issues before fixing them.
Secret leakage (high)
ProviderConnectionErrorput full RPC URLs (/v2/<alchemy-key>) in its message.run_with_alertthen sentstr(exc)to Telegram and stored it inalert_eventsunder the protocol key, which the API and public site query. The automation digest did the same with stderr tails.utils/redact.pymasks configured secrets:PROVIDER_URL_*becomesscheme://host/***, and the values of*_KEY,*_TOKEN,*_SECRETand*_PASSWORDvars become***. It also has pattern fallbacks for bot tokens,?apikey=query params and keys in RPC URL paths.send_telegram_messagebefore the message is stored or sent, in crash alerts, in the digest error tail, in web3 provider errors and logs (host only), and in the dispatched message.Emergency dispatch (high)
finally.retry_after(capped at 30s).Alert.dispatchflag. Unconfirmed signals still alert but don't move funds:sent_at, so the receiver can reject replays.Stability (medium)
timeout:injobs.yaml: default 3600s, 300s for thestablessync-heartbeat task. A timed-out task is killed and shows up in the digest. Before this, a hung task held itsflockforever, and if that wasten_minute, code sync stopped too.git fetch(120s),git reset(60s) anduv sync(600s) now have timeouts.requests.getcalls now have timeouts.Deploy / CI
monitoring-api.service: no longer loads anEnvironmentFile(the API needs no credentials), and/etc/monitoringisInaccessiblePaths.Caddyfile: rejects any bearer value that isn't 64 hex characters before comparing tokens. An emptyALERTS_API_TOKENSpreviously reduced the token check to^Bearer ()$; it now fails closed. I checked this against a local Caddy 2.10.2:The docs now include an
ExecStartPrecheck so Caddy refuses to start without tokens.install.sh: no longer copies the operator's personalgh auth tokeninto~/.git-credentials, a file the service can read. It requires an explicitGITHUB_TOKENand the docs recommend a fine-grained, read-only token.CI: actions pinned to commit SHAs,
permissions: contents: read, andpersist-credentials: false.Runbook: new "Security baseline" section and a note on rotating keys after redaction.
LLM explainer (low)
AI Summary (unverified).Smaller fixes
jobs.yamlcomment about manualuv sync.Behaviour changes to check
PPS_DISPATCH_MIN_DECREASE_PCTandASSETS_PER_SHARE_DISPATCH_MIN_DECREASE_BPSif you want different thresholds.timeout:.install.shre-renders it.Ops follow-ups (not code)
alert_eventsrows.main: required review and CI, no force push, signed commits if possible.ExecStartPretoken check to the caddy drop-in.sent_at.Test plan
uv run pytest tests/: 2074 passed, 4 skipped. New tests cover redaction, 429 retry, hook-on-failure, dispatch gating, task/git/uv timeouts, stables confirmation, and the 3Jane/Cap thresholds.ruff check,ruff format --check,ty checkbash -n deploy/install.sh🤖 Generated with Claude Code