-
-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Guard rails when configuring server limits #2696
Comments
There is an upper bound on some of these fields at which point other instances might start dropping activities. I know some source diving in Pleroma ages ago surfaced that it had a rather tight bio length limit at which point it'd just drop any activity from a non-compliant user. That was long enough ago now that I consider it immaterial for current planning, but it's an anecdote. A warning of some kind that you're up in the ranges where you might have federation issues might be a consideration? Figuring out what those ranges are is non-trivial though. |
I don't really see any of these values as a problem, and we can't determine whether this was the admin's intent or happened by accident. Some of these will cause federation issues, but we already provide guidance around that in the configuration documentation. gotosocial/example/config.yaml Lines 453 to 461 in fcecd0c
We should improve the docs on that one, and make it so you don't have to set it in bytes because that's a bit tedious. gotosocial/example/config.yaml Lines 591 to 598 in 504c4f2
gotosocial/example/config.yaml Lines 612 to 616 in 504c4f2
gotosocial/example/config.yaml Lines 600 to 604 in 504c4f2
gotosocial/example/config.yaml Lines 606 to 610 in 504c4f2
4294967296 is MAX_INT32 and isn't a value you fat-finger. Same with 1024. If people have chosen to explicitly set those values despite what the documentation tells them, then we should let them. Emitting extra warnings about it isn't likely to be helpful.
If there's any evidence of someone having accidentally misconfigured a setting I'd like to hear it, but that seems pretty unlikely given what's shown here. |
Hi! I'm the admin and sole user of constellation.home.nora.codes. Let me help you determine whether this was the admin's intent: it was! Don't worry that you'll need to deal with federation issues from these values, as this server runs in allowlist mode, and federates with exactly two other servers. I'd be curious to learn how these values made it into a client of yours given this extremely limited federation status. |
Hi @NoraCodes
Sure. I'm working on https://pachli.app, and recently changed JSON parsers. The previous parser (Gson) would accept roughly anything you threw at it, if necessary ignoring the type constraints of the object the parsed data was being stored in. This lead to interesting bugs like non-null types containing nulls, trying to store a long in an int, and so on. This could cause crashes in the app, but those crashes could occur long after the data had been received. It also meant it was difficult to look at the code and reason about its behaviour because Gson could do an end-run around the type system (!) The new parser (Moshi) is a lot stricter about catching this stuff and reporting it as an error. Before I rolled out a new version of the app with this change I thought it was prudent to determine how many servers out there had data that could cause problems. To do that I used the https://fediverse.observer/ API to fetch a list of all servers running Mastodon or Mastodon-like software, and fetched the Doing this showed:
E.g., a server that sets Some of those -- e.g., those two examples -- are just people being jerks. Others, e.g., yours where Unrestricted / very large content on Mastodon can be an issue for server admins, users, and client developers. mastodon/mastodon#26176 is an example of that. So when I saw your server configured that way (complete list of weirdness -- https://gist.github.com/nikclayton/ebba4c76261b377094d31fe72f503ec9) I figured it was worth flagging, just in case this was a mistake. |
I've pushed #2706 to update the documentation for media sizes to warn about sizes. It also switches the examples to use human sizes instead of a number of bytes (since we actually support that already). That should decrease the likelihood of mistakes for those values, and make it very easy for an admin to see at a glance if they might've overdone it. So far, there's no evidence of people misconfiguring these values, let alone it being common place. I think for now we'll refrain from adding additional warnings, as it's hard to determine what the "safe" values are and when servers are operating in closed federation much bigger values might be perfectly fine. We have suggestions for each of these values in our documentation. If admins chose to ignore them they should be able to do so without GtS warning about them on startup. |
I'm going to close this one for now. If people do run into accidental misconfiguration issues please do add to this issue and we'll reconsider if we need to do something more about it. |
Hi folks,
You may want to consider putting some guard rails in place when the server's configuration is processed, just to ensure the user hasn't made any potentially costly mistakes.
For example, https://constellation.home.nora.codes/api/v2/instance reports some very large limits, including:
I appreciate you can't do anything if the admin puts new limits in to the source code (and I don't know if that's what was done here), but it's probably good practice to sanity check these and other limits just in case someone's made a mistake (e.g., an admin adding an extra
0
to an image or video size limit).The text was updated successfully, but these errors were encountered: