Skip to content

Fix path auth: substitute API key placeholder into RPC URL before use#2638

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-path-auth-api-key-substitution
Draft

Fix path auth: substitute API key placeholder into RPC URL before use#2638
Copilot wants to merge 2 commits intomainfrom
copilot/fix-path-auth-api-key-substitution

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

AuthConfig::Path providers (e.g. Alchemy for Abstract/Starknet) had {api_key} left as a literal string in the URL — the token was never substituted, causing all HTTP requests to fail.

Changes

  • auth.rs — Added AuthConfig::resolve_url(): for Path auth, replaces the placeholder with the resolved token; returns the URL unchanged for all other variants.
  • sign.rs — All three build_http_client call sites (Bitcoin, Abstract, Starknet) now call auth.resolve_url(&rpc_url)? instead of cloning the raw URL directly.
  • Tests — Four unit tests covering resolve_url for all AuthConfig variants.
// Before — placeholder passed verbatim to HTTP client
let public_node_url = abstract_provider_config.rpc_url.clone();

// After — token substituted before use
let public_node_url = abstract_provider_config
    .auth
    .resolve_url(&abstract_provider_config.rpc_url)?;

The existing strip_placeholder (used for logging) is unchanged; resolve_url is the companion method for actual request dispatch.


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Add resolve_url() to AuthConfig which replaces the placeholder with
the resolved token for Path auth (and returns the URL unchanged for
all other auth kinds). Use this in all three build_http_client call
sites (Bitcoin, Abstract, Starknet) in sign.rs so that the {api_key}
placeholder is actually substituted before the HTTP request is made.

Add unit tests for the new resolve_url() method.

Agent-Logs-Url: https://github.com/near/mpc/sessions/0ac35124-89b3-4fe5-9288-a5c1685a6666

Co-authored-by: netrome <22524681+netrome@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix path auth API key substitution in RPC URL Fix path auth: substitute API key placeholder into RPC URL before use Mar 27, 2026
Copilot AI requested a review from netrome March 27, 2026 18:41
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.

Foreign provider config path auth never substitutes the API key into the RPC URL

2 participants