astro
7.4.13 · 18 Nov 2026MIT12.5M / weekRepositoryHomepagenpmAtom feed
4.16.19 is the newest release of 4.x.
In short
1 breaking1 new7 fixed
- Breaking
BREAKING CHANGE to the experimental Container API only
Security
24 advisories affect 4.10.0; 7.4.5 fixes them
- CriticalAstro: Remote code execution through AVIF image optimizationGHSA-26w7-cxv4-gfx2 · 8 Sep 2026Fixed in 7.2.8
- HighAstro: Host header SSRF in prerendered error page fetchGHSA-2pvr-wf23-7pc7 · 16 Jun 2026Fixed in 6.4.6
- HighAstro: Reflected XSS via unescaped slot nameGHSA-8hv8-536x-4wqp · 16 Jun 2026Fixed in 6.3.3
- HighAstro vulnerable to reflected XSS via the server islands featureGHSA-wrwg-2hg8-v723 · 19 Nov 2025Fixed in 5.15.8
- HighAstro's server source code is exposed to the public if sourcemaps are enabledGHSA-49w6-73cw-chjr · 19 Dec 2024Fixed in 4.16.18
19 more
- ModerateAstro: Reflected/Stored XSS via unescaped <script>/<style> tag content in JSX/MDX renderingGHSA-98hj-9722-w3j8 · 22 Oct 2026Fixed in 7.3.2
- ModerateAstro: Authorization bypass from missing path-segment boundary check when stripping the configured baseGHSA-376h-93r7-7g6f · 8 Sep 2026Fixed in 7.2.4
- ModerateAstro: XSS via unescaped spread attribute names in renderHTMLElement (incomplete fix for CVE-2026-54298)GHSA-f48w-9m4c-m7f5 · 20 Jul 2026Fixed in 7.0.6
- ModerateAstro: Reflected XSS via unescaped View Transition animation propertiesGHSA-4g3v-8h47-v7g6 · 20 Jul 2026Fixed in 7.1.0
- ModerateAstro: XSS via Unescaped Attribute Names in Spread PropsGHSA-jrpj-wcv7-9fh9 · 16 Jun 2026Fixed in 6.4.6
- ModerateAstro: XSS in define:vars via incomplete </script> tag sanitizationGHSA-j687-52p2-xcff · 21 Apr 2026Fixed in 6.1.6
- ModerateAstro has an Authentication Bypass via Double URL Encoding, a bypass for CVE-2025-64765GHSA-whqg-ppgf-wp8c · 8 Dec 2025Fixed in 5.15.8
- ModerateAstro Cloudflare adapter has Stored Cross-site Scripting vulnerability in /_image endpointGHSA-fvmw-cj7j-j39q · 19 Nov 2025Fixed in 5.15.9
- ModerateAstro's middleware authentication checks based on url.pathname can be bypassed via url encoded valuesGHSA-ggxq-hp9w-j794 · 19 Nov 2025Fixed in 5.15.8
- ModerateAstro vulnerable to URL manipulation via headers, leading to middleware and CVE-2025-61925 bypassGHSA-hr2q-hp5q-x767 · 13 Nov 2025Fixed in 5.15.5
- ModerateAstro's `X-Forwarded-Host` is reflected without validationGHSA-5ff5-9fcw-vg88 · 10 Oct 2025Fixed in 5.14.3
- ModerateAstro allows unauthorized third-party images in _image endpointGHSA-xf8x-j4p2-f749 · 19 Aug 2025Fixed in 4.16.19
- ModerateAtro CSRF Middleware Bypass (security.checkOrigin)GHSA-c4pw-33h3-35xw · 18 Dec 2024Fixed in 4.16.17
- ModerateDOM Clobbering Gadget found in astro's client-side router that leads to XSSGHSA-m85w-3h95-hcf9 · 14 Oct 2024Fixed in 4.16.1
- LowAstro: XSS via attribute injection in dynamic tag namesGHSA-mh32-jxcr-mh9f · 13 Nov 2026Fixed in 7.4.5
- LowAstro: Cross-site scripting via unescaped transition:* directive values on hydrated islandsGHSA-7pw4-f3q4-r2p2 · 20 Jul 2026Fixed in 7.0.4
- LowAstro: Server island encrypted parameters vulnerable to cross-component replayGHSA-xr5h-phrj-8vxv · 13 May 2026Fixed in 6.1.10
- LowAstro: Remote allowlist bypass via unanchored matchPathname wildcardGHSA-g735-7g2w-hh3f · 26 Mar 2026Fixed in 5.18.1
- LowAstro Development Server has Arbitrary Local File ReadGHSA-x3h8-62x9-952g · 19 Nov 2025Fixed in 5.14.3
Release note
Minor Changes
Adds experimental support for the
astro:envAPI.The
astro:envAPI lets you configure a type-safe schema for your environment variables, and indicate whether they should be available on the server or the client. Import and use your defined variables from the appropriate/clientor/servermodule:--- import { PUBLIC_APP_ID } from 'astro:env/client'; import { PUBLIC_API_URL, getSecret } from 'astro:env/server'; const API_TOKEN = getSecret('API_TOKEN'); const data = await fetch(`${PUBLIC_API_URL}/users`, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${API_TOKEN}`, }, body: JSON.stringify({ appId: PUBLIC_APP_ID }), }); ---To define the data type and properties of your environment variables, declare a schema in your Astro config in
experimental.env.schema. TheenvFieldhelper allows you define your variable as a string, number, or boolean and pass properties in an object:// astro.config.mjs import { defineConfig, envField } from 'astro/config'; export default defineConfig({ experimental: { env: { schema: { PUBLIC_API_URL: envField.string({ context: 'client', access: 'public', optional: true }), PUBLIC_PORT: envField.number({ context: 'server', access: 'public', default: 4321 }), API_SECRET: envField.string({ context: 'server', access: 'secret' }), }, }, }, });There are three kinds of environment variables, determined by the combination of
context(clientorserver) andaccess(privateorpublic) settings defined in yourenv.schema:Public client variables: These variables end up in both your final client and server bundles, and can be accessed from both client and server through the
astro:env/clientmodule:import { PUBLIC_API_URL } from 'astro:env/client';Public server variables: These variables end up in your final server bundle and can be accessed on the server through the
astro:env/servermodule:import { PUBLIC_PORT } from 'astro:env/server';Secret server variables: These variables are not part of your final bundle and can be accessed on the server through the
getSecret()helper function available from theastro:env/servermodule:import { getSecret } from 'astro:env/server'; const API_SECRET = getSecret('API_SECRET'); // typed const SECRET_NOT_IN_SCHEMA = getSecret('SECRET_NOT_IN_SCHEMA'); // string | undefined
Note: Secret client variables are not supported because there is no safe way to send this data to the client. Therefore, it is not possible to configure both
context: "client"andaccess: "secret"in your schema.To learn more, check out the documentation.
Patch Changes
Improves DX by throwing the original
AstroUserErrorwhen an error is thrown inside a.mdxfile.Errors that are emitted during a rewrite are now bubbled up and shown to the user. A 404 response is not returned anymore.
The integration now exposes a function called
getContainerRenderer, that can be used inside the Container APIs to load the relative renderer.import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import ReactWrapper from '../src/components/ReactWrapper.astro'; import { loadRenderers } from 'astro:container'; import { getContainerRenderer } from '@astrojs/react'; test('ReactWrapper with react renderer', async () => { const renderers = await loadRenderers([getContainerRenderer()]); const container = await AstroContainer.create({ renderers, }); const result = await container.renderToString(ReactWrapper); expect(result).toContain('Counter'); expect(result).toContain('Count: <!-- -->5'); });- Breaking
BREAKING CHANGE to the experimental Container API only
Changes the type of the
renderersoption of theAstroContainer::createfunction and adds a dedicated functionloadRenderers()to load the rendering scripts from renderer integration packages (@astrojs/react,@astrojs/preact,@astrojs/solid-js,@astrojs/svelte,@astrojs/vue,@astrojs/lit, and@astrojs/mdx).You no longer need to know the individual, direct file paths to the client and server rendering scripts for each renderer integration package. Now, there is a dedicated function to load the renderer from each package, which is available from
getContainerRenderer():import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import ReactWrapper from '../src/components/ReactWrapper.astro'; import { loadRenderers } from "astro:container"; import { getContainerRenderer } from "@astrojs/react"; test('ReactWrapper with react renderer', async () => { + const renderers = await loadRenderers([getContainerRenderer()]) - const renderers = [ - { - name: '@astrojs/react', - clientEntrypoint: '@astrojs/react/client.js', - serverEntrypoint: '@astrojs/react/server.js', - }, - ]; const container = await AstroContainer.create({ renderers, }); const result = await container.renderToString(ReactWrapper); expect(result).toContain('Counter'); expect(result).toContain('Count: <!-- -->5'); });The new
loadRenderers()helper function is available fromastro:container, a virtual module that can be used when running the Astro container insidevite. It's not possible anymore to use
Astro.rewrite("/404")inside static pages. This isn't counterproductive because Astro will end-up emitting a page that contains the HTML of 404 error page.It's still possible to use
Astro.rewrite("/404")inside on-demand pages, or pages that opt-out from prerendering.Fixes a case where
Astro.urlwould be incorrect when havingbuild.formatset to'preserve'in the Astro configFixes an issue where
Astro.rewritewasn't carrying over the body of aRequestin on-demand pages.Fixes an issue where the function
getViteConfigwasn't returning the correct merged Astro configuration
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.