Skip to content

[docs-infra] Harden the OG image edge function - #49116

Draft
Janpot wants to merge 1 commit into
mui:masterfrom
Janpot:harden-og-image-edge-function
Draft

[docs-infra] Harden the OG image edge function#49116
Janpot wants to merge 1 commit into
mui:masterfrom
Janpot:harden-og-image-edge-function

Conversation

@Janpot

@Janpot Janpot commented Sep 8, 2026

Copy link
Copy Markdown
Member

Three small defense-in-depth changes to the public, unauthenticated /edge-functions/og-image endpoint. They all live in the same file, so they're grouped into one PR:

  • Pin the dependency. It imported https://deno.land/x/og_edge/mod.ts — unversioned, so a fresh build resolves to whatever is latest and an upstream release could change the incorporated code with no review here. Pinned to @0.0.6.
  • Bound the inputs. Query-controlled title/description/product/authors flowed into the image renderer with no length or complexity limits. Now capped (field lengths, author-list size, author name length, GitHub username format) before anything is rendered.
  • Rate-limit. Each distinct query string is a fresh cache key that triggers image layout + font fetches; added Netlify's built-in limit (100/min per ip+domain), enforced at the edge before the handler runs.

@code-infra-dashboard

code-infra-dashboard Bot commented Sep 8, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-49116--material-ui.netlify.app/
QR code for https://deploy-preview-49116--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@Janpot
Janpot force-pushed the harden-og-image-edge-function branch from 9ce9145 to 8ed9ec1 Compare September 8, 2026 15:06
@Janpot
Janpot force-pushed the harden-og-image-edge-function branch 2 times, most recently from 182eb93 to b3923f4 Compare September 8, 2026 15:17
Three defense-in-depth changes to the public, unauthenticated
/edge-functions/og-image endpoint (all the same file, so grouped):

- Pin the `og_edge` import (was an unversioned deno.land URL that
  resolves to latest) so an upstream release can't change a build
  without review.
- Bound query-controlled inputs before they reach the image renderer:
  title/description/product length, author-list size, author name
  length, and GitHub username format.
- Add Netlify rate limiting (100 req/min per ip+domain) so a client
  can't force unbounded render work by varying query parameters.
@Janpot
Janpot force-pushed the harden-og-image-edge-function branch from b3923f4 to 58bddf6 Compare September 9, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant