akkoma/test/pleroma/web
Oneric 8684964c5d Only allow exact id matches
This protects us from falling for obvious spoofs as from the current
upload exploit (unfortunately we can’t reasonably do anything about
spoofs with exact matches as was possible via emoji and proxy).

Such objects being invalid is supported by the spec, sepcifically
sections 3.1 and 3.2: https://www.w3.org/TR/activitypub/#obj-id

Anonymous objects are not relevant here (they can only exists within
parent objects iiuc) and neither is client-to-server or transient objects
(as those cannot be fetched in the first place).
This leaves us with the requirement for `id` to (a) exist and
(b) be a publicly dereferencable URI from the originating server.
This alone does not yet demand strict equivalence, but the spec then
further explains objects ought to be fetchable _via their ID_.
Meaning an object not retrievable via its ID, is invalid.

This reading is supported by the fact, e.g. GoToSocial (recently) and
Mastodon (for 6+ years) do already implement such strict ID checks,
additionally proving this doesn’t cause federation issues in practice.

However, apart from canonical IDs there can also be additional display
URLs. *omas first redirect those to their canonical location, but *keys
and Mastodon directly serve the AP representation without redirects.

Mastodon and GTS deal with this in two different ways,
but both constitute an effective countermeasure:
 - Mastodon:
   Unless it already is a known AP id, two fetches occur.
   The first fetch just reads the `id` property and then refetches from
   the id. The last fetch requires the returned id to exactly match the
   URL the content was fetched from. (This can be optimised by skipping
   the second fetch if it already matches)
   05eda8d193/app/helpers/jsonld_helper.rb (L168)
   63f0979799

 - GTS:
   Only does a single fetch and then checks if _either_ the id
   _or_ url property (which can be an object) match the original fetch
   URL. This relies on implementations always including their display URL
   as "url" if differing from the id. For actors this is true for all
   investigated implementations, for posts only Mastodon includes an
   "url", but it is also the only one with a differing display URL.
   2bafd7daf5 (diff-943bbb02c8ac74ac5dc5d20807e561dcdfaebdc3b62b10730f643a20ac23c24fR222)

Albeit Mastodon’s refetch offers higher compatibility with theoretical
implmentations using either multiple different display URL or not
denoting any of them as "url" at all, for now we chose to adopt a
GTS-like refetch-free approach to avoid additional implementation
concerns wrt to whether redirects should be allowed when fetching a
canonical AP id and potential for accidentally loosening some checks
(e.g. cross-domain refetches) for one of the fetches.
This may be reconsidered in the future.
2024-03-25 14:05:05 -01:00
..
activity_pub Only allow exact id matches 2024-03-25 14:05:05 -01:00
admin_api Migrate to phoenix 1.7 (#626) 2023-08-15 10:22:18 +00:00
akkoma_api Fix OpenAPI spec for preferred_frontend endpoint 2024-02-03 14:27:45 +01:00
api_spec Bump Copyright to 2021 2021-01-13 07:49:50 +01:00
auth Support elixir1.15 2023-08-03 17:44:09 +01:00
common_api Use actual ISO8601 timestamps for masto API (#425) 2023-01-09 22:12:28 +00:00
feed Migrate to phoenix 1.7 (#626) 2023-08-15 10:22:18 +00:00
mastodon_api Merge pull request 'Return last_status_at as date, not datetime' (#681) from katafrakt/akkoma:fix-last-status-at into develop 2024-02-17 11:37:19 +00:00
media_proxy Tag Mock-tests as "mocked" and run them seperately 2023-08-04 12:50:50 +01:00
metadata Migrate to phoenix 1.7 (#626) 2023-08-15 10:22:18 +00:00
o_auth update tests for oauth consumer 2023-12-17 21:48:19 +00:00
o_status Support elixir1.15 2023-08-03 17:44:09 +01:00
pleroma_api Always insert Dedupe upload filter 2024-03-18 22:33:10 -01:00
plugs Tag Mock-tests as "mocked" and run them seperately 2023-08-04 12:50:50 +01:00
preload/providers Remove precompiled javascript (#55) 2022-07-08 13:03:18 +00:00
push Support elixir1.15 2023-08-03 17:44:09 +01:00
rich_media Support elixir1.15 2023-08-03 17:44:09 +01:00
static_fe Add tests for static-fe metadata tags 2024-02-21 00:33:32 +00:00
twitter_api Migrate to phoenix 1.7 (#626) 2023-08-15 10:22:18 +00:00
views Support elixir1.15 2023-08-03 17:44:09 +01:00
web_finger Fix signature checking 2023-08-07 16:17:17 +01:00
common_api_test.exs Add ability to auto-approve followbacks 2024-02-13 15:42:37 +01:00
embed_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
fallback_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
federator_test.exs Tag Mock-tests as "mocked" and run them seperately 2023-08-04 12:50:50 +01:00
gettext_test.exs Fix incorrect fallback when English is set to first language 2022-06-29 20:47:10 +01:00
manifest_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
masto_fe_controller_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
media_proxy_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
mongoose_im_controller_test.exs Migrate to phoenix 1.7 (#626) 2023-08-15 10:22:18 +00:00
node_info_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
rel_me_test.exs Add more information about failed verifications 2023-03-10 03:51:24 +00:00
streamer_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
uploader_controller_test.exs Migrate to phoenix 1.7 (#626) 2023-08-15 10:22:18 +00:00
web_finger_test.exs Support elixir1.15 2023-08-03 17:44:09 +01:00
xml_test.exs Add XML matcher 2023-08-07 11:12:14 +01:00