Skip to content

Commit bad2679

Browse files
authored
chore(nuxt): switch ogImage security to strict mode (#153)
### 🔗 Linked issue <!-- Please ensure there is an open issue and mention its number. For example, "resolves #123" --> ### 🧭 Context The `nuxt-og-image` module exposes a security option to control how OG image requests are validated. Previously the config used `maxQueryParamSize: 2048` to limit query string length. The module's recommended hardened default is `strict: true`, which enables all protections at once. ### 📚 Description Replaces the `maxQueryParamSize: 2048` option inside `ogImage.security` with `strict: true` in `nuxt.config.ts`. `strict: true` enables the full security surface of the `nuxt-og-image` module (signature verification, query-param constraints, and other hardening) rather than only capping the query param size. This is a documentation-only config change with no functional impact on existing OG images as long as the app is not relying on unsigned, oversized query strings. **Impact:** configuration change only — no runtime logic modified.
2 parents 56afe95 + dc5607d commit bad2679

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ NUXT_OAUTH_DISCORD_BOT_TOKEN=
2222
# You can use: openssl rand -base64 32
2323
NUXT_SESSION_PASSWORD=
2424

25+
# Secret for generating OG images (generate a secure random string)
26+
# You can use: openssl rand -base64 32
27+
NUXT_IMAGE_PROXY_SECRET=
2528
# ===================================
2629
# Storage Configuration (Required)
2730
# ===================================

.github/workflows/continuous-integration.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,14 @@ jobs:
115115
VALIDATE_HTML: true
116116
NODE_OPTIONS: --max-old-space-size=4096
117117
NUXT_PUBLIC_SITE_URL: https://wolfstar.rocks
118+
NUXT_IMAGE_PROXY_SECRET: ci-test-og-image-secret-at-least-32-characters-long
118119
NUXT_SESSION_PASSWORD: ci-test-session-password-at-least-32-characters-long
119120

120121
- name: 🖥️ Test project (browser)
121122
run: vp run test:browser:prebuilt
122123
env:
123124
NUXT_SESSION_PASSWORD: ci-test-session-password-at-least-32-characters-long
125+
NUXT_IMAGE_PROXY_SECRET: ci-test-og-image-secret-at-least-32-characters-long
124126

125127
benchmark:
126128
name: ⚡ Benchmarks
@@ -162,13 +164,15 @@ jobs:
162164
run: vp run build:test
163165
env:
164166
NUXT_PUBLIC_SITE_URL: https://wolfstar.rocks
167+
NUXT_IMAGE_PROXY_SECRET: ci-test-og-image-secret-at-least-32-characters-long
165168
NUXT_SESSION_PASSWORD: ci-test-session-password-at-least-32-characters-long
166169

167170
- name: ♿ Accessibility audit (Lighthouse - ${{ matrix.mode }} mode)
168171
run: vp run test:a11y:prebuilt
169172
env:
170173
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
171174
LIGHTHOUSE_COLOR_MODE: ${{ matrix.mode }}
175+
NUXT_IMAGE_PROXY_SECRET: ci-test-og-image-secret-at-least-32-characters-long
172176
NUXT_SESSION_PASSWORD: ci-test-session-password-at-least-32-characters-long
173177

174178
knip:

nuxt.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,11 @@ export default defineNuxtConfig({
372372

373373
ogImage: {
374374
security: {
375-
maxQueryParamSize: 2048,
375+
strict: !!process.env.NUXT_IMAGE_PROXY_SECRET,
376+
secret: process.env.NUXT_IMAGE_PROXY_SECRET,
377+
// HMAC signing is sufficient; origin pinning blocks localhost e2e runs
378+
// and adds no meaningful security on top of signed URLs.
379+
restrictRuntimeImagesToOrigin: false,
376380
},
377381
},
378382
// PWA configuration

0 commit comments

Comments
 (0)