程序员相信的关于 ATProto 的谬误
Falsehoods Programmers Believe About ATProto

原始链接: https://reiver.link/atproto/falsehoods-programmers-believe/

ATProto 仓库存储来自任何应用的混合记录类型;默认情况下记录是公开的,但某些应用功能会将数据保留在仓库外的 PDS/聊天服务中。屏蔽是公开记录,与静音不同。记录的作者是其仓库,(did, collection, rkey) 标识它;键通常为 TID,但也可能是其他形式,由用户控制,不应信任为时间戳。createdAt 由客户端声明,可能不准确;服务会跟踪自己的索引时间。ATProto 数据是 JSON/DRISL-CBOR,并有严格规则:无浮点数、整数限制、链接/字节/blobs 的特殊编码、保留的 $ 字段、UTF-8、缺失/null/假值相区分,以及通过 CBOR 哈希。PDS 默认只验证已知的 lexicon,因此读取方应自行验证。删除会从仓库移除记录并广播,但副本可能仍存在于其他地方;应将任何已发布内容视为永久/公开。

黑客新闻 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 程序员对 ATProto 的谬误 (reiver.link) 4 分,由 todosacerdoti,1 小时前 隐藏 | 过往 | 收藏 | 讨论 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文
  • Every record on the network is a Bluesky post.

    A repository can hold records of any type — any lexicon, from any app — all mixed together in the same user's repository. Calendar events, bookmarks, blog posts, game state, workout logs, or a custom app's own schema: each is just another collection. (And, by default, a PDS accepts records whose lexicon it does not know — “optimistic validation”.)

    For example, my repository (reiver.blacksky.team) has these collections, according to com.atproto.repo.describeRepo:

    actor.rpg.generator
    actor.rpg.sprite
    actor.rpg.stats
    app.bsky.actor.link
    app.bsky.actor.profile
    app.bsky.feed.generator
    app.bsky.feed.like
    app.bsky.feed.post
    app.bsky.feed.repost
    app.bsky.graph.follow
    app.bsky.graph.list
    app.bsky.graph.listitem
    chat.bsky.actor.declaration
    equipment.rpg.item
    					

    Only one of those 14 collections is Bluesky posts (app.bsky.feed.post). Even among Bluesky's own record types, most are not posts — likes, reposts, follows, lists, a profile. And, actor.rpg.* and equipment.rpg.item are from a different app altogether. (See: ATProto Record.)

  • Everything a user does on ATProto is public.

    Everything in a user's repository is public — posts, likes, follows, and even blocks (see the next item). But, not everything a user does is stored as a record in their repository. For example, in Bluesky:

    • preferences — app.bsky.actor.putPreferences says it will “Set the private preferences attached to the account.”
    • mutes — app.bsky.graph.muteActor says “Mutes are private in Bluesky.”
    • direct messages — chat.bsky.convo.sendMessage sends them to a separate chat service (did:web:api.bsky.chat), not into anyone's repository.
    • account details — email address, password, and app passwords stay on the user's PDS.

    Note that this data is private from the public — not encrypted. The PDS (or chat service) that holds it can read it. And, these are features of particular apps and services (app.bsky.*, chat.bsky.*), not a privacy guarantee of the protocol itself.

    (The spaces proposal would add something new: records that only some people may read — see the Spaces section, below.)

  • Blocks are private, like mutes.

    In Bluesky, a mute is private — but a block is a public record. A block is an app.bsky.graph.block record in the blocker's repository, and its lexicon says so plainly: “Record declaring a 'block' relationship against another account. NOTE: blocks are public in Bluesky; see blog posts for details.”

    So, anyone can list an account's blocks — for example, with com.atproto.repo.listRecords, or from the firehose — and see who blocked whom. If you build features on blocks, treat them as public information.

  • A record has an author field.

    The author is the repository the record is in. (See: ATProto Record.)

  • A record key is unique within a repository.

    “The tuple of (did, rkey) is not unique; the tuple (did, collection, rkey) is unique.”

  • Record keys are always TIDs.

    TIDs (like 3n2opitxdyc2j) are the most common, but each record type's lexicon says which kind of record key it uses. The record key specification defines 4 kinds:

    • tid — a timestamp identifier (posts, likes, follows, etc),
    • literal:<value> — one fixed key, so there is only one record in the collection; usually literal:self (for example, app.bsky.actor.profile/self),
    • nsid — the key must be an NSID (published lexicons use the NSID as the record key), and
    • any — any valid record key, such as a domain name, or a number.

    Some other things about record keys:

    • They have their own syntax: 1 to 512 characters, using only letters, digits, and . - _ : ~ — and not . or ...
    • They are case-sensitive (though “it is a recommended practice to use all-lower-case record keys”).
    • The same TID can be used in 2 different collections, to show the records are related (a “"sidecar" extension record”).
    • Software should treat record keys as plain strings — the specification discourages, for example, decoding TIDs into numbers for use as a database key.
    • More kinds of record key may be added in the future.

    (See: ATProto Record.)

  • A tid record key tells you when the record was created.

    “Record keys are "user-controlled data" and may be arbitrarily selected by hostile accounts.” Do not trust them as timestamps.

  • A record's createdAt is when it was created.

    It is whatever the client put there. The app.bsky.feed.post lexicon describes it as a “Client-declared timestamp”. A client can set it to any time — past or future.

    When a record was actually seen is tracked separately, by the services that see it:

    • the firehose's #commit event has a time — “Timestamp of when this message was originally broadcast”,
    • the commit's rev is a TID, which a PDS “should use the current wall time” to make (from the sync specification), and
    • an AppView's post view has an indexedAt — when that AppView indexed it.

    For example, for one of @bsky.app's posts, public.api.bsky.app reported createdAt as 2026-11-19T18:33:36.813Z, and indexedAt as 2026-11-19T18:33:38.543Z — close, here, but nothing requires them to be. (Even these are each one service's view — a different AppView may have indexed it at a different time.)

  • ATProto JSON is just regular JSON.

    It is JSON with extra rules, from the ATProto data model — the same data model that is also written as DRISL-CBOR (the successor to DAG-CBOR) for storing, signing, and hashing. The differences from regular JSON:

    • no floating-point numbers — only integers, and those are best kept to 53 bits (between -9007199254740991 and 9007199254740991), for JavaScript,
    • links are written as {"$link": "<CID>"},
    • bytes are written as {"$bytes": "<base64>"} (plain base64, not URL-safe; padding optional),
    • blobs are written as {"$type": "blob", "ref": {"$link": …}, "mimeType": …, "size": …},
    • field names starting with $ are reserved for the protocol ($type, $link, $bytes) — and unknown $ fields should be ignored,
    • empty field names are not allowed,
    • strings must be valid UTF-8,
    • missing, null, and “false-y” are 3 different things, and null is only allowed where the lexicon says nullable, and
    • it is not byte-exact — key order and spacing do not matter, so it cannot be hashed directly; the DRISL-CBOR form is what gets hashed and signed.

    It is not DAG-JSON either — the data model specification says ATProto uses $link “as the key name instead of /”. And, there are practical limits too — for example, Bluesky's data validation guide suggests at most 32 levels of nesting, and 1 MiB per record (as CBOR). (See: ATProto Record.)

  • Records can contain floating-point numbers.

    Floats are not allowed in the data model — they do not round-trip reliably, and the bytes must be exact for hashing.

  • You can compute a record's CID by hashing its JSON.

    The CID is a hash of its DRISL-CBOR encoding. JSON is not byte-exact.

  • A missing field and a null field mean the same thing.

    They are different — and both are different from false, 0, or an empty array.

  • Every record in a repository is valid against its lexicon.

    By default, a PDS only checks records whose lexicon it knows (“optimistic validation”, or “fail-open”). Validate what you read.

  • A record with fields its lexicon does not mention is invalid.

    Unexpected fields should be ignored — “at worst as warnings”. (Validating a post with an extra mood field against app.bsky.feed.post passes. See: ATProto Lexicon.)

  • A deleted record leaves a tombstone.

    “Record deletion is supported without leaving a trace or "tombstone" of previous contents.”

  • Deleting a record removes it from the Internet.

    Deleting a record removes it from the user's repository. But, by then, copies may already be elsewhere — the creation went out on the PDS's firehose, and relays, AppViews, feed generators, search indexes, backups, and anyone else watching may have kept it.

    The deletion goes out on the firehose too, and the specifications expect other services to follow it. The accounts specification says “When accounts remove records from their public repositories, hosting services should remove public access to that content.” And, the sync specification says mirrors should “respect repository updates (eg, record deletion) … in a timely manner (within seconds or minutes)”. But, “should” is not a guarantee — nothing forces every service to comply, and a copy someone else kept (or a screenshot) is out of the user's control.

    (And, since the data was signed, such a copy can still be shown to be genuine. Treat anything written to a public repository as published.)

  • 联系我们 contact @ memedata.com