Issues with long strings in atproto records #1596
Replies: 3 comments 6 replies
-
Agreed that ideally ATProto itself should have few or none of these limits, but they're probably appropriate in many app-specific lexicons, right? Otherwise, agreed, leaving it to HTTP servers and CBOR libs reminds me of network path MTU discovery. Is it 1400? 1500? 1480? 1280? URL max length may be a counterexample. afaik the RFC(s) don't specify it, and browser disagree, but that doesn't seem to cause too many problems in practice. How long can URLs be? "Long enough." |
Beta Was this translation helpful? Give feedback.
-
Last time I checked, there's a 100KB JSON request size limit for bsky.social, which acts as an indirect limit to how big your CBOR objects can be (as an implementation detail, and not based on the spec). In an ideal world, I think it would make the most sense to have an explicit maximum for overall CBOR size, but no limit on the size of individual objects within it - based on my guess that that logic is easiest to implement, usually (since it's well-defined, and you can perform a single check up-front, without needing a "smart" CBOR parser capable of enforcing per-object limits as it parses). The maximum could either be declared in the spec, or declared by each service (a PDS could advertise the maximum record size it will intentionally accept/emit, and an AppView could advertise the maximum it will accept, etc. etc.) Out of curiosity, how much effort would it take to raise whatever limit is causing the golang impl to reject 19KB strings, until it can accept 100KB strings? (since that's the unofficial maximum you'll ever see from bsky.social, at least) |
Beta Was this translation helpful? Give feedback.
-
A maximum object nesting depth might also be worth defining (I believe some of the records in my own bsky.social repo caused Issues during the AppView migration, due to differing implementation limits). |
Beta Was this translation helpful? Give feedback.
-
There is no specific maximum size for a record, or a string in a record, in atproto. Implementations are likely to have some limit, whether intentional or not: many CBOR libraries have default object size limits and other precautions against DDoS attacks, and often HTTP servers (or frameworks) have a body limit somewhere.
Giving a specific limit in the specification itself, either for records or strings inside records, seems arbitrary and inflexible (could cause interoperability problems later). On the other hand, leaving it ambiguous is already starting to cause problems.
To make things more concrete, there are valid records in the network today with strings over 19 KByte in the external embed description string field. The CBOR library used in the golang implementation rejects these long strings, preventing inter-operation with those records.
This is a discussion thread to acknowledge the issue and discuss it publicly.
Beta Was this translation helpful? Give feedback.
All reactions