Security: no runbook queries or SQL snippets for identifying suspicious wallets, pairs, or tokens [SEC-G04] #437
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#437
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
No runbook includes indexer API calls or SQL snippets that help an operator identify a suspicious wallet, pair, or token by transaction pattern. The
emergency-commands.mdhasblacklist_checkcommands that confirm whether a specific address is already blacklisted (a post-identification step), but provides no queries for discovering suspicious activity in the first place. The incident triage template has a "Tx samples" checklist item but no query to surface them.What Was Checked
docs/runbooks/emergency-commands.mdsections 3, 5, 7:blacklist_checkqueries confirm an address is blacklisted. These are confirmation queries, not discovery queries.docs/templates/incident-dex-indexer.mdtriage section "Tx samples": prompts operator to look for "Failed tx codes, out-of-gas, hook reverts" but gives no query or command to find them.docs/runbooks/blacklist-decision.md: classification criteria require "on-chain evidence" but give no query for finding it.docs/integrators.md: reviewed by grep -- no runbook links a specific API call for suspicious-activity discovery.Expected (per checklist)
A runbook must include indexer API calls or SQL snippets for at minimum: top-volume traders in a recent window; wallets with unusually many failed txs; pairs with abnormal swap count or reserve change; tokens with recent blacklist check hits. These allow an operator to surface suspicious activity without needing to construct ad hoc queries under pressure.
Actual
The only wallet/pair/token queries documented are post-identification confirmation checks (is this address already blacklisted?). No discovery queries exist in any runbook.
Evidence
docs/runbooks/emergency-commands.md: blacklist_check queries confirm known addresses, no discovery stepdocs/templates/incident-dex-indexer.md: "Tx samples" bullet has no associated query or commanddocs/runbooks/blacklist-decision.md: requires pre-existing evidence, provides no discovery querySuggested Fix
Add a "Suspicious activity queries" section to
docs/templates/incident-dex-indexer.mdordocs/runbooks/emergency-commands.mdwith: (1) indexer API call to list top traders by volume in a short recent window; (2) SQL or API call for wallets with above-threshold failed tx count in a rolling window; (3) indexer API call for pairs with above-average swap count or reserve delta; (4) SQL for blacklist check hits logged by the compliance endpoint. Include example output and escalation steps.Verification Checklist
Labels
security,pre-launchCc: @PlasticDigits
mentioned in issue #381
mentioned in commit
efc63a7b6bmentioned in merge request !969
Verified #437 docs + ran every documented query live (issue-437-suspicious-activity-queries).
Guard: check_suspicious_activity_queries_docs.py -> OK; verify-issue-437.sh -> PASS 5 / FAIL 0.
Ran the runbook's queries against the live indexer + LCD:
Every snippet executes and all tables/columns resolve against the live schema. The empty results (hook warnings, 1h spike, stale-reserve) are correct for an idle chain, not query errors; volume_usd is null (no USD oracle on localnet) which the runbook already calls out.
All three checklist items covered, queries linked from the incident-template triage. Docs + indexer/LCD only. Good to close from my side — @PlasticDigits merge !969 + close.
mentioned in commit
8de9d708e1mentioned in commit
2f966c048fmentioned in merge request !970
mentioned in commit
255e3630ebmentioned in merge request !972
mentioned in commit
4757f1a2deVerification complete — PASS (no repo changes)
Verified GitLab #437 / SEC-G04 on
main@4757f1a2(includesissue-437-suspicious-activity-queries+ LCDquery=param fix).Acceptance checklist
docs/runbooks/suspicious-activity-queries.md§1 (/api/v1/traders/leaderboard,tradersSQL), §2a (LCDquery=message.module='wasm'+code != 0aggregate), §2b (hook_eventsSQL)/api/v1/pairs,.../stats,swap_eventsspike SQL), §4 (liquidity_events,pair_reservesstale mirror SQL), §5c (token swap rollup SQL)docs/templates/incident-dex-indexer.mdlinks to runbook on Tx samples and Suspicious activity discovery rows;docs/runbooks/blacklist-decision.mdlinks discovery runbookAutomated guards
Live query smoke (LocalTerra + indexer after
make setup-cloud-localterra --fresh --skip-build)Endpoints:
INDEXER_URL=http://127.0.0.1:3001,LCD=http://127.0.0.1:1317, deploy seed60 swaps.terra1x46…— 60 trades;volume_24h0 (no USD oracle on localnet; runbook documents this)trade_count/volume_quote/price_change_pctpopulated;volume_usdnull (localnet)addevents listed (top pair 2 adds)blocked: falsefor top traderAll snippets execute; tables/columns resolve against live schema. Empty or null fields match idle/localnet expectations documented in the runbook, not query errors.
Cross-links / skills
skills/AGENTS_SUSPICIOUS_ACTIVITY_QUERIES.mdpresentscripts/check_suspicious_activity_queries_docs.pyinvariant covers SEC-G04 markers + incident/blacklist cross-linksClosing — criteria satisfied on
main.