Commit 476f5ad
authored
[codex] Secure Open Graph image endpoint (#1296)
* fix: secure open graph image endpoint
Build generated Open Graph image URLs from the current page URL instead of raw title and description text. Validate same-origin document URLs in the Cloudflare image function and extract preview text from fetched HTML metadata.
* refactor: simplify og metadata extraction
Parse the fetched HTML response directly when extracting Open Graph preview text instead of using callback state from HTMLRewriter.
* fix: fetch og page through assets binding
Use the Cloudflare Pages ASSETS binding to read same-origin page HTML for OG image rendering instead of issuing a public same-origin fetch from the function.1 parent 808116c commit 476f5ad
7 files changed
Lines changed: 312 additions & 122 deletions
File tree
- apps/docs
- __tests__
- app/routes
- functions/ogimage/[[path]]
- src
- bindings
- common
- components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
14 | 25 | | |
15 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
16 | 31 | | |
17 | 32 | | |
18 | 33 | | |
19 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | 130 | | |
132 | 131 | | |
133 | 132 | | |
| |||
0 commit comments