Skip to content

fix: remove network_url usage from simulate-tx and submit-tx routes#303

Merged
aristidesstaffieri merged 2 commits intomainfrom
fix/simulate-tx-network-url-2
Apr 8, 2026
Merged

fix: remove network_url usage from simulate-tx and submit-tx routes#303
aristidesstaffieri merged 2 commits intomainfrom
fix/simulate-tx-network-url-2

Conversation

@aristidesstaffieri
Copy link
Copy Markdown
Contributor

What
Ignores user-provided network_url in /simulate-tx and /submit-tx, resolving the RPC server from network_passphrase instead. The schema still accepts network_url for backwards compatibility but the value is no longer read.
Adds tests for both routes covering the new behavior

…300 follow-up)

  Prevents SSRF by ignoring user-provided network_url in /simulate-tx and
  /submit-tx, resolving the RPC server from network_passphrase instead.
  The schema still accepts network_url for backwards compatibility but the
  value is no longer read. Adds tests for both routes covering the new
  behavior.
@aristidesstaffieri aristidesstaffieri self-assigned this Apr 8, 2026
Copilot AI review requested due to automatic review settings April 8, 2026 20:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the /simulate-tx and /submit-tx API routes to ignore any user-provided network_url and instead derive the target network/RPC endpoint from network_passphrase, while keeping network_url in the request schema for backward compatibility.

Changes:

  • /simulate-tx: stop using network_url; resolve RPC server via network_passphrase → network name → configured RPC URL.
  • /submit-tx: continue accepting network_url but ignore it (now explicitly documented + tested).
  • Add/adjust route tests to cover ignoring network_url and handling unknown network_passphrase.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/route/index.ts Stops reading network_url for /simulate-tx (and documents ignore behavior for both routes); resolves RPC server from network_passphrase.
src/route/index.test.ts Updates existing simulate test to not require network_url and adds coverage ensuring network_url is ignored + unknown passphrase yields 400.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1263 to 1264
// network_url is accepted for backwards compatibility but ignored
network_url: { type: "string" },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Most web frameworks ignore extra arguments by default, do we need it listed here because /submit-tx will return 400 if its included?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

its not functionally needed here, they just served as a reference. The framework will strip them out since we set removeAdditional: true.

Removed them in ac1014d

  AJV's removeAdditional:true already silently strips unknown fields,
  so explicitly listing network_url in the schema was unnecessary.
@aristidesstaffieri aristidesstaffieri merged commit 988c040 into main Apr 8, 2026
6 checks passed
@aristidesstaffieri aristidesstaffieri deleted the fix/simulate-tx-network-url-2 branch April 8, 2026 21:49
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.

3 participants