Commit 0b8ead9
authored
fix(@vercel/blob): Disallow passing callbackUrl from clients (#875)
* fix(@vercel/blob): Disallow passing callbackUrl from clients
BREAKING CHANGE:
To continue receiving onUploadCompleted callback once a file is uploaded with
Client Uploads, you need to provide the callbackUrl at the onBeforeGenerateToken
step when using handleUpload.
Before:
await handleUpload({ body, request,
onBeforeGenerateToken: async (pathname) => { /* options */ },
onUploadCompleted: async ({ blob, tokenPayload }) => { /* code */ },
});
After:
await handleUpload({ body, request,
onBeforeGenerateToken: async (pathname) => { callbackUrl: 'https://example.com/api/upload' },
onUploadCompleted: async ({ blob, tokenPayload }) => { /* code */ },
});
See the updated documentation at
https://vercel.com/docs/vercel-blob/client-upload to know more.
Details:
Before this commit, during Client Uploads, we would infer the `callbackUrl` at
the client side level (browser) based on location.href (for convenience).
This is wrong and allows browsers to redirect the onUploadCompleted callback to
a different website.
While not a security risk because the blob urls are already public and the
browser already knows them, it still pose a risk of database drift if you're
relying on onUploadCompleted callback to update any system on your side.
* changeset
* update nodejs version
* update
* update
* fix
* update
* change minimum requirement
* update
* update
* update changeset
* update
* update
* update
* update1 parent acaa9a0 commit 0b8ead9
File tree
7 files changed
+765
-25
lines changed- .changeset
- .github/workflows
- packages/blob
- src
7 files changed
+765
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
0 commit comments