feat(secret-sharing): cleaned up API and exposed publicly #5427
feat(secret-sharing): cleaned up API and exposed publicly #5427
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
@greptile why did you stop reviewing the PR? review my PR! |
Greptile OverviewGreptile SummaryThis PR refactors/exposes the v1 secret-sharing API, adds identity support for shared secrets, and updates docs/frontend accordingly. It introduces a DB migration adding Confidence Score: 2/5
Important Files Changed
|
|
@greptile re-review PR with my comments to your comments in mind and update your summary |
maidul98
left a comment
There was a problem hiding this comment.
secret-sharing sounds odd as an API. i think it would make more sense for it to be:
- /api/v1/shared-secrets/
- GET /api/v1/shared-secrets/:id
- POST /api/v1/shared-secrets/:id/access
- DELETE /api/v1/shared-secrets/:id
also what happens to all of the old share links right before this change? wil we handle redirects?
Context
I've cleaned up the secret sharing API and added identity support. I haven't done much work on the requests side of things. If we expose the secret requests router, we can clean that one up more as well. The requests router is in much better shape than the secret sharing router was prior to this PR though.
Secret Sharing API - Before & After
Route Changes
/accessendpoint, which would give you an error and anisPasswordProtectedfield. Then you knew you need to re-hit the same API endpoint with a password. Not restful.Behavioral Changes
GET /api/v1/secret-sharing/:id(New)POST /:id/access/public/:idfor clarity (it's an action, not a resource read)brandingConfigfrom response (now fetched separately viaGET /branding?sharedSecretId=...)Response Schema Changes
Before (
POST /public/:id):After (
GET /:id):After (
POST /:id/access) - new endpoint:Frontend Flow Change
Before:
POST /public/:id: Returns everything in one call (metadata + secret value + branding). Would be called multiple times in the frontend for password protected secrets.After:
GET /:id: Get metadata (is it password protected? what access type?)POST /:id/accessPOST /:id/accesswith passwordGET /branding?sharedSecretId=..., fetch branding separatelyBreaking changes
In the past, secret sharing was end-to-end encrypted. We used to look up secrets using a combination of the secret's UUIDv4 ID and a hashed hex. This is over 14 months old, and I've now removed this logic from the API. This means that shared secrets that are over 14 months old will no longer work. This is not a problem, as secrets are set to expire at the latest after 30 days.
Steps to verify the change
Type
Checklist
type(scope): short description(scope is optional, e.g.,fix: prevent crash on syncorfix(api): handle null response).