Skip to content

Anchor the well-known rewrite rules - #3902

Merged
pfefferle merged 8 commits into
trunkfrom
fix/well-known-rewrite-rules
Oct 18, 2026
Merged

pfefferle merged 8 commits into
trunkfrom
fix/well-known-rewrite-rules

Conversation

@pfefferle

Copy link
Copy Markdown
Member

Fixes #

Proposed changes:

  • The rewrite rules for /.well-known/webfinger, /.well-known/nodeinfo and /.well-known/oauth-authorization-server were not anchored, so they matched every path starting with that prefix. The plugin answered /.well-known/oauth-authorization-server/wp-api/indieauth/1.0 with its own metadata, but under RFC 8414 §3.1 that URL belongs to an issuer with the path /wp-api/indieauth/1.0, here the IndieAuth plugin. Because of this, indieauth.rocks test S117 fails.
  • The rules now only match the bare path (with an optional trailing slash). The OAuth issuer is always home_url() without a path, so the bare path is all the plugin owns.
  • The dot is escaped as well, it matched any character before.
  • Paths like /.well-known/nodeinfo/2.0 or /.well-known/webfinger/foo returned the discovery document or the WebFinger response before, and now fall through to WordPress (404). Nothing in the plugin links to them, the NodeInfo discovery document points to the REST URLs, and WebFinger uses ?resource=, which is not part of the rewrite match.
  • Existing sites get the new rules through the rewrite flush that runs on every plugin update.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Run npm run env-test -- --filter Test_Router.
  • With pretty permalinks, open /.well-known/oauth-authorization-server, it should return the ActivityPub metadata.
  • Open /.well-known/oauth-authorization-server/wp-api/indieauth/1.0, it should return a 404 (or the IndieAuth metadata, if the plugin is active and registers that path).
  • Open /.well-known/webfinger?resource=acct:admin@your-site and /.well-known/nodeinfo, both should work as before.

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

@pfefferle pfefferle added the Bug Something isn't working label Oct 18, 2026
@pfefferle pfefferle self-assigned this Oct 18, 2026
@pfefferle
pfefferle requested a review from a team October 18, 2026 11:13
@github-actions github-actions Bot added [Focus] Compatibility Ensuring the plugin plays well with other plugins [Tests] Includes Tests labels Oct 18, 2026
@pfefferle
pfefferle merged commit 6e1a605 into trunk Oct 18, 2026
13 checks passed
@pfefferle
pfefferle deleted the fix/well-known-rewrite-rules branch October 18, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working [Focus] Compatibility Ensuring the plugin plays well with other plugins [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant