Skip to content

Four DX and hardening fixes: webhook egress, SDK generation, devcontainer toolchain, compose stack (#1490, #1496, #1498, #1500) - #1518

Merged
Smartdevs17 merged 4 commits into
Smartdevs17:mainfrom
TheDEV111:feat/issues-1490-1496-1498-1500
Nov 20, 2026
Merged

Smartdevs17 merged 4 commits into
Smartdevs17:mainfrom
TheDEV111:feat/issues-1490-1496-1498-1500

Conversation

@TheDEV111

Copy link
Copy Markdown
Contributor

Summary

Four developer-experience and hardening items in one branch. Each has its own section below, and each closes its issue.

Closes #1490
Closes #1496
Closes #1498
Closes #1500

#1490 Webhook dispatcher egress allow-list and port guards

Outbound webhook URLs were POSTed to with no destination checks. This adds backend/src/services/webhooks/egress-policy.ts:

  • HTTPS only, no userinfo in the URL, effective port must be in WEBHOOK_EGRESS_ALLOWED_PORTS (default 443).
  • Host must match WEBHOOK_EGRESS_ALLOWED_HOSTS (exact or *.suffix). An empty list denies everything (fail closed).
  • Loopback, private, CGNAT, link-local (incl. 169.254.169.254), multicast and unspecified addresses are always denied, IPv4-mapped IPv6 included. The allow-list cannot override this.
  • DNS is resolved and every answer is checked, at dispatch time as well as at registration.
  • Delivery uses redirect: 'manual'.

Behaviour: registration returns 400 with a reason. A permanent denial dead-letters the delivery without sending. A DNS failure is retried.

Breaking for existing deployments: webhooks deliver nothing until WEBHOOK_EGRESS_ALLOWED_HOSTS is set.

Scope note: the issue names workers/webhookDispatcher/, which does not exist. The dispatcher is backend/src/services/webhooks/delivery-manager.ts, so the guard lives there. workers/ is the Cloudflare edge proxy and was not changed.

#1496 Typed SDK generation on every push

.github/workflows/sdk-generation.yml (the issue names sdk-gen.yml, which does not exist) called npm run sdk:generate:<lang>, but those scripts were missing, so the job could not run. Changes:

  • Adds sdk:generate:{typescript,python,go} to backend/package.json, backed by scripts/sdk/generate-sdk.mjs. It reads backend/openapi-generator.config.json, merges the typed options, and runs the pinned openapi-generator-cli:v7.0.1 image, so no local Java is needed.
  • Push trigger no longer has a paths filter, so generation runs on every push. PR trigger filter unchanged.
  • make test-tooling now also runs scripts/*/*.test.mjs. The generator tests include a check that every workflow matrix language has a config and a script.

Not changed, and needs a decision: publish-sdk still runs rm -rf packages/sdk/src and replaces it with the generated output on main. That would overwrite the hand-written SDK. Publishing is out of this PR's scope and I did not change it.

#1498 Devcontainer with Soroban CLI and Rust targets

  • .devcontainer/Dockerfile now has a multi-stage build. A rust:1.93-bookworm stage installs the wasm32 target, clippy, rustfmt, rust-analyzer and soroban-cli 21.0.0. The toolchain is copied into the node image, so it is ready at container create.
  • devcontainer.json drops the Rust feature, since the image now provides Rust.
  • New scripts/setup.sh: verifies or installs the toolchain. --check reports status and exits 1 if anything is missing. post-create.sh calls it instead of its own inline install (which swallowed failures).
  • The Soroban version is pinned in one place (SOROBAN_CLI_VERSION in setup.sh, mirrored by the Dockerfile ARG). A test keeps it equal to soroban-sdk in contracts/Cargo.toml.

Not verified here: the image build itself (soroban-cli compiles from source, which is slow). Please check the devcontainer CI job.

#1500 One-command local stack via compose profile

  • Root docker-compose.yml: backend and frontend services under the app profile, built from Dockerfile.backend / Dockerfile.frontend. Without the profile, only infra starts, as before.
  • make up-app starts the full stack. make down now also stops app services.
  • frontend/next.config.ts: output: "standalone". Dockerfile.frontend already expected standalone output, and CI already builds it, so this fixes an existing build failure rather than adding a feature.
  • NEXT_PUBLIC_API_URL is a build arg, because Next compiles NEXT_PUBLIC_* in.
  • docker compose config tests cover the profile contents and build args.

Known gap: the database is not migrated automatically. Run make db-migrate once against a new database.

Testing

  • make test-tooling: 47/47 pass (makefile dry-run of every target, SDK generator, setup.sh with shimmed toolchains, compose config, docs index, turbo config).
  • node --test scripts/sdk/generate-sdk.test.mjs: 13/13.
  • node --test scripts/setup.test.mjs: 10/10.
  • node --test scripts/compose.test.mjs: 5/5 against the real docker compose binary.
  • backend: vitest run src/services/webhooks/__tests__/egress-policy.test.ts: 32/32 pass.
  • backend webhook and route suites: the same 12 files and 49 tests fail on clean main and on this branch, so those failures predate this PR. The branch adds one passing file.
  • tsc --noEmit: no new errors in the touched files. The remaining errors in webhooks-dlq.ts and delivery-manager.ts are on lines this PR does not change.

Notes

  • Verify the generator end to end with cd backend && npm run sdk:generate:typescript (needs Docker).
  • Not run here: the frontend next build and the Dockerfile.frontend image build, and the devcontainer image build. Please check these in CI before merge.

…17#1490)

Webhook deliveries POSTed to any merchant-supplied URL. Add an egress
policy checked at endpoint registration and again before each delivery:

- https only, no userinfo, port in WEBHOOK_EGRESS_ALLOWED_PORTS (443)
- host must match WEBHOOK_EGRESS_ALLOWED_HOSTS (exact or *.suffix);
  an empty list denies all egress
- loopback, private, CGNAT, link-local and multicast addresses are
  always denied, including IPv4-mapped IPv6; DNS answers are checked
- redirects are not followed

A permanent denial dead-letters without sending. A DNS failure retries.
Registration returns 400 with a reason.

Operators must set WEBHOOK_EGRESS_ALLOWED_HOSTS before webhooks deliver.
…Smartdevs17#1496)

The generate job called sdk:generate:<lang> scripts that did not exist, so
it could not run. Add them, backed by scripts/sdk/generate-sdk.mjs, which
reads backend/openapi-generator.config.json and runs the pinned
openapi-generator-cli image. Generation runs on every push. make
test-tooling now also runs scripts/*/*.test.mjs.
…evs17#1498)

Build the Rust toolchain (wasm32 target, clippy, rustfmt, rust-analyzer)
and soroban-cli 21.0.0 in a rust stage and copy them into the devcontainer
image, so container create compiles nothing. Drop the Rust devcontainer
feature. scripts/setup.sh verifies or installs the toolchain and replaces
the inline install in post-create.sh, which hid failures. The Soroban
version is pinned in one place and tested against contracts/Cargo.toml.
…vs17#1500)

Add backend and frontend services to the root docker-compose.yml under the
app profile, built from the production Dockerfiles. Add make up-app. make
down also stops app services. Plain docker compose up still starts infra
only.

Also set output: standalone in the Next config. Dockerfile.frontend and CI
already expect standalone output, so this fixes that build. Pass
NEXT_PUBLIC_API_URL as a build arg, since Next compiles it in.
@vercel

vercel Bot commented Nov 20, 2026

Copy link
Copy Markdown

@TheDEV111 is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Nov 20, 2026

Copy link
Copy Markdown

@TheDEV111 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Smartdevs17
Smartdevs17 merged commit 1ce38c6 into Smartdevs17:main Nov 20, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants