Commit graph

11 commits

Author SHA1 Message Date
Oneric
eb361dd456 webfinger/finger: only accept authority of query domain
And permit refetching once(!) unless initial query
was already designated as the canonical authority.
(Only once to not get stuck in loops)

Fixes an oversight in c80aec05de.
The argument for why subjects from both authorities can be accepted
hinged on the assumption that only paths under direct control of the
domain operator are involved since both webfinger and host-meta
are /.well-known/ paths.
However, HTTP redirects or the LRDD schema inside the initial domains
host-meta may point at _any_ path on another domain, including e.g.
paths containing user uploads, thus enabling third-parties to
illegitimately claim handles from urelated domains, _if_ the victim
domain can be made to serve attacker-prepared JSON (e.g. via user
uploads or (media) proxies).

With trust being limited to initial domain and refetches we do not need
to make guesses about whether and when being redirected to indicates
authorisation of the final domain. It requires more fetch requests in
no-FEP-2c59 setups, but makes it more robust.
As a side effect current FEP-less Mastodon setups should happen to work.
2026-03-21 00:00:00 +00:00
Oneric
4f03a3b709 federation.md: document our WebFinger behaviour 2026-03-13 00:00:00 +00:00
Oneric
71757f6562 user/fetcher: utilise existing verified nick on user refetch
Unless the force-revalidation config is enabled (currently the default).
Also avoids an unneecessarily duplicated db query for the old user.
2026-03-12 00:00:00 +00:00
Oneric
c80aec05de webfinger: rewrite finger query and validation from and to actors
Resolves all security issues discussed in 5a120417fd86bbd8d1dd1ab720b24ba02c879f09
and thus reactivates skipped tests.
Since the necessary logic significantly differs for WebFinger handle dicovery/validation
and fetching of actors from just the webfinger handle the relevant public function was split
necessitating also a partial rewrite of the user fetch logic.

This works with all of the following:
  - ActivityPub domain is identical to WebFinger handle domain
  - AP domain set up host-meta LRDD link to WebFinger domain
  - AP domain set up a HTTP redirect on /.well-known/webfinger
    to the WebFinger domain
  - Mastodon style: WebFinger domain set up a HTTP redirect
    on its well-known path to AP backend (only for discovery
    from nickname though until Mastodon supports FEP-2c59)

This intentionally does not work for setups where FEP-2c59 is not
supported and the initially queried domain simply directly responds with
data containing a nickname from another domain’s authority without any
redirecty. (This includes the setup currently recommended by Mastodon,
when enriching an AP actor. Once Mastodon supports FEP-2c59 though its
setup will start to work again too automatically).
While technically possible to cross-verify the data with the nickname
domain, the existing validation logic is already complex enough and
such cross-validation needs extra safety measures to not get trapped
into infinite loops. Such setups are considered broken.
2026-03-12 00:00:00 +00:00
Oneric
4a35cbd23d fed/out: expose webfinger property in local actors (FEP-2c59)
It makes discovery and validation of the desired webfinger address
much easier. Future commits will actually use it for validation
and nick change discovery.
2026-03-12 00:00:00 +00:00
ilja space
39d768af82 Fix grammatical errors after code review
Some checks are pending
ci/woodpecker/pr/build-amd64 Pipeline is pending approval
ci/woodpecker/pr/build-arm64 Pipeline is pending approval
ci/woodpecker/pr/docs Pipeline is pending approval
ci/woodpecker/pr/lint Pipeline is pending approval
ci/woodpecker/pr/test/1 Pipeline is pending approval
ci/woodpecker/pr/test/2 Pipeline is pending approval
2025-04-30 11:52:07 +02:00
ilja space
c9a36e4340 Support htmlMfm term key for FEP-c16b compliance
Some checks are pending
ci/woodpecker/pr/build-amd64 Pipeline is pending approval
ci/woodpecker/pr/build-arm64 Pipeline is pending approval
ci/woodpecker/pr/docs Pipeline is pending approval
ci/woodpecker/pr/lint Pipeline is pending approval
ci/woodpecker/pr/test/1 Pipeline is pending approval
ci/woodpecker/pr/test/2 Pipeline is pending approval
We now add the htmlMfm key when relevant, store this in the database, and we see it when fetching using e.g.

    curl -L -H 'Accept: application/activity+json' "$ap_id"

The `@context` of the Activity Pub message now also contains `htmlMfm: https://w3id.org/fep/c16b#htmlMfm`.

When an incomming post has `htmlMfm: true`, we will not re-parse the content.

FEDERATION.md is adapted to show the `htmlMfm` term is used.
2025-04-06 19:56:56 +02:00
ilja space
dce07f05d9 Merge branch 'develop' of https://akkoma.dev/AkkomaGang/akkoma into use_fep-c16b_formatting_mfm_functions
Some checks are pending
ci/woodpecker/pr/build-amd64 Pipeline is pending approval
ci/woodpecker/pr/build-arm64 Pipeline is pending approval
ci/woodpecker/pr/docs Pipeline is pending approval
ci/woodpecker/pr/lint Pipeline is pending approval
ci/woodpecker/pr/test Pipeline is pending approval
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/test Pipeline was successful
ci/woodpecker/pull_request_closed/build-amd64 Pipeline was successful
ci/woodpecker/pull_request_closed/build-arm64 Pipeline was successful
ci/woodpecker/pull_request_closed/docs Pipeline was successful
2025-02-23 10:13:44 +01:00
Oneric
a1c841a122 federation.md: list FEP-dc88 formatting mathematics
Implemented by #642
2025-02-14 18:49:51 +01:00
ilja space
f646e78b48 Add "FEP-c16b: Formatting MFM functions" to FEDERATION.md
Some checks are pending
ci/woodpecker/pr/build-amd64 Pipeline is pending approval
ci/woodpecker/pr/build-arm64 Pipeline is pending approval
ci/woodpecker/pr/docs Pipeline is pending approval
ci/woodpecker/pr/lint Pipeline is pending approval
ci/woodpecker/pr/test Pipeline is pending approval
2024-12-01 11:51:34 +01:00
Oneric
05eda169fe Document AP and nodeinfo extensions
Some checks are pending
ci/woodpecker/pr/build-amd64 Pipeline is pending
ci/woodpecker/pr/build-arm64 Pipeline is pending
ci/woodpecker/pr/docs Pipeline is pending
ci/woodpecker/pr/lint Pipeline is pending
ci/woodpecker/pr/test Pipeline is pending
And while add it point to this via a top-level
FEDERATION.md document as standardised by FEP-67ff.

Also add a few missing descriptions to the config cheatsheet
and move the recently removed C2S extension into an appropiate
subsection.
2024-05-26 19:04:06 +02:00