Cloud Agent: Postgres bootstrap for indexer integration tests (#335) #818

Merged
PlasticDigits merged 5 commits from cursor/gitlab-issue-workflow-e267 into main 2026-06-05 14:27:33 +00:00
PlasticDigits commented 2026-06-05 14:08:06 +00:00 (Migrated from gitlab.com)

Summary

Closes infrastructure gap from MR !809 / #324: Cloud Agent VMs can provision Postgres + indexer/.env and run indexer integration tests without build-optimized or deploy-dex-local.

Issue: https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/335

Changes

  • make setup-indexer-postgres / scripts/setup-cloud-agent-indexer-postgres.sh
  • scripts/lib/postgres-psql.sh — compose exec fallback when host psql missing
  • make test-indexer-integration, make verify-issue-324, --postgres-only on cloud localterra script
  • Docs + test fix for tier-keyed GET cache (#283)

Acceptance checklist

Criterion Command Result
One-command Postgres + indexer/.env make setup-indexer-postgres PASS
api_route_solve cd indexer && cargo test --test api_route_solve -- --test-threads=1 PASS (23/23)
Full integration suite make test-indexer-integration FAIL — pre-existing indexer_ingestion_hardening (same on origin/main)
Idempotent bootstrap run setup twice PASS
compose exec without host psql this VM PASS
AGENTS.md review PASS
test-setup-postgres make test-setup-postgres PASS
verify-issue-324 make verify-issue-324 PASS

Verification

make setup-indexer-postgres
make verify-issue-324
cd indexer && cargo test --test api_route_solve -- --test-threads=1
make test-setup-postgres

Note

Low Risk
Changes are dev/bootstrap scripts, Makefile targets, documentation, and an integration test seed fix—no production indexer routing or contract logic in this diff.

Overview
Adds a Postgres-only Cloud Agent path so indexer integration tests can run without LocalTerra, optimized wasm, or deploy-dex-local. make setup-indexer-postgres (and scripts/setup-cloud-agent-indexer-postgres.sh) starts dockerd when needed, brings up the compose postgres service, and runs the existing DB bootstrap to write indexer/.env with DATABASE_URL / TEST_DATABASE_URL. The full localterra setup script gains --postgres-only, which can optionally --fresh volumes then delegates to that script.

Postgres setup scripts now use a shared postgres-psql.sh wrapper: host psql when present, otherwise docker compose exec postgres psql (for VMs without postgresql-client). Role bootstrap and DB creation go through this path; bootstrap failures exit 1 instead of silently succeeding after syncing env only. cloud-agent-docker.sh centralizes tmux dockerd + compose helpers for the new bootstrap.

Makefile: test-indexer-integration (setup + serialized cargo test --tests), verify-issue-324 (lib + HTTP cache tier tests via scripts/qa/verify-issue-324.sh). Static checks in test-setup-postgres cover the new wiring.

Test fix: route_solve_get_with_trader_returns_higher_estimate seeds the discount wallet at tier 5 so tier-keyed GET cache (#283) does not treat an unregistered trader like no-trader.

Docs updated in AGENTS.md, docs/testing.md, and postgres/hybrid agent skills.

Reviewed by Cursor Bugbot for commit b4b854c063. Bugbot is set up for automated code reviews on this repo. Configure here.

## Summary Closes infrastructure gap from [MR !809](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/91) / [#324](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/324): Cloud Agent VMs can provision **Postgres + `indexer/.env`** and run indexer **integration tests** without `build-optimized` or `deploy-dex-local`. Issue: https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/335 ### Changes - `make setup-indexer-postgres` / `scripts/setup-cloud-agent-indexer-postgres.sh` - `scripts/lib/postgres-psql.sh` — compose exec fallback when host psql missing - `make test-indexer-integration`, `make verify-issue-324`, `--postgres-only` on cloud localterra script - Docs + test fix for tier-keyed GET cache (#283) ## Acceptance checklist | Criterion | Command | Result | |-----------|---------|--------| | One-command Postgres + indexer/.env | `make setup-indexer-postgres` | PASS | | api_route_solve | `cd indexer && cargo test --test api_route_solve -- --test-threads=1` | PASS (23/23) | | Full integration suite | `make test-indexer-integration` | FAIL — pre-existing `indexer_ingestion_hardening` (same on origin/main) | | Idempotent bootstrap | run setup twice | PASS | | compose exec without host psql | this VM | PASS | | AGENTS.md | review | PASS | | test-setup-postgres | `make test-setup-postgres` | PASS | | verify-issue-324 | `make verify-issue-324` | PASS | ## Verification ```bash make setup-indexer-postgres make verify-issue-324 cd indexer && cargo test --test api_route_solve -- --test-threads=1 make test-setup-postgres ``` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Changes are dev/bootstrap scripts, Makefile targets, documentation, and an integration test seed fix—no production indexer routing or contract logic in this diff. > > **Overview** > Adds a **Postgres-only** Cloud Agent path so indexer integration tests can run without LocalTerra, optimized wasm, or `deploy-dex-local`. **`make setup-indexer-postgres`** (and `scripts/setup-cloud-agent-indexer-postgres.sh`) starts dockerd when needed, brings up the compose **postgres** service, and runs the existing DB bootstrap to write **`indexer/.env`** with `DATABASE_URL` / `TEST_DATABASE_URL`. The full localterra setup script gains **`--postgres-only`**, which can optionally **`--fresh`** volumes then delegates to that script. > > Postgres setup scripts now use a shared **`postgres-psql.sh`** wrapper: host **`psql`** when present, otherwise **`docker compose exec postgres psql`** (for VMs without `postgresql-client`). Role bootstrap and DB creation go through this path; bootstrap failures **exit 1** instead of silently succeeding after syncing env only. **`cloud-agent-docker.sh`** centralizes tmux dockerd + compose helpers for the new bootstrap. > > **Makefile:** `test-indexer-integration` (setup + serialized `cargo test --tests`), **`verify-issue-324`** (lib + HTTP cache tier tests via `scripts/qa/verify-issue-324.sh`). Static checks in **`test-setup-postgres`** cover the new wiring. > > **Test fix:** `route_solve_get_with_trader_returns_higher_estimate` seeds the discount wallet at **tier 5** so tier-keyed GET cache (#283) does not treat an unregistered trader like no-trader. > > Docs updated in **`AGENTS.md`**, **`docs/testing.md`**, and postgres/hybrid agent skills. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit b4b854c063fc1d44f2b6a5ac90f432357a15a3e0. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
PlasticDigits commented 2026-06-05 14:08:11 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-05 14:08:14 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-05 14:08:24 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
PlasticDigits commented 2026-06-05 14:08:26 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
PlasticDigits commented 2026-06-05 14:08:26 +00:00 (Migrated from gitlab.com)

mentioned in issue #335

mentioned in issue #335
ghost1 commented 2026-06-05 14:09:08 +00:00 (Migrated from gitlab.com)
Stale Security Review comment

Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

Reviewed by Cursor Bugbot for commit ebb64ecb25. Configure here.

<details> <summary>Stale Security Review comment</summary> <!-- BUGBOT_REVIEW --> Cursor Bugbot has reviewed your changes and found 1 potential issue.<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN --> <sup>Bugbot Autofix is [ON](https://www.cursor.com/dashboard/bugbot). A cloud agent has been kicked off to fix the reported issue. <!-- BUGBOT_AUTOFIX_AGENT_LINK --></sup> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END --> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ebb64ecb25e8a8f54339dfb9de9a62079b1125ac. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> </details>
ghost1 commented 2026-06-05 14:09:09 +00:00 (Migrated from gitlab.com)

Makefile PATH not applied

Medium Severity

The test-indexer-integration recipe puts export PATH=… on its own line before cargo test. GNU Make runs each recipe line in a separate shell, so the Cargo path prefix never applies to the test command. Cloud Agent flows that rely on /usr/local/cargo/bin can hit the wrong or missing cargo when using this target.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ebb64ecb25. Configure here.

### Makefile PATH not applied **Medium Severity** <!-- DESCRIPTION START --> The `test-indexer-integration` recipe puts `export PATH=…` on its own line before `cargo test`. GNU Make runs each recipe line in a separate shell, so the Cargo path prefix never applies to the test command. Cloud Agent flows that rely on `/usr/local/cargo/bin` can hit the wrong or missing `cargo` when using this target. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: ac72c9d4-994b-4dd0-906e-42cd847e8e27 --> <!-- LOCATIONS START Makefile#L178-L181 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjQ5MjUwMTZjLTc2NTQtNDhlNC1iMDM0LTMxMjA1NGMzODgwNCIsImVuY3J5cHRpb25LZXkiOiI5Mk02T1FfTTYzM2hESTZRRUVldVZqNHI4VkVWRDFta0k4YS1kM1FxN2JjIiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1lMjY3IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjQ5MjUwMTZjLTc2NTQtNDhlNC1iMDM0LTMxMjA1NGMzODgwNCIsImVuY3J5cHRpb25LZXkiOiI5Mk02T1FfTTYzM2hESTZRRUVldVZqNHI4VkVWRDFta0k4YS1kM1FxN2JjIiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1lMjY3IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIiwicHJOdW1iZXIiOjEwMCwiY29tbWl0U2hhIjoiZWJiNjRlY2IyNWU4YThmNTQzMzlkZmI5ZGU5YTYyMDc5YjExMjVhYyIsInByb3ZpZGVyIjoiZ2l0bGFiIiwiaG9zdG5hbWUiOiJnaXRsYWIuY29tIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ebb64ecb25e8a8f54339dfb9de9a62079b1125ac. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
PlasticDigits commented 2026-06-05 14:10:16 +00:00 (Migrated from gitlab.com)

Security review

Commit reviewed: ebb64ecb25e8a8f54339dfb9de9a62079b1125ac
Scope: Full MR diff vs main (227 files) — Postgres bootstrap (#335), indexer hybrid route solver / DB mirror, trading blacklist (#308), factory/pair/router contract changes, frontend trading UX, Cloud Agent setup scripts, CI artifact publishing.

Outcome: FINDINGS: 0 medium+

Security review: no medium+ findings on this diff.

Summary

Reviewed attacker-controlled inputs through sinks (SQL, LCD proxy, on-chain guards, frontend blacklist gating, dev bootstrap scripts). No exploitable injection, authz bypass, secret leakage, SSRF/XSS, or permission-boundary mistakes were identified in added or modified code.

Notable security-positive changes (no action required)

  • Indexer pair discovery (#311): verify_factory_provenance blocks indexing unregistered pair contracts; prod rejects empty FACTORY_ADDRESS.
  • Rate limiting (#282): API binds IPv4-only by default; PeerIpKeyExtractor ignores spoofable X-Forwarded-For.
  • DB hybrid solver (#319): Fidelity drift guard caps optimistic mirror quotes against router simulate_swap_operations.
  • LCD error hygiene (H6): LCD-heavy routes continue using lcd_gateway_err; new compliance::blacklist_check uses generic internal_err (no upstream echo).
  • SQL: Pair relevance/search uses parameterized QueryBuilder (push_bind); no string-concatenated user input in queries.
  • Postgres bootstrap (#335): Local-only (127.0.0.1:5432); role bootstrap escapes passwords; compose-exec fallback is dev-tooling only.
  • On-chain blacklist (#308): Governance-gated execute_blacklist_*; pair/router guards enforce at execution. Intentional fail-open when legacy factory lacks BlacklistCheck is a documented migration path, not a new bypass once factory 1.5.0 is live.
  • Frontend blacklist: UI gates on blocked === true (fail-open on query error); on-chain enforcement remains authoritative for signed txs.

Inline threads

None — no medium+ findings to anchor.


Automated security review (Cursor Cloud Agent).

## Security review **Commit reviewed:** `ebb64ecb25e8a8f54339dfb9de9a62079b1125ac` **Scope:** Full MR diff vs `main` (227 files) — Postgres bootstrap (#335), indexer hybrid route solver / DB mirror, trading blacklist (#308), factory/pair/router contract changes, frontend trading UX, Cloud Agent setup scripts, CI artifact publishing. **Outcome:** `FINDINGS: 0` medium+ Security review: **no medium+ findings** on this diff. ### Summary Reviewed attacker-controlled inputs through sinks (SQL, LCD proxy, on-chain guards, frontend blacklist gating, dev bootstrap scripts). No exploitable injection, authz bypass, secret leakage, SSRF/XSS, or permission-boundary mistakes were identified in **added or modified** code. ### Notable security-positive changes (no action required) - **Indexer pair discovery (#311):** `verify_factory_provenance` blocks indexing unregistered pair contracts; prod rejects empty `FACTORY_ADDRESS`. - **Rate limiting (#282):** API binds IPv4-only by default; `PeerIpKeyExtractor` ignores spoofable `X-Forwarded-For`. - **DB hybrid solver (#319):** Fidelity drift guard caps optimistic mirror quotes against router `simulate_swap_operations`. - **LCD error hygiene (H6):** LCD-heavy routes continue using `lcd_gateway_err`; new `compliance::blacklist_check` uses generic `internal_err` (no upstream echo). - **SQL:** Pair relevance/search uses parameterized `QueryBuilder` (`push_bind`); no string-concatenated user input in queries. - **Postgres bootstrap (#335):** Local-only (`127.0.0.1:5432`); role bootstrap escapes passwords; compose-exec fallback is dev-tooling only. - **On-chain blacklist (#308):** Governance-gated `execute_blacklist_*`; pair/router guards enforce at execution. Intentional fail-open when legacy factory lacks `BlacklistCheck` is a documented migration path, not a new bypass once factory 1.5.0 is live. - **Frontend blacklist:** UI gates on `blocked === true` (fail-open on query error); on-chain enforcement remains authoritative for signed txs. ### Inline threads None — no medium+ findings to anchor. --- *Automated security review (Cursor Cloud Agent).*
ghost1 commented 2026-06-05 14:10:56 +00:00 (Migrated from gitlab.com)

changed this line in version 2 of the diff

changed this line in [version 2 of the diff](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/100/diffs?diff_id=1836890256&start_sha=ebb64ecb25e8a8f54339dfb9de9a62079b1125ac#836efb6e25a091dcb4ff8e1dbb2f0be6a5cbf14c_181_180)
ghost1 commented 2026-06-05 14:11:07 +00:00 (Migrated from gitlab.com)

added 1 commit

  • eb651373 - Fix test-indexer-integration PATH export in single shell

Compare with previous version

added 1 commit <ul><li>eb651373 - Fix test-indexer-integration PATH export in single shell</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/100/diffs?diff_id=1836890256&start_sha=ebb64ecb25e8a8f54339dfb9de9a62079b1125ac)
ghost1 commented 2026-06-05 14:11:17 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-05 14:11:27 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-05 14:11:33 +00:00 (Migrated from gitlab.com)

resolved all threads

resolved all threads
PlasticDigits commented 2026-06-05 14:12:41 +00:00 (Migrated from gitlab.com)

Security review

Commit reviewed: eb6513736c309fa759566f25a354605ed4028b81
Scope: MR !818 diff vs main (14 files) — Postgres-only Cloud Agent bootstrap (#335): setup-indexer-postgres, postgres-psql.sh compose-exec fallback, Makefile test targets, docs, and api_route_solve tier-cache test fix.

Outcome: FINDINGS: 0 medium+

Security review: no medium+ findings on this diff.

Summary

Reviewed attacker-controlled inputs through sinks (SQL via postgres_psql / bootstrap helpers, shell docker compose invocation, indexer/.env writes, Makefile targets). No exploitable injection, authz bypass, secret leakage, SSRF/XSS, or permission-boundary mistakes were identified in added or modified code.

Notes (informational, no action required)

  • Local dev only: Postgres binds 127.0.0.1:5432; scripts provision local compose Postgres and write dev indexer/.env credentials — not production runtime.
  • SQL bootstrap: Role/database names come from scripts/lib/postgres-dev.env / repo .env (developer-controlled); password escaping for CREATE ROLE is unchanged from pre-MR bootstrap logic.
  • Shell hardening: cloud_agent_docker_compose / postgres_docker_compose pass args via printf '%q ' inside sg docker -c, reducing injection risk.
  • Behavior change (positive): Bootstrap failure now exits non-zero instead of silently syncing env without ensuring databases — reduces false-success misconfiguration, not an attack surface expansion.
  • Test fix: route_solve_get_with_trader_returns_higher_estimate seeds tier 5 to avoid cache-key collision (#283); test-only, no production impact.

Inline threads

None — no medium+ findings to anchor.


Automated security review (Cursor Cloud Agent).

## Security review **Commit reviewed:** `eb6513736c309fa759566f25a354605ed4028b81` **Scope:** MR !818 diff vs `main` (14 files) — Postgres-only Cloud Agent bootstrap (#335): `setup-indexer-postgres`, `postgres-psql.sh` compose-exec fallback, Makefile test targets, docs, and `api_route_solve` tier-cache test fix. **Outcome:** `FINDINGS: 0` medium+ Security review: **no medium+ findings** on this diff. ### Summary Reviewed attacker-controlled inputs through sinks (SQL via `postgres_psql` / bootstrap helpers, shell `docker compose` invocation, `indexer/.env` writes, Makefile targets). No exploitable injection, authz bypass, secret leakage, SSRF/XSS, or permission-boundary mistakes were identified in **added or modified** code. ### Notes (informational, no action required) - **Local dev only:** Postgres binds `127.0.0.1:5432`; scripts provision local compose Postgres and write dev `indexer/.env` credentials — not production runtime. - **SQL bootstrap:** Role/database names come from `scripts/lib/postgres-dev.env` / repo `.env` (developer-controlled); password escaping for `CREATE ROLE` is unchanged from pre-MR bootstrap logic. - **Shell hardening:** `cloud_agent_docker_compose` / `postgres_docker_compose` pass args via `printf '%q '` inside `sg docker -c`, reducing injection risk. - **Behavior change (positive):** Bootstrap failure now exits non-zero instead of silently syncing env without ensuring databases — reduces false-success misconfiguration, not an attack surface expansion. - **Test fix:** `route_solve_get_with_trader_returns_higher_estimate` seeds tier 5 to avoid cache-key collision (#283); test-only, no production impact. ### Inline threads None — no medium+ findings to anchor. --- *Automated security review (Cursor Cloud Agent).*
ghost1 commented 2026-06-05 14:13:11 +00:00 (Migrated from gitlab.com)

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issues.

Reviewed by Cursor Bugbot for commit eb6513736c. Configure here.

<!-- BUGBOT_REVIEW --> Cursor Bugbot has reviewed your changes and found 2 potential issues. <!-- BUGBOT_FIX_ALL --> <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTo4NzY4OGI5ZS0yYWU0LTQwZjktYmNmMi00YjI0ZGU4M2M4MzciLCJlbmNyeXB0aW9uS2V5Ijoib2U2MXRUZGNGUEgzVTNhLTJRcFpBMUJiMmdYRy1CSUFpYkp3Sm9wTWZfUSIsImJyYW5jaCI6ImN1cnNvci9naXRsYWItaXNzdWUtd29ya2Zsb3ctZTI2NyIsInJlcG9Pd25lciI6IlBsYXN0aWNEaWdpdHMiLCJyZXBvTmFtZSI6ImNsOHktZGV4LXRlcnJhY2xhc3NpYyJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <!-- /BUGBOT_FIX_ALL --> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN --> <sup>Bugbot Autofix is [ON](https://www.cursor.com/dashboard/bugbot). A cloud agent has been kicked off to fix the reported issues. <!-- BUGBOT_AUTOFIX_AGENT_LINK --></sup> <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END --> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit eb6513736c309fa759566f25a354605ed4028b81. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
ghost1 commented 2026-06-05 14:13:12 +00:00 (Migrated from gitlab.com)

Init failure skips env sync

Low Severity

postgres_psql_init runs under set -e with no fallback. If host psql is missing and the compose postgres service is not ready yet (common right after make start), the script exits before sync_indexer_database_env, unlike bootstrap failures which still sync indexer/.env.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit eb6513736c. Configure here.

### Init failure skips env sync **Low Severity** <!-- DESCRIPTION START --> `postgres_psql_init` runs under `set -e` with no fallback. If host `psql` is missing and the compose `postgres` service is not ready yet (common right after `make start`), the script exits before `sync_indexer_database_env`, unlike bootstrap failures which still sync `indexer/.env`. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: b56ccab0-40fe-44a7-b071-5179d87a57dc --> <!-- LOCATIONS START scripts/setup-postgres-dev-databases.sh#L19-L22 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjRiYTI5YjkxLWYzODQtNGRkMi04Nzg4LTEyZDMxMjJmYzU4NSIsImVuY3J5cHRpb25LZXkiOiI1VlRXeHlheFJabFFWVUhpeFR2eXFCS3duQk1RTDlkX2lJbEtQOXEyd08wIiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1lMjY3IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjRiYTI5YjkxLWYzODQtNGRkMi04Nzg4LTEyZDMxMjJmYzU4NSIsImVuY3J5cHRpb25LZXkiOiI1VlRXeHlheFJabFFWVUhpeFR2eXFCS3duQk1RTDlkX2lJbEtQOXEyd08wIiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1lMjY3IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIiwicHJOdW1iZXIiOjEwMCwiY29tbWl0U2hhIjoiZWI2NTEzNzM2YzMwOWZhNzU5NTY2ZjI1YTM1NDYwNWVkNDAyOGI4MSIsInByb3ZpZGVyIjoiZ2l0bGFiIiwiaG9zdG5hbWUiOiJnaXRsYWIuY29tIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit eb6513736c309fa759566f25a354605ed4028b81. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
ghost1 commented 2026-06-05 14:13:13 +00:00 (Migrated from gitlab.com)

Postgres-only path ignores fresh

Low Severity

When --postgres-only is set, the script execs into setup-cloud-agent-indexer-postgres.sh before any --fresh handling. A combined --postgres-only --fresh still parses --fresh but never runs volume reset, so stale Postgres data can remain despite the flag.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit eb6513736c. Configure here.

### Postgres-only path ignores fresh **Low Severity** <!-- DESCRIPTION START --> When `--postgres-only` is set, the script `exec`s into `setup-cloud-agent-indexer-postgres.sh` before any `--fresh` handling. A combined `--postgres-only --fresh` still parses `--fresh` but never runs volume reset, so stale Postgres data can remain despite the flag. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: d3fa4842-d80a-4af8-bf83-78dd092ce8dc --> <!-- LOCATIONS START scripts/setup-cloud-agent-localterra.sh#L153-L156 LOCATIONS END --> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmZkODIxNDRlLWIyZGMtNDM1MS1iYzJiLWRhNTQ1YzBkNTM4ZSIsImVuY3J5cHRpb25LZXkiOiJDOF9yTWlKbGdlcXd6dHZ6QncxSHhRT1VIWTRHVjVLVUdQVUIteE1ScDBBIiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1lMjY3IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmZkODIxNDRlLWIyZGMtNDM1MS1iYzJiLWRhNTQ1YzBkNTM4ZSIsImVuY3J5cHRpb25LZXkiOiJDOF9yTWlKbGdlcXd6dHZ6QncxSHhRT1VIWTRHVjVLVUdQVUIteE1ScDBBIiwiYnJhbmNoIjoiY3Vyc29yL2dpdGxhYi1pc3N1ZS13b3JrZmxvdy1lMjY3IiwicmVwb093bmVyIjoiUGxhc3RpY0RpZ2l0cyIsInJlcG9OYW1lIjoiY2w4eS1kZXgtdGVycmFjbGFzc2ljIiwicHJOdW1iZXIiOjEwMCwiY29tbWl0U2hhIjoiZWI2NTEzNzM2YzMwOWZhNzU5NTY2ZjI1YTM1NDYwNWVkNDAyOGI4MSIsInByb3ZpZGVyIjoiZ2l0bGFiIiwiaG9zdG5hbWUiOiJnaXRsYWIuY29tIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit eb6513736c309fa759566f25a354605ed4028b81. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
ghost1 commented 2026-06-05 14:14:29 +00:00 (Migrated from gitlab.com)

changed this line in version 3 of the diff

changed this line in [version 3 of the diff](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/100/diffs?diff_id=1836899326&start_sha=eb6513736c309fa759566f25a354605ed4028b81#a32d1ab63caa296d4ec1f48474cebbcdcd3272b2_22_20)
ghost1 commented 2026-06-05 14:14:29 +00:00 (Migrated from gitlab.com)

added 1 commit

  • b4b854c0 - fix: honor --fresh on postgres-only path and sync env on psql init failure

Compare with previous version

added 1 commit <ul><li>b4b854c0 - fix: honor --fresh on postgres-only path and sync env on psql init failure</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/100/diffs?diff_id=1836899326&start_sha=eb6513736c309fa759566f25a354605ed4028b81)
ghost1 commented 2026-06-05 14:14:43 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-05 14:15:02 +00:00 (Migrated from gitlab.com)

resolved all threads

resolved all threads
ghost1 commented 2026-06-05 14:15:02 +00:00 (Migrated from gitlab.com)

resolved all threads

resolved all threads
PlasticDigits commented 2026-06-05 14:16:13 +00:00 (Migrated from gitlab.com)

Security review

Commit reviewed: b4b854c063fc1d44f2b6a5ac90f432357a15a3e0
Scope: MR !818 diff vs main (14 files) — Postgres-only Cloud Agent bootstrap (#335), latest delta: --postgres-only --fresh volume reset + env sync on postgres_psql_init failure.

Outcome: FINDINGS: 0 medium+

Security review: no medium+ findings on this diff.

Summary

Re-reviewed attacker-controlled inputs through sinks (SQL via postgres_psql / bootstrap helpers, shell docker compose invocation, indexer/.env writes, Makefile targets). No exploitable injection, authz bypass, secret leakage, SSRF/XSS, or permission-boundary mistakes were identified in added or modified code.

Latest commit (b4b854c) — no new attack surface

  • --fresh on postgres-only path: Runs local make reset before delegating to the Postgres bootstrap script. Requires VM/shell access; dev-only volume wipe, not a remote boundary change.
  • postgres_psql_init failure handling: Syncs indexer/.env then exits non-zero. Reliability/misconfiguration guard; does not expose credentials beyond existing dev-script stdout or broaden network reach.

Prior review notes (still hold)

  • Local dev only: Postgres binds 127.0.0.1:5432; scripts provision local compose Postgres and write dev indexer/.env credentials — not production runtime.
  • SQL bootstrap: Role/database names come from scripts/lib/postgres-dev.env / repo .env (developer-controlled); password escaping for CREATE ROLE is unchanged from pre-MR bootstrap logic.
  • Shell hardening: cloud_agent_docker_compose / postgres_docker_compose pass args via printf '%q ' inside sg docker -c, reducing injection risk.
  • Test fix: route_solve_get_with_trader_returns_higher_estimate seeds tier 5 to avoid cache-key collision (#283); test-only, no production impact.

Inline threads

None — no medium+ findings to anchor.


Automated security review (Cursor Cloud Agent).

## Security review **Commit reviewed:** `b4b854c063fc1d44f2b6a5ac90f432357a15a3e0` **Scope:** MR !818 diff vs `main` (14 files) — Postgres-only Cloud Agent bootstrap (#335), latest delta: `--postgres-only --fresh` volume reset + env sync on `postgres_psql_init` failure. **Outcome:** `FINDINGS: 0` medium+ Security review: **no medium+ findings** on this diff. ### Summary Re-reviewed attacker-controlled inputs through sinks (SQL via `postgres_psql` / bootstrap helpers, shell `docker compose` invocation, `indexer/.env` writes, Makefile targets). No exploitable injection, authz bypass, secret leakage, SSRF/XSS, or permission-boundary mistakes were identified in **added or modified** code. ### Latest commit (`b4b854c`) — no new attack surface - **`--fresh` on postgres-only path:** Runs local `make reset` before delegating to the Postgres bootstrap script. Requires VM/shell access; dev-only volume wipe, not a remote boundary change. - **`postgres_psql_init` failure handling:** Syncs `indexer/.env` then exits non-zero. Reliability/misconfiguration guard; does not expose credentials beyond existing dev-script stdout or broaden network reach. ### Prior review notes (still hold) - **Local dev only:** Postgres binds `127.0.0.1:5432`; scripts provision local compose Postgres and write dev `indexer/.env` credentials — not production runtime. - **SQL bootstrap:** Role/database names come from `scripts/lib/postgres-dev.env` / repo `.env` (developer-controlled); password escaping for `CREATE ROLE` is unchanged from pre-MR bootstrap logic. - **Shell hardening:** `cloud_agent_docker_compose` / `postgres_docker_compose` pass args via `printf '%q '` inside `sg docker -c`, reducing injection risk. - **Test fix:** `route_solve_get_with_trader_returns_higher_estimate` seeds tier 5 to avoid cache-key collision (#283); test-only, no production impact. ### Inline threads None — no medium+ findings to anchor. --- *Automated security review (Cursor Cloud Agent).*
PlasticDigits (Migrated from gitlab.com) merged commit a4127b646c into main 2026-06-05 14:27:33 +00:00
PlasticDigits commented 2026-06-05 14:27:34 +00:00 (Migrated from gitlab.com)

mentioned in commit a4127b646c

mentioned in commit a4127b646cc449257adbae5449264d78bf5f65b3
PlasticDigits commented 2026-06-06 06:57:53 +00:00 (Migrated from gitlab.com)

mentioned in merge request !823

mentioned in merge request !823
PlasticDigits commented 2026-06-08 08:43:13 +00:00 (Migrated from gitlab.com)

mentioned in commit c0baf17f46

mentioned in commit c0baf17f46392f351af79afc597d0787a24e4129
PlasticDigits commented 2026-06-08 13:42:27 +00:00 (Migrated from gitlab.com)

mentioned in commit d50d39a3ed

mentioned in commit d50d39a3ed9f6e58f4a548d0ac556aed32f78754
Sign in to join this conversation.
No reviewers
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!818
No description provided.