[PR #2150] [MERGED] feat: resource restriction in presign token #2076

Closed
opened 2026-02-26 20:32:20 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/2150
Author: @tedliang
Created: 11/8/2025
Status: Merged
Merged: 12/8/2025
Merged by: @Mythie

Base: mainHead: 2098_scoped_presign_token


📝 Commits (5)

  • 9be6023 #2098 Resource restriction in presign token
  • 50054f3 feat: add scope to verify-embedding-presign-token
  • ad42008 feat: update test
  • 341a23a Merge branch 'main' into 2098_scoped_presign_token
  • 9a6a809 fix: also verify scope in update methods

📊 Changes

11 files changed (+166 additions, -80 deletions)

View changed files

📝 apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx (+3 -1)
📝 apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx (+3 -1)
📝 packages/app-tests/e2e/api/v2/embedding-presign.spec.ts (+132 -74)
📝 packages/lib/server-only/embedding-presign/create-embedding-presign-token.ts (+3 -0)
📝 packages/lib/server-only/embedding-presign/verify-embedding-presign-token.ts (+8 -0)
📝 packages/trpc/server/embedding-router/create-embedding-presign-token.ts (+2 -1)
📝 packages/trpc/server/embedding-router/create-embedding-presign-token.types.ts (+4 -0)
📝 packages/trpc/server/embedding-router/update-embedding-document.ts (+4 -1)
📝 packages/trpc/server/embedding-router/update-embedding-template.ts (+4 -1)
📝 packages/trpc/server/embedding-router/verify-embedding-presign-token.ts (+2 -1)
📝 packages/trpc/server/embedding-router/verify-embedding-presign-token.types.ts (+1 -0)

📄 Description

Description

Support resource restriction in presign token.

Scope the presign token to specific resource.

Fixes #2098

Changes Made

  • Introduce optional scope property in Create embedding presign token request. Example value: documentId:123
  • Pass scope with documentId:{id} to verifyEmbeddingPresignToken in embed document edit endpoint.
  • Pass scope with templateId:{id} to verifyEmbeddingPresignToken in embed template edit endpoint.

Testing Performed

  • Tested create embedding presign token with scope: documentId:4
  • Tested embed document edit with matched resource
  • Tested embed document edit with not-matched resource

Checklist

  • I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable.
  • I have followed the project's coding style guidelines.
  • I have addressed the code review feedback from the previous submission, if applicable.

Additional Notes


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/2150 **Author:** [@tedliang](https://github.com/tedliang) **Created:** 11/8/2025 **Status:** ✅ Merged **Merged:** 12/8/2025 **Merged by:** [@Mythie](https://github.com/Mythie) **Base:** `main` ← **Head:** `2098_scoped_presign_token` --- ### 📝 Commits (5) - [`9be6023`](https://github.com/documenso/documenso/commit/9be602333ae33e43eb1586505572e0625629db16) #2098 Resource restriction in presign token - [`50054f3`](https://github.com/documenso/documenso/commit/50054f362c2cffb36b22ff44182a1a4ce4b58a83) feat: add scope to verify-embedding-presign-token - [`ad42008`](https://github.com/documenso/documenso/commit/ad42008b8ea4587b369a482e1f581abd9944acfe) feat: update test - [`341a23a`](https://github.com/documenso/documenso/commit/341a23a7905e3710f1d7423db0a53fdaeaf9ea34) Merge branch 'main' into 2098_scoped_presign_token - [`9a6a809`](https://github.com/documenso/documenso/commit/9a6a80974a57bc22d433f1c7687bf7c5f686bfc5) fix: also verify scope in update methods ### 📊 Changes **11 files changed** (+166 additions, -80 deletions) <details> <summary>View changed files</summary> 📝 `apps/remix/app/routes/embed+/v1+/authoring+/document.edit.$id.tsx` (+3 -1) 📝 `apps/remix/app/routes/embed+/v1+/authoring+/template.edit.$id.tsx` (+3 -1) 📝 `packages/app-tests/e2e/api/v2/embedding-presign.spec.ts` (+132 -74) 📝 `packages/lib/server-only/embedding-presign/create-embedding-presign-token.ts` (+3 -0) 📝 `packages/lib/server-only/embedding-presign/verify-embedding-presign-token.ts` (+8 -0) 📝 `packages/trpc/server/embedding-router/create-embedding-presign-token.ts` (+2 -1) 📝 `packages/trpc/server/embedding-router/create-embedding-presign-token.types.ts` (+4 -0) 📝 `packages/trpc/server/embedding-router/update-embedding-document.ts` (+4 -1) 📝 `packages/trpc/server/embedding-router/update-embedding-template.ts` (+4 -1) 📝 `packages/trpc/server/embedding-router/verify-embedding-presign-token.ts` (+2 -1) 📝 `packages/trpc/server/embedding-router/verify-embedding-presign-token.types.ts` (+1 -0) </details> ### 📄 Description ## Description <!--- Describe the changes introduced by this pull request. --> Support resource restriction in presign token. <!--- Explain what problem it solves or what feature/fix it adds. --> Scope the presign token to specific resource. ## Related Issue <!--- If this pull request is related to a specific issue, reference it here using #issue_number. --> Fixes #2098 ## Changes Made <!--- Provide a summary of the changes made in this pull request. --> - Introduce optional scope property in `Create embedding presign token` request. Example value: documentId:123 - Pass scope with documentId:{id} to verifyEmbeddingPresignToken in embed document edit endpoint. - Pass scope with templateId:{id} to verifyEmbeddingPresignToken in embed template edit endpoint. ## Testing Performed <!--- Describe the testing that you have performed to validate these changes. --> <!--- Include information about test cases, testing environments, and results. --> - Tested create embedding presign token with scope: documentId:4 - Tested embed document edit with matched resource - Tested embed document edit with not-matched resource ## Checklist <!--- Please check the boxes that apply to this pull request. --> <!--- You can add or remove items as needed. --> - [X] I have tested these changes locally and they work as expected. - [X] I have added/updated tests that prove the effectiveness of these changes. - [X] I have updated the documentation to reflect these changes, if applicable. - [X] I have followed the project's coding style guidelines. - [X] I have addressed the code review feedback from the previous submission, if applicable. ## Additional Notes <!--- Provide any additional context or notes for the reviewers. --> <!--- This might include details about design decisions, potential concerns, or anything else relevant. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:32:20 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#2076
No description provided.