Upload to restricted data sets with `read: "restricted"`
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Start with the upload paths in sp/upload.ts and sp/upload-streaming.ts, then trace SDK store() and the default batched path in piece-batching.ts. Check the React hook use-upload-pieces.ts and secondary creation paths as well. Done means both upload paths honor the data set's read mode, restricted URLs and grants work, early validation covers both SDK paths, tests cover public and restricted modes, and the required Curio release is available.
索引モデルが issue の本文から書いたものです。
説明
Description
Since #1161, every upload sends read: "public" (sp/upload.ts:56, sp/upload-streaming.ts:263), and callers can't change it. A private upload, such as filecoin-pin's add --private, is therefore served on /public/{cid} until a restricted data set claims it. A piece that is never claimed stays there until Curio's PieceGC removes it, which takes at least 2 h and depends on Curio's config.
filecoin-project/curio#1662 (merged 2026-11-26) supports the private path. A read: "restricted" upload is stored for restricted access only and, before commit, served only on /download/{cid} to holders of a FOC grant. Curio refuses a restricted upload without an encryption envelope.
Neither #1662 nor #1643 is in a Curio release yet. The latest release is v1.29.3. On v1.29.3, read is ignored and every upload is public, there is no /download route, and pulls don't accept grants. This issue must not ship until approved providers run a release that includes both.
Proposed solution
- Core.
upload()already loads the data set throughgetPdpDataSet(sp/upload.ts:152), metadata included. It derives the read mode fromdataSet.metadata, with no extra RPC.uploadPiecesandcreatePieceBatchertakeread: 'public' | 'restricted', defaulting to'public'.
- SDK (
store()) has no read option. It takes the read mode from the data set'sreadmetadata (context.dataSetMetadata):- absent or
publicmeans public, so existing data sets don't change; restrictedmeans restricted;- any other value, including one with surrounding whitespace, is rejected before upload. Curio trims and lowercases the upload hint but compares the create metadata without trimming, so the two could disagree.
- absent or
- synapse-react.
useUploadSimplegets the read mode from coreupload()with no change of its own.useUploadPiecespasses the read mode from itsPdpDataSet's metadata toSP.uploadPieces(use-upload-pieces.ts:121).
- Secondaries. Create every secondary with
read=restricted, including replacements, which reuseoptions.metadata. keysmith'sdataSetMetadata()does not addread, so callers add it themselves. - Fail early. Run these checks in
store()and on the SDK's default batched path, which callsSP.createPieceBatcherdirectly and skipsstore()(piece-batching.ts:190).- Reject restricted uploads with more than one copy and no
getGrant, with aValidationError, before anything is uploaded. - Reject
withCDNfor restricted data sets.
- Reject restricted uploads with more than one copy and no
- URLs.
StorageContext.getPieceUrluses the context's read mode, soretrievalUrl,getPieceStatusand pull sources follow from it. Pulls use #1196's/downloadURLs withgetGrant.
Done criteria
- Approved providers run a Curio release that includes filecoin-project/curio#1662 and #1643 (version to be confirmed)
- A restricted data set sends
read: "restricted"on both upload paths; a public one, or one with noread, still sendsread: "public" - Core defaults to
read: 'public', and existing callers see no change - An unknown or untrimmed
readvalue,withCDNwith restricted, and restricted multi-copy withoutgetGrantare all rejected before upload - An upload without an envelope surfaces Curio's 400 through
FinalizeUploadErrorand throughstore() - For a restricted data set,
getPieceUrl,retrievalUrlandgetPieceStatusreturn/download/{cid}, never/public/{cid} - Restricted secondaries, including replacements, are created with
read=restricted, and their pulls use/downloadwith grants - Core
upload()derives the read mode from the data set it already loads;useUploadSimpleanduseUploadPiecesboth send it - The early rejections run on both
store()and the default batched path - MSW upload mocks take the read mode as a parameter, and tests cover both modes
- On devnet with the new Curio, a restricted piece returns 404 on
/public, and a two-copy restricted upload ends with two copies
Trade-offs and risks
- Curio dependency. On a v1.29.3 provider, a restricted upload is silently public,
/downloadURLs return 404, and restricted secondary pulls fail permanently. Two-copy restricted uploads, which work over/publictoday, would break. The Curio release is a hard prerequisite, not a recommendation. Synapse does not check provider versions or capabilities; making sure providers support restricted uploads is up to Curio. - Downloads are out of scope. Restricted content is read by CID through IPNI, which #1193 covers.
storage.download/context.downloadby PieceCID still resolve/public(piece/resolve-piece-url.ts,manager.ts:929) and fail for restricted pieces, with an error that says the piece is restricted. filecoin-pin's PieceCID retrieval (behind a flag) needs a follow-up once that path is wanted for restricted data. - Commit layout. Each commit stays scoped to one package (core, sdk, react), so per-package changelogs split correctly. Merge with rebase, or keep the squash title's scope accurate.
Notes
- Part of #1088. Depends on #1196. Follows the "later, for restricted data sets" note in #1161.
- Release blocker for encryption v2 (#1088): update its Curio line, since curio#1662 merged on 2026-11-26 but is not released yet.
- Client: filecoin-project/filecoin-pin
add --private(feat/encryption-v2) suppliesgetGrantfrom the session key's Grant for the group it writes under, or from the owner's own claim. - Docs:
upload-pipeline.mdx; coordinate with #1085 (access-control.mdx).
- 主要言語
- TypeScript
- スター
- 27
- フォーク
- 36
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 65
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FilOzone/synapse-sdk のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
FilOzone/synapse-sdk#1201 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
FilOzone/synapse-sdk#1198 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Clarify add pieces and create set can be made concurrently対応中かも @hugomrdias が 22 日前に担当しました。 オープンgood first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
FilOzone/synapse-sdk#749 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Pull second copies from `/download` with per-piece FOC grants対応中かも @JAG-UK が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
FilOzone/synapse-sdk#1196 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
FilOzone/synapse-sdk#1195 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
FilOzone/synapse-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
zabuton-app/meguri#875 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
iruzen-dono/workless#117 ·
メンテナーはふだん 1 日以内に返信
-
area:api area:web wave wave:trivial
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
vetro-protocol/vetro-monorepo#1321 ·
メンテナーはふだん 1 日以内に返信