security(evidence): stop reversible actor disclosure and bound export database work #1397

Closed
opened 2026-10-04 12:38:40 +00:00 by PlasticDigits · 2 comments
Owner

Summary and severity

Medium privacy and public resource availability. Public exports need realistic privacy guarantees and bounded query work; stable unsalted hashes with transaction linkage do not provide anonymity.

Internal review references: KIMIK3 LEAK-01, RES-01. Investigated against source revision 748579ab718026efad54afcef4b2a5186fe82662 on 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

actor_hash is the first 16 bytes of unsalted SHA-256 of a Terra address, stable across all days. Published transaction hash/time/order and amount linkage lets an observer resolve actors from public chain data even if the digest is changed. The endpoint should therefore not claim strong anonymity. /evidence/daily is public under broad API limits; output row caps do not bound underlying SQL work, and this query path lacks the transaction-local statement timeout already used for liquidity snapshots.

Why a new implementation is needed

Public exports need realistic privacy guarantees and bounded query work; stable unsalted hashes with transaction linkage do not provide anonymity.

Constraints and guardrails

  • No raw user addresses, secrets, production activity dumps or conversation excerpts in issue/test receipts.
  • Preserve required fee/surface accounting and public protocol contract identities. Do not silently change the public export contract without version/documentation.
  • SET LOCAL timeout must not leak through pooled sessions; canceled queries must release permits/connections.

Relevant files

  • Define the public evidence privacy contract: publish aggregate/unlinkable statistics when anonymity is required, or label transaction-linked exports accurately as pseudonymous/public-chain data.
  • If per-period actor grouping remains needed, use a versioned server-secret HMAC with rotation and controlled linkage; HMAC alone does not defeat transaction-hash deanonymization.
  • Give export queries dedicated admission/concurrency, transaction-local SQL timeout, bounded pagination and cancellation; ensure limits bound work, not just output.
  • Version cursor/schema behavior and document any restricted operational evidence path separately.

Acceptance criteria

  • Public responses meet a stated realistic privacy policy; synthetic dictionary and transaction-linkage tests cannot defeat a claimed anonymity guarantee.
  • No permanent actor linkage beyond the documented policy; versioned HMAC key rotation does not expose key material.
  • Worst-case empty/dense-day/filter/cursor requests terminate within documented DB/concurrency budgets.
  • A canceled/timed-out export does not starve ordinary route/API queries or leave pooled connections restricted.

Test plan: supported and failure paths

  • Test known synthetic actors across periods, digest/key versions, transaction-linked records and schema/cursor compatibility.
  • Postgres-test dense and empty days, all surfaces, page boundaries, invalid/replayed cursors, statement timeout and connection reuse.
  • Run cargo test --test api_evidence_daily plus security/rate-limit tests; benchmark query plans on synthetic worst-case data.

Test plan: attack, hack and abuse vectors

  • Synthetic address dictionary and tx-hash join attempts; demonstrate why unsalted hashing and HMAC-only linkage are insufficient for anonymity.
  • Concurrent scans, repeated empty-day exports, pagination churn, cancellation and proxy identity spoofing must stay bounded.
  • Malformed cursor/SQL-looking input must remain parameterized with sanitized errors and no actor/secret leakage.

Verification criteria

  • Hash construction, transaction linkage and missing export-local SQL timeout were source-verified; no real-user deanonymization or production stress was attempted.
  • Require privacy-contract tests and measured worst-case DB/admission/cancellation receipts, preserving valid fee evidence.
    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.

Closed #1205 explicitly excluded HMAC salts/access changes; this is a new privacy/resource hardening scope, not a regression of its original redaction criteria. Coordinate with open #1206 aggregate activity work.

1396: database-isolation, 1395: parser-integrity. Each report owns its stated acceptance scope.

## Summary and severity Medium privacy and public resource availability. Public exports need realistic privacy guarantees and bounded query work; stable unsalted hashes with transaction linkage do not provide anonymity. Internal review references: KIMIK3 LEAK-01, RES-01. Investigated against source revision `748579ab718026efad54afcef4b2a5186fe82662` on 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 actor_hash is the first 16 bytes of unsalted SHA-256 of a Terra address, stable across all days. Published transaction hash/time/order and amount linkage lets an observer resolve actors from public chain data even if the digest is changed. The endpoint should therefore not claim strong anonymity. /evidence/daily is public under broad API limits; output row caps do not bound underlying SQL work, and this query path lacks the transaction-local statement timeout already used for liquidity snapshots. ## Why a new implementation is needed Public exports need realistic privacy guarantees and bounded query work; stable unsalted hashes with transaction linkage do not provide anonymity. ## Constraints and guardrails - No raw user addresses, secrets, production activity dumps or conversation excerpts in issue/test receipts. - Preserve required fee/surface accounting and public protocol contract identities. Do not silently change the public export contract without version/documentation. - SET LOCAL timeout must not leak through pooled sessions; canceled queries must release permits/connections. ## Relevant files - [indexer/src/api/evidence.rs](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/indexer/src/api/evidence.rs) - [indexer/src/db/queries/evidence_daily.rs](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/indexer/src/db/queries/evidence_daily.rs) - [indexer/src/api/mod.rs](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/indexer/src/api/mod.rs) - [indexer/src/db/queries/liquidity_snapshots.rs](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/indexer/src/db/queries/liquidity_snapshots.rs) - [indexer/tests/api_evidence_daily.rs](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/commit/748579ab718026efad54afcef4b2a5186fe82662/indexer/tests/api_evidence_daily.rs) ## Recommended direction - Define the public evidence privacy contract: publish aggregate/unlinkable statistics when anonymity is required, or label transaction-linked exports accurately as pseudonymous/public-chain data. - If per-period actor grouping remains needed, use a versioned server-secret HMAC with rotation and controlled linkage; HMAC alone does not defeat transaction-hash deanonymization. - Give export queries dedicated admission/concurrency, transaction-local SQL timeout, bounded pagination and cancellation; ensure limits bound work, not just output. - Version cursor/schema behavior and document any restricted operational evidence path separately. ## Acceptance criteria - [ ] Public responses meet a stated realistic privacy policy; synthetic dictionary and transaction-linkage tests cannot defeat a claimed anonymity guarantee. - [ ] No permanent actor linkage beyond the documented policy; versioned HMAC key rotation does not expose key material. - [ ] Worst-case empty/dense-day/filter/cursor requests terminate within documented DB/concurrency budgets. - [ ] A canceled/timed-out export does not starve ordinary route/API queries or leave pooled connections restricted. ## Test plan: supported and failure paths - Test known synthetic actors across periods, digest/key versions, transaction-linked records and schema/cursor compatibility. - Postgres-test dense and empty days, all surfaces, page boundaries, invalid/replayed cursors, statement timeout and connection reuse. - Run cargo test --test api_evidence_daily plus security/rate-limit tests; benchmark query plans on synthetic worst-case data. ## Test plan: attack, hack and abuse vectors - Synthetic address dictionary and tx-hash join attempts; demonstrate why unsalted hashing and HMAC-only linkage are insufficient for anonymity. - Concurrent scans, repeated empty-day exports, pagination churn, cancellation and proxy identity spoofing must stay bounded. - Malformed cursor/SQL-looking input must remain parameterized with sanitized errors and no actor/secret leakage. ## Verification criteria - Hash construction, transaction linkage and missing export-local SQL timeout were source-verified; no real-user deanonymization or production stress was attempted. - Require privacy-contract tests and measured worst-case DB/admission/cancellation receipts, preserving valid fee evidence. 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 work and duplicate check Closed #1205 explicitly excluded HMAC salts/access changes; this is a new privacy/resource hardening scope, not a regression of its original redaction criteria. Coordinate with open #1206 aggregate activity work. ## Related remediation reports [1396: database-isolation](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1396), [1395: parser-integrity](https://git.cl8y.com/code/cl8y-dex-terraclassic/issues/1395). Each report owns its stated acceptance scope.
Author
Owner

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: Remove reversible actor disclosure and bound activity export database work. No evidence/export implementation changes are included in this merge. This issue stays open for that substantive work, not merely a verification hold.

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: Remove reversible actor disclosure and bound activity export database work. No evidence/export implementation changes are included in this merge. This issue stays open for that substantive work, not merely a verification hold.
Author
Owner

Merged PR #1424. Integrated evidence schema 2 still omits actor identifiers/digests while documenting public transaction linkage, with bounded admission, cursor scope, SQL work/timeouts and cancellation recovery. Reconciled its deployment instructions with #1396: apply the six indexes through the separate migrator before starting the runtime.

Final make verify-issue-1397: 5 library, 15 API and 7 database-budget/recovery tests pass twice. No focused failures or skips. The six non-concurrent indexes still need production lock/storage planning and deployment through #1421; local synthetic receipts do not establish production latency.

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.

Merged PR #1424. Integrated evidence schema 2 still omits actor identifiers/digests while documenting public transaction linkage, with bounded admission, cursor scope, SQL work/timeouts and cancellation recovery. Reconciled its deployment instructions with #1396: apply the six indexes through the separate migrator before starting the runtime. Final make verify-issue-1397: 5 library, 15 API and 7 database-budget/recovery tests pass twice. No focused failures or skips. The six non-concurrent indexes still need production lock/storage planning and deployment through #1421; local synthetic receipts do not establish production latency. 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](https://git.cl8y.com/code/cl8y-dex-terraclassic/src/branch/main/docs/qa/merge-2026-10-06-final/README.md). Source closure does not claim production deployment.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code/cl8y-dex-terraclassic#1397
No description provided.