Add lint-log-secrets guard against indexer secret logging (#433) #961
No reviewers
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!961
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-433-lint-log-secrets"
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?
SEC-F13 / #433: the indexer doesn't log secrets today, but nothing enforced it going forward.
What this adds
scripts/check_indexer_log_secrets.py— scansindexer/src/**/*.rsfor logging/print macros (tracing::{info,warn,error,debug,trace}!,log::*,println!/eprintln!/dbg!) whose arguments reference a secret-bearing identifier (database_url,password,mnemonic,private_key,bearer,api_key,secret,credential, ...), or that log the wholeConfigstruct viaDebug.Config(config.rs) derivesDebugand holdsdatabase_url(apostgres://user:password@...string), so{:?}on the whole struct would leak the password — both cases are caught.make lint-log-secretstarget, wired intomake lint.Deliberately does NOT flag bare
token(the indexer is full of trading-token references) orconfig.fieldaccess (only the whole-struct Debug). A proven-safe line can opt out with a trailing// log-secrets-ok: <reason>.Verified
main: the four startuptracing::info!calls log onlyrun_mode/lcd_urls/factory_address/ rate-limits;database_urlis used atconnect()only. Also scanned the live indexer log (~15h) — zeropostgres://strings, zero password leaks.tracing::info!("{}", config.database_url)andtracing::debug!("{:?}", config)are both flagged (exit 1); benignconfig.rate_limit_rps, a tradingask_token, and an opt-out line are correctly NOT flagged.For #433.
mentioned in issue #433
Security review — MR !961
Commit reviewed:
f6b871bd2e5ffd9454aa90ca73f14a69f60a1156Scope:
scripts/check_indexer_log_secrets.py(new),Makefile(lint-log-secretstarget +lintdependency)Outcome: FINDINGS: 0 medium+ — no inline threads.
Summary
Static-analysis guard for indexer secret logging (SEC-F13 / #433). Reviewed added/modified code and traced whether it introduces exploitable runtime attack surface or weakens existing controls.
Script (
check_indexer_log_secrets.py):indexer/src/**/*.rsviaPath.rglob; no attacker-controlled paths, shell execution, network I/O, or deserialization.// log-secrets-okopt-out (visible in MR diffs; requires merge, not a runtime bypass).Makefile: Adds
make lint-log-secretsand wires it into aggregatemake lint; no injection surface.Effectiveness (informational, below reporting threshold): Adversarial probes show expected static-analysis limits (e.g. aliased
database_url, renamedcfg+{:?},serde_json::to_string(&config)not flagged). These are pre-merge developer mistakes, not new attacker-controlled sinks; the guard adds defense-in-depth and does not replace authn/authz or remove existing controls. CI does not yet invokelint-log-secrets(onlymake lintlocally) — enforcement gap, not a vulnerability introduced by this diff.Indexer runtime (unchanged by MR): Startup logging already limits fields to non-secret config (
run_mode,lcd_urls,factory_address, rate limits);database_urlused atconnect()only.Security review: no medium+ findings on this diff. No
block:securitylabel applied.mentioned in merge request !964
mentioned in commit
6fda72dc41