Skip to content

chore(ibkr): harden the CP gateway docker harness#131

Merged
NotAProfDev merged 2 commits into
mainfrom
feat/ibkr-gateway-harness
Jul 10, 2026
Merged

chore(ibkr): harden the CP gateway docker harness#131
NotAProfDev merged 2 commits into
mainfrom
feat/ibkr-gateway-harness

Conversation

@NotAProfDev

Copy link
Copy Markdown
Owner

Closes #130

Follow-up to #129 (real fixtures) and #127 (the harness): make the dev CP gateway self-sufficient so browser login works in a devcontainer without a manual ips.allow patch, and adopt hardening ideas from a reference oath-ibkr-v2 gateway (harness only — OATH keeps its own net-http/net-ws client stacks).

Changes (all under docker/cpapi/ + Justfile + _typos.toml)

  • Baked conf.yaml with a widened ips.allow (loopback + RFC-1918 private ranges). The distribution's shipped allowlist (192.*/131.216.*/127.0.0.1) rejects a Docker-forwarded login (source 172.*/10.*) with 403 "not allowed".
  • HEALTHCHECKcurl /iserver/auth/status200|401; curl added to the image for it.
  • Compose hardeningcap_drop: ALL, no-new-privileges, mem_limit/pids_limit, bounded logs.
  • Container-IP capturejust ibkr-capture resolves the gateway's bridge IP via a new gateway-base-url.sh (localhost:5000 isn't routable from inside a devcontainer). capture.sh is untouched.

Verification

just ci green. Built the image and ran a throwaway container: it serves HTTP 401 (source allowed, not 403) with no manual patch, and the HEALTHCHECK is configured. gitleaks clean (the sslPwd is the distribution's public keystore password).

Scope: no crate or capture.sh changes → independent of #129.

🤖 Generated with Claude Code

Make the dev Client Portal Gateway self-sufficient so browser login works in a
devcontainer without a manual patch, adopting hardening ideas from a reference
gateway:

- Bake a dev `conf.yaml` into the image whose `ips.allow` covers loopback +
  RFC-1918 private ranges — the distribution's shipped allowlist
  (192.*/131.216.*/127.0.0.1) rejects a Docker-forwarded login (source
  172.*/10.*) with 403 "not allowed".
- Add a container HEALTHCHECK (curl /iserver/auth/status -> 200|401); install
  curl for it.
- Harden docker-compose: cap_drop ALL, no-new-privileges, mem/pids limits, and a
  bounded log size.
- `just ibkr-capture` resolves the gateway's container IP (new
  docker/cpapi/gateway-base-url.sh helper) because localhost:5000 is not routable
  from inside a devcontainer; capture.sh is untouched.

Verified: image builds, and a throwaway container serves 401 (source allowed,
not 403) with no manual ips.allow patch. Allowlist `vertx` (the keystore
filename) in _typos.toml.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@NotAProfDev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6fea13fe-cb45-4e77-b352-6627d4b5f009

📥 Commits

Reviewing files that changed from the base of the PR and between d96b7b6 and b1815df.

📒 Files selected for processing (7)
  • Justfile
  • _typos.toml
  • docker/cpapi/Dockerfile
  • docker/cpapi/README.md
  • docker/cpapi/conf.yaml
  • docker/cpapi/docker-compose.yml
  • docker/cpapi/gateway-base-url.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ibkr-gateway-harness

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NotAProfDev NotAProfDev merged commit 71265c7 into main Jul 10, 2026
5 checks passed
@NotAProfDev NotAProfDev deleted the feat/ibkr-gateway-harness branch July 10, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(ibkr): harden the CP gateway docker harness (baked ips.allow conf, healthcheck, container-IP capture)

1 participant