Skip to content

fix(rpc): honor Config.allowHttp via a shared server guard - #1922

Open
quietbits wants to merge 2 commits into
mainfrom
issue-1731
Open

quietbits wants to merge 2 commits into
mainfrom
issue-1731

Conversation

@quietbits

Copy link
Copy Markdown
Contributor
  • Fixed rpc.Server ignoring Config.setAllowHttp() — contract.Client and AssembledTransaction without allowHttp refused http: even with the global flag on, while Horizon and Federation honored it
  • Replaced the three copies of the insecure-server guard in Horizon.Server, rpc.Server and Federation.Server with one internal assertSecureUrl helper, so the servers can't drift apart again
  • Kept each server's error message, and each constructor's order of checks, so a caller that matches on the text or passes two bad inputs sees the same error as before
  • Kept an explicit allowHttp: false winning over the global flag, and kept null refused (only undefined falls back, as before)
  • Fixed the Federation global-flag test, which also passed allowHttp: true and so never tested the fallback
  • Left out sharing the TOML authority check with Federation (Part 2 of the issue) — Federation domain validation #1393 and fix(toml): keep a malformed domain from redirecting the request #1720 already cover Federation, so the only effect would be a new throw for a port above 65535

Closes #1731

@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Nov 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the RPC HTTP-configuration change.

No open issues 🎉

What changed in this PR

This PR aligns RPC’s HTTP configuration with Horizon and Federation, allowing contract workflows to inherit Config.allowHttp when no per-instance option is supplied. It addresses the shared server-guard portion of #1731 without changing authority validation.

Changes:

  • Consolidates the three server guards into assertSecureUrl, preserving explicit false overrides, rejection of null, and server-specific error messages.
  • Adds helper, RPC, and contract-client regression tests; corrects Federation’s global-flag test.
  • Documents the global fallback and updates reference documentation and the changelog.
File Description
test/​unit/​utils/​url.test.ts Tests shared-guard defaults, overrides, and null handling.
test/​unit/​server/​soroban/​constructor.test.ts Tests RPC global fallback and explicit refusal.
test/​unit/​federation_server.test.ts Removes the explicit option from the global-flag test.
test/​unit/​contract/​client_allow_http.test.ts Tests contract-client HTTP rejection and global fallback.
src/​utils/​url.ts Adds the shared assertSecureUrl guard.
src/​rpc/​server.ts Uses the shared guard and documents global configuration.
src/​horizon/​server.ts Replaces the duplicated guard with the shared helper.
src/​federation/​server.ts Replaces the duplicated guard with the shared helper.
src/​contract/​types.ts Documents global fallback for client options.
docs/​reference/​seps-federation.md Refreshes source-line links.
docs/​reference/​network-rpc.md Documents global configuration and refreshes source links.
docs/​reference/​network-horizon.md Refreshes source-line links.
docs/​reference/​contracts-client.md Refreshes source-line links.
CHANGELOG.md Records the RPC and contract-workflow behavior fix.

Review effort: Balanced

@quietbits
quietbits requested a review from Ryang-21 November 24, 2026 18:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

Consolidate URL validation: share the insecure-server guard and the authority-safety check

3 participants