XML-RPC discovery doesn't resolve a relative RSD link

Open Beginner friendly
#1,757 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Read wp_api/src/login/login_client.rs around WpLoginClient::xmlrpc_from_rsd and compare its URL handling with site_icons.rs. Resolve the RSD href against the homepage URL as described, then verify discovery works for a relative link such as /wp/xmlrpc.php?rsd and still handles an absolute link.

Written by the indexing model from the issue text.

Description

Bug Login Rust

XML-RPC discovery sends the site's raw RSD link without resolving it against the page, so a relative link never works.

What happens

WpLoginClient::xmlrpc_from_rsd (wp_api/src/login/login_client.rs, around lines 503–512) takes the href of <link rel="EditURI" type="application/rsd+xml"> and wraps it in WpEndpointUrl(rsd_url) as-is. It's the only non-test request address that doesn't go through url::Url.

Who is affected

Sites whose RSD link is relative, such as /wp/xmlrpc.php?rsd or //example.com/wp/xmlrpc.php?rsd. WordPress core writes an absolute link, so this needs a theme, plugin or proxy that rewrites links.

In a mock run with WordPress installed under /wp/ and a relative link, discovery ended in Disabled { ByHost } and then fell back to <site>/xmlrpc.php. The absolute link found https://example.invalid/wp/xmlrpc.php.

xmlrpc_discovery isn't exported over UniFFI, so only Rust callers are affected today. If it is exported, an empty or relative link would make the Swift executor throw .badURL, after #1746's fix.

Suggested fix

Resolve the href against the homepage URL, as site_icons.rs already does: parsed_site_url.inner.join(href).

Dominant language
Rust
Stars
38
Forks
6
Avg merge
2d 3h
Merged PRs (30d)
50

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/wordpress-rs

All issues in Automattic/wordpress-rs

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.