Email or username:

Password:

Forgot your password?
Brook Miles

I've seen a bit of discussion lately about Mastodon's AUTHORIZED_FETCH and DISALLOW_UNAUTHENTICATED_API_ACCESS settings and since I had a hard enough time myself figuring out what they do based on the documentation and Discord comments, I wrote up what I hope is a more approachable explanation.

hub.sunny.garden/2023/06/28/wh

23 comments
MurmeltHier

@brook

Wow, thank you. This helps _a lot_ in understanding how blocking/defederating works and what loopholes/problems maybe arise if there are some important toggles not switched. And I am not even an admin.

πŸ‘€ @PaulaToThePeople

Tokyo Outsider (337ppm)

@brook This is really good β€” thank you!

Do you think in the future the setting that disables unauthorised API access might be separated from the instance website in some way (by authorising whatever component serves web requests, for example)?

I can see the argument for wanting to lock down everything, or people blocked one way will just go the other, but having a bit more granularity around these options might be good β€” so people can disable the API without trashing the website.

Brook Miles

@tokyo_0 so, funny story about that... the public web interface didn't use to use the API. It changed last year in v4.0.0.

If I remember correctly a big reason for the change was there was previously two different web interfaces, one for logged in users and one for logged out users, and this was extra work to maintain both, so they were combined into one.

This is actually why the DISALLOW_UNAUTHENTICATED_API_ACCESS option was added (so people could still disable the new anonymous API access if they were willing to break the web interface).

We can certainly hope that the functionality of these options may improve in the future, but this mostly comes down to the priorities and resources of the Mastodon dev team.

@tokyo_0 so, funny story about that... the public web interface didn't use to use the API. It changed last year in v4.0.0.

If I remember correctly a big reason for the change was there was previously two different web interfaces, one for logged in users and one for logged out users, and this was extra work to maintain both, so they were combined into one.

Tokyo Outsider (337ppm)

@brook Wow, interesting - thank you.

I can see the argument for not having two different web interfaces.... kind of. Certainly two whole separate web interfaces would be overkill. The decision to make both the site and the API used elsewhere controlled with one switch still leaves me a bit cold, though.

Thankfully I'm not an admin, so I don't have to worry too much about it, but I don't envy those that do. Thank you for explaining the background! πŸ‘

Hamish The PolarBear

@brook Sorry to bother you but do you know how to check the ENV of the running server so I can make sure my configuration has changed?

Brook Miles

@hamishtpb I'm afraid I don't know off hand, sorry

evil weevil

@hamishtpb @brook If you can access a Linux shell, `echo $VAR_NAME` will print the value of a specific variable.

Hamish The PolarBear

@weevil @brook I think that is only for the user's environment, not the application. I did try it as my mastodon server user but nothing.

Hamish The PolarBear

@weevil Of course it could be that it isn't set properly too πŸ™‚

Hamish The PolarBear

@weevil I found a couple of methods now, the only problem is that Mastodon launches a whole host of processes and I can't work out which one I need to check πŸ˜†

`/proc/<pid>/environ` or `ps eww <pid>` are good.

PJ Coffey

@brook

This Fetch and API access is a bit beyond me but I bet people following #MastodonServer #MastodonInstance #mastodonAdministration #MastodonAdmin #MastoAdminTip and #MastoAdmin

Might like it. Thanks for writing it up!

Talya (she/her) πŸ³οΈβ€βš§οΈ

@brook #FediPact folks: we probably need to enable at least one of those for the meta block to be effective.

chief maraging steel executive

@brook pretty good explanation, from my understanding of signed fetches, that section appears to be accurate

maloki 🍍:ghostbat:

@brook Thank you for writing this.
We're currently doing some research about it for work related stuff. So I'm glad it's resulting in some more general conversaitons too!

Emelia πŸ‘ΈπŸ»

@brook might be good to contribute that to the docs!

Mx Amber Alex

@brook if I may add my two cents: the part about unauthenticated API access breaking the website is, as far as I know (corrections welcome), new starting with version 4.

In Mastodon 4, Eugen / Mastodon gGmbH, in what I can only call a since-ongoing episode of "I know what's best and only I", decided that pre-rendered pages (i.e. a post on the instance is browsed to and the instance renders a static page showing the post, with no client-side API access happeneing) were obsolete, and replaced all such pages with dynamically rendered pages.

Besides breaking a whole bunch of features if I recall correctly, that also introduced this very problem.

@brook if I may add my two cents: the part about unauthenticated API access breaking the website is, as far as I know (corrections welcome), new starting with version 4.

In Mastodon 4, Eugen / Mastodon gGmbH, in what I can only call a since-ongoing episode of "I know what's best and only I", decided that pre-rendered pages (i.e. a post on the instance is browsed to and the instance renders a static page showing the post, with no client-side API access happeneing) were obsolete, and replaced all such...

Γ–lbaum

@brook @welshpixie I’ve just started building a tool that, among other things, displays your latest Mastodon statuses on your home page. DISALLOW_UNAUTHENTICATED_API_ACCESS would make life a bit more complicated for me and my users (that’s me, I’m my users.)

heathen

@brook thank you for taking the time to explain this. I've seen people talking about this but had no idea what any of it meant, so I truly appreciate you putting this out there.

Jon

@brook A great and badly-needed explanation, thanks very much!

One potential minor suggestion: for people who aren't familiar with web programming, "fetch" might be a term of art worth defining.

Go Up