APP-3774: Populate external modality views in feeds by blackmichael · Pull Request #5819 · bluesky-social/atproto
Commentaire de pull request · PR #5819 APP-3774: Populate external modality views in feeds · @github-actions Review: APP-3774, external modality views in feeds
One non-blocking finding. The rest looks correct.
Finding
Non-blocking (security; how much it matters depends on clients): feed rendering attaches data to non-Standard.site roots without any URL check. See packages/bsky/src/views/index.ts:2385-2396 and the default: return true branch in packages/bsky/src/util/external/validation.ts .
getEmbedExternalView only accepts a non-Standard.site record when isExternalRecordUrlSafe(url, cfg.externalRecordsSafeDomains) also passes. Views.externalEmbed doesn't apply that check.
Scenario: someone writes a post directly to their PDS, skipping compose. The post pins a popular social.grain.gallery or place.stream.livestream and sets external.uri to an arbitrary domain. Every feed response then includes that record's full modality view, with owner, likers and counts, as data on the post.
Compose would refuse the same input and return unverifiedAssociatedRefs with no view.
The PR treats standalone modality views as needing no check. But a feed embed binds a record to a URL the post author controls, so I'd expect it to follow the compose rule. Two options:
Thread the allowlist into the feed path.
Require data.uri to match external.uri for non-Standard.site records.
If clients always link to data.uri rather than external.uri , the risk is lower, but compose and feeds would still trust different things. Inline comment posted.
What I checked, no issues found
Standard.site validation moved to the callers. externalEmbedFromStandardSiteRecords no longer validates internally. Both remaining callers validate first: externalEmbed through validateExternalEmbedRecord , and getEmbedExternalView through verified .
The pinned-root path validates with getSiteStandardRecordsFromRefs([root]) . It resolves the same document and publication as the render path, because only the selected root takes part.
A missing or null pin doesn't fall back to latest.
Publication dependencies resolve as latest.
getEmbedExternalView for non-Standard.site records now also requires the root record to be present with a matching $type . A missing root now returns as unverified instead of an empty verified result, which seems intended.
externalRecordView signature change ( ItemRef instead of uri, …, cid ): all call sites are updated, and the options argument position is correct in timeline-v2.
Lexicon override: adding the optional #view.data union is backward-compatible. CIDs are updated in the api, bsky and ozone manifests. It depends on bsky#90 merging first, as the description says.
Switching hydratePosts to 'detailed' : preview samples are bounded per root, and packages/bsky/AGENTS.md is updated to match. This adds per-post backlink and profile fan-out to every feed request, so watch latency on rollout. It isn't unbounded.
Changeset: covers api, bsky and ozone at patch , which fits pre-v1 additive changes.
Stale docs and tests: I didn't find any stale JSDoc or comments. The removed legacy-overlay validation tests are now covered by validation.test.ts and index.test.ts .
CI: Repository CI was still running when I checked.
Claude review, run Ouvrir sur GitHub →