security(indexer/dev): separate database privileges and prevent production QA mutation #1396
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#1396
Loading…
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 and severity
Medium environment-dependent integrity; High if exposed administrative DB access is confirmed. Runtime database privileges, opt-in networking and QA mutation barriers must constrain accidental or compromised administrative access to financial data.
Internal review references: KIMIK3 AUTH-02, TRU-04, DB-01; chain Q. Investigated against source revision
748579ab718026efad54afcef4b2a5186fe82662on 2026-10-04. These are engineering findings, not third-party audit certification. Only technical findings and synthetic test cases are included; no conversation, user identity, credentials or real-user activity is published.Current codebase and evidence
Compose initializes the application-named Postgres bootstrap role; no least-privilege runtime/migration split is provisioned. The automatically loaded docker-compose.override.yml enables host networking for Postgres, removing the intended loopback port-publication boundary. Reachability depends on host/firewall and must be measured, not assumed internet exposure. seed-qa is dispatched before run-mode checks and opens the configured database, runs migrations and can clean/seed it.
A reachable administrative database, misused runtime credential or accidentally invoked production seed command can corrupt balances, activity and downstream price/fee reports. This is not a demonstrated unauthenticated SQL injection. The local verifier also encountered an existing shared migration checksum mismatch; fresh isolated API binaries passed all 55 tests, confirming shared-state risk rather than a new product assertion failure.
Why a new implementation is needed
Runtime database privileges, opt-in networking and QA mutation barriers must constrain accidental or compromised administrative access to financial data.
Constraints and guardrails
Relevant files
Recommended direction
Acceptance criteria
Test plan: supported and failure paths
Test plan: attack, hack and abuse vectors
Verification criteria
Record revision, UTC time, exact commands, outcomes and evidence scope. Complete runnable checks first. Unavailable signing, deployment, device or infrastructure checks must be explicitly recorded as unverified; they do not block filing or implementation. An executed failure remains FAIL. Never claim deployment acceptance from unit tests or read-only probes. Public receipts must use synthetic identities and omit secrets.
Related remediation reports
1395: parser-integrity, 1397: evidence-boundaries. Each report owns its stated acceptance scope.
Merge sweep 2026-10-05: the two existing October 4 audit reports are being preserved on main with the sanity receipt. They document findings; committing them does not implement remediation.
Remaining implementation: Separate indexer database privileges and prevent production QA mutation. The merge checks use a new isolated test database; production privilege/runtime controls remain to be implemented. This issue stays open for that substantive work, not merely a verification hold.
Merged PR #1426 and the integrated sanity corrections. Resolved the Makefile conflict by retaining every verifier. Config library/API fixtures now use isolated empty dotenv files, preserving actual runtime rejection of QA/migration credentials. Disposable ACL probes require the final TCP server, avoiding the temporary PostgreSQL startup socket race. Evidence-index deployment now uses the separate scoped migrator.
Final make verify-issue-1396: 28 PASS, 0 FAIL, 2 explicit host-network skips; 564 library and 43 API-security tests plus real CLI/ACL/database isolation checks repeated. Initial dotenv and readiness failures were corrected and retested. Published-loopback on a custom bridge times out and host IPv6 is disabled; internal confinement and host-mode IPv4 pass. Production role transition, scoped migration job and live ACL/exposure rollout remain actual deployment tasks in #1421.
All four source PRs #1424–#1427 are merged; final receipt published through #1430. Local main is reconciled with both remotes, with no stashes. Hosted CI was skipped by explicit operator instruction; no fake PASS status was posted. Original merge protection is restored. Integrated evidence. Source closure does not claim production deployment.
2026-10-07 reconfirmation. Source closure stands on the existing receipt: 28 PASS, 0 FAIL, 2 explicit host-network skips. This pass did not rebuild that suite.
The production role transition remains the #1385 maintenance receipt: 61 migrations, schema marker 20261006133000, history preserved, and four runtime permission denials.
make verify-issue-1396does not replace that receipt.Related: #1421, #1385.
PR #1440 (the 2026-10-07 release-close record) is merged and its head
2b608556is an ancestor of main.The branch was behind main, so a normal merge returned 405. Updating it onto main made ci/woodpecker/pr/woodpecker pending. Local scripts/qa/verify-issue-1421.sh then passed all cross-link checks. The hosted status gate was overridden so the already-reviewed record could land; no conflict resolution was required. This does not add a new production execution receipt. The earlier contract PASS with production execution UNVERIFIED, and the planned Bridge-Debt journal, are unchanged.
Merge sanity for #1447/#1448: the final #1396 run passed 28 checks with zero failures and two explicit host-network/IPv6 skips, including the authenticated runtime-login fixture. Its initial targeted run correctly rejected the disposable cluster's unrelated application-database CONNECT grant; revoking that fixture grant and rerunning passed. Application code and assertions were unchanged.
The initial Compose socket probe was cancelled after internal SQL succeeded but published host port 48437 gave no response; the separate QA cluster's published port worked. Host IPv6 is disabled. These are explicit unavailable coverage, not socket PASS. Local source rendering, database isolation and real fresh ACL checks completed. Follow-up coverage is tracked by #1449; this completed source issue remains closed. Receipt.
PlasticDigits referenced this issue2026-10-10 11:10:08 +00:00