fix(deps): update dependency astro to v4.16.19 [security] #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
4.15.9->4.16.19GitHub Vulnerability Alerts
CVE-2024-47885
Summary
A DOM Clobbering gadget has been discoverd in Astro's client-side router. It can lead to cross-site scripting (XSS) in websites enables Astro's client-side routing and has stored attacker-controlled scriptless HTML elements (i.e.,
iframetags with unsanitizednameattributes) on the destination pages.Details
Backgrounds
DOM Clobbering is a type of code-reuse attack where the attacker first embeds a piece of non-script, seemingly benign HTML markups in the webpage (e.g. through a post or comment) and leverages the gadgets (pieces of js code) living in the existing javascript code to transform it into executable code. More for information about DOM Clobbering, here are some references:
[1] https://scnps.co/papers/sp23_domclob.pdf
[2] https://research.securitum.com/xss-in-amp4email-dom-clobbering/
Gadgets found in Astro
We identified a DOM Clobbering gadget in Astro's client-side routing module, specifically in the
<ViewTransitions />component. When integrated, this component introduces the following vulnerable code, which is executed during page transitions (e.g., clicking an<a>link):https://github.com/withastro/astro/blob/7814a6cad15f06931f963580176d9b38aa7819f2/packages/astro/src/transitions/router.ts#L135-L156
However, this implementation is vulnerable to a DOM Clobbering attack. The
document.scriptslookup can be shadowed by an attacker injected non-script HTML elements (e.g.,<img name="scripts"><img name="scripts">) via the browser's named DOM access mechanism. This manipulation allows an attacker to replace the intended script elements with an array of attacker-controlled scriptless HTML elements.The condition
script.dataset.astroExec === ''on line 138 can be bypassed because the attacker-controlled element does not have a data-astroExec attribute. Similarly, the check on line 134 can be bypassed as the element does not require atypeattribute.Finally, the
innerHTMLof an attacker-injected non-script HTML elements, which is plain text content before, will be set to the.innerHTMLof an script element that leads to XSS.PoC
Consider a web application using Astro as the framework with client-side routing enabled and allowing users to embed certain scriptless HTML elements (e.g.,
formoriframe). This can be done through a bunch of website's feature that allows users to embed certain script-less HTML (e.g., markdown renderers, web email clients, forums) or via an HTML injection vulnerability in third-party JavaScript loaded on the page.For PoC website, please refer to:
https://stackblitz.com/edit/github-4xgj2d. Clicking the "about" button in the menu will trigger analert(1)from an attacker-injectedformelement.Impact
This vulnerability can result in cross-site scripting (XSS) attacks on websites that built with Astro that enable the client-side routing with
ViewTransitionsand store the user-inserted scriptless HTML tags without properly sanitizing thenameattributes on the page.Patch
We recommend replacing
document.scriptswithdocument.getElementsByTagName('script')for referring to script elements. This will mitigate the possibility of DOM Clobbering attacks leveraging thenameattribute.Reference
Similar issues for reference:
CVE-2024-56140
Summary
A bug in Astro’s CSRF-protection middleware allows requests to bypass CSRF checks.
Details
When the
security.checkOriginconfiguration option is set totrue, Astro middleware will perform a CSRF check. (Source code: https://github.com/withastro/astro/blob/6031962ab5f56457de986eb82bd24807e926ba1b/packages/astro/src/core/app/middlewares.ts)For example, with the following Astro configuration:
A request like the following would be blocked if made from a different origin:
However, a vulnerability exists that can bypass this security.
Pattern 1: Requests with a semicolon after the
Content-TypeA semicolon-delimited parameter is allowed after the type in
Content-Type.Web browsers will treat a
Content-Typesuch asapplication/x-www-form-urlencoded; abcas a simple request and will not perform preflight validation. In this case, CSRF is not blocked as expected.Pattern 2: Request without
Content-TypeheaderThe
Content-Typeheader is not required for a request. The following examples are sent without aContent-Typeheader, resulting in CSRF.Impact
Bypass CSRF protection implemented with CSRF middleware.
Note
Even with
credentials: 'include', browsers may not send cookies due to third-party cookie blocking. This feature depends on the browser version and settings, and is for privacy protection, not as a CSRF measure.CVE-2024-56159
Summary
A bug in the build process allows any unauthenticated user to read parts of the server source code.
Details
During build, along with client assets such as css and font files, the sourcemap files for the server code are moved to a publicly-accessible folder.
https://github.com/withastro/astro/blob/176fe9f113fd912f9b61e848b00bbcfecd6d5c2c/packages/astro/src/core/build/static-build.ts#L139
Any outside party can read them with an unauthorized HTTP GET request to the same server hosting the rest of the website.
While some server files are hashed, making their access obscure, the files corresponding to the file system router (those in
src/pages) are predictably named. For example. the sourcemap file forsrc/pages/index.astrogets nameddist/client/pages/index.astro.mjs.map.PoC
Here is one example of an affected open-source website:
https://creatorsgarten.org/pages/index.astro.mjs.map
The file can be saved and opened using https://evanw.github.io/source-map-visualization/ to reconstruct the source code.
The above accurately mirrors the source code as seen in the repository: https://github.com/creatorsgarten/creatorsgarten.org/blob/main/src/pages/index.astro
The above was found as the 4th result (and the first one on Astro 5.0+) when making the following search query on GitHub.com (search results link):
This vulnerability is the root cause of https://github.com/withastro/astro/issues/12703, which links to a simple stackblitz project demonstrating the vulnerability. Upon build, notice the contents of the
dist/client(referred to asconfig.build.clientin astro code) folder. All astro servers make the folder in question accessible to the public internet without any authentication. It contains.mapfiles corresponding to the code that runs on the server.Impact
All server-output (SSR) projects on Astro 5 versions v5.0.3 through v5.0.6 (inclusive), that have sourcemaps enabled, either directly or through an add-on such as sentry, are affected. The fix for server-output projects was released in [email protected].
Additionally, all static-output (SSG) projects built using Astro 4 versions 4.16.17 or older, or Astro 5 versions 5.0.7 or older, that have sourcemaps enabled are also affected. The fix for static-output projects was released in [email protected], and backported to Astro v4 in [email protected].
The immediate impact is limited to source code. Any secrets or environment variables are not exposed unless they are present verbatim in the source code.
There is no immediate loss of integrity within the the vulnerable server. However, it is possible to subsequently discover another vulnerability via the revealed source code .
There is no immediate impact to availability of the vulnerable server. However, the presence of an unsafe regular expression, for example, can quickly be exploited to subsequently compromise the availability.
Remediation
The fix for server-output projects was released in [email protected], and the fix for static-output projects was released in [email protected] and backported to Astro v4 in [email protected]. Users are advised to update immediately if they are using sourcemaps or an integration that enables sourcemaps.
CVE-2025-55303
Summary
In affected versions of
astro, the image optimization endpoint in projects deployed with on-demand rendering allows images from unauthorized third-party domains to be served.Details
On-demand rendered sites built with Astro include an
/_imageendpoint which returns optimized versions of images.The
/_imageendpoint is restricted to processing local images bundled with the site and also supports remote images from domains the site developer has manually authorized (using theimage.domainsorimage.remotePatternsoptions).However, a bug in impacted versions of
astroallows an attacker to bypass the third-party domain restrictions by using a protocol-relative URL as the image source, e.g./_image?href=//example.com/image.png.Proof of Concept
Create a new minimal Astro project (
[email protected]).Configure it to use the Node adapter (
@astrojs/[email protected]— newer versions are not impacted):Build the site by running
astro build.Run the server, e.g. with
astro preview.Append
/_image?href=//placehold.co/600x400to the preview URL, e.g. http://localhost:4321/_image?href=//placehold.co/600x400The site will serve the image from the unauthorized
placehold.coorigin.Impact
Allows a non-authorized third-party to create URLs on an impacted site’s origin that serve unauthorized image content.
In the case of SVG images, this could include the risk of cross-site scripting (XSS) if a user followed a link to a maliciously crafted SVG.
Release Notes
withastro/astro (astro)
v4.16.19Compare Source
Patch Changes
760acc8Thanks @ematipico! - Fixes an issue where remote paths weren't correctly computed when generating assetsv4.16.18Compare Source
Patch Changes
#12757
d0aaac3Thanks @matthewp! - Remove all assets created from the server build#12757
d0aaac3Thanks @matthewp! - Clean server sourcemaps from static outputv4.16.17Compare Source
Patch Changes
e7d14c3Thanks @ematipico! - Fixes an issue where thecheckOriginfeature wasn't correctly checking thecontent-typeheaderv4.16.16Compare Source
Patch Changes
#12542
65e50ebThanks @kadykov! - Fix JPEG image size determination#12525
cf0d8b0Thanks @ematipico! - Fixes an issue where withi18nenabled, Astro couldn't render the404.astrocomponent for non-existent routes.v4.16.15Compare Source
Patch Changes
b140a3fThanks @ematipico! - Fixes a regression where Astro was trying to accessRequest.headersv4.16.14Compare Source
Patch Changes
#12480
c3b7e7cThanks @matthewp! - Removes the default throw behavior inastro:env#12444
28dd3ceThanks @ematipico! - Fixes an issue where a server island hydration script might fail case the island ID misses from the DOM.#12476
80a9a52Thanks @florian-lefebvre! - Fixes a case where the Content Layerglob()loader would not update when renaming or deleting an entry#12418
25baa4eThanks @oliverlynch! - Fix cached image redownloading if it is the first asset#12477
46f6b38Thanks @ematipico! - Fixes an issue where the SSR build was emitting thedist/server/entry.mjsfile with an incorrect import at the top of the file/#12365
a23985bThanks @apatel369! - Fixes an issue whereAstro.currentLocalewas not correctly returning the locale for 404 and 500 pages.v4.16.13Compare Source
Patch Changes
#12436
453ec6bThanks @martrapp! - Fixes a potential null access in the clientside router#12392
0462219Thanks @apatel369! - Fixes an issue where scripts were not correctly injected during the build. The issue was triggered when there were injected routes with the sameentrypointand differentpatternv4.16.12Compare Source
Patch Changes
acac0afThanks @ematipico! - Fixes an issue where the dev server returns a 404 status code when a user middleware returns a validResponse.v4.16.11Compare Source
Patch Changes
#12305
f5f7109Thanks @florian-lefebvre! - Fixes a case where the error overlay would not escape the message#12402
823e73bThanks @ematipico! - Fixes a case where Astro allowed to call an action without usingAstro.callAction. This is now invalid, and Astro will show a proper error.v4.16.10Compare Source
Patch Changes
#12311
bf2723eThanks @dinesh-58! - Addscheckedto the list of boolean attributes.#12363
222f718Thanks @Fryuni! - Fixes code generated byastro addcommand when adding a version of an integration other than the defaultlatest.#12368
493fe43Thanks @bluwy! - Improves error logs when executing commands#12355
c4726d7Thanks @apatel369! - Improves error reporting for invalid frontmatter in MDX files during theastro buildcommand. The error message now includes the file path where the frontmatter parsing failed.v4.16.9Compare Source
Patch Changes
#12333
836cd91Thanks @imattacus! - Destroy the server response stream if async error is thrown#12358
7680349Thanks @spacedawwwg! - HonorsinlineAstroConfigparameter ingetViteConfigwhen creating a logger#12353
35795a1Thanks @hippotastic! - Fixes an issue in dev server watch file handling that could cause multiple restarts for a single file change.#12351
5751488Thanks @florian-lefebvre! - Reverts a change made in4.16.6that prevented usage ofastro:envsecrets inside middleware in SSR#12346
20e5a84Thanks @bluwy! - Fixes sourcemap generation when prefetch is enabled#12349
1fc83d3Thanks @norskeld! - Fixes thegetImageoptions type so it properly extendsImageTransformv4.16.8Compare Source
Patch Changes
#12338
9ca89b3Thanks @situ2001! - ResetsNODE_ENVto ensure install command run in dev mode#12286
9d6bcdbThanks @florian-lefebvre! - Fixes a case where a warning for experimentalastro:envsupport would be shown when using an adapter but not actually usingastro:env#12342
ffc836bThanks @liruifengv! - Fixes a typo in the command name of the CLI#12301
0cfc69dThanks @apatel369! - Fixes an issue with action handler context by passing the correct context (ActionAPIContext).#12312
5642ef9Thanks @koyopro! - Fixes an issue where usinggetViteConfig()returns incorrect and duplicate configuration#12245
1d4f6a4Thanks @bmenant! - Addcomponentsproperty to MDXInstance type definition (RenderResult and module import)#12340
94eaeeaThanks @ematipico! - Fixes an issue where Astro actions didn't work whenbasewas different from/v4.16.7Compare Source
Patch Changes
#12263
e9e8080Thanks @Fryuni! - Fixes conflict between server islands and on-demand dynamic routes in the form of/[...rest]or/[paramA]/[paramB].#12279
b781f88Thanks @jsparkdev! - Update wrong error message#12273
c2ee963Thanks @ascorbic! - Fixes an issue with some package managers where sites would not build if TypeScript was not installed.#12235
a75bc5eThanks @ematipico! - Fixes a bug where Astro Actions couldn't redirect to the correct pathname when there was a rewrite involved.#11839
ff522b9Thanks @icaliman! - Fixes error when returning a top-levelnullfrom an Astro file frontmatter#12272
388d237Thanks @ascorbic! - Correctly handles local images when using a base path in SSRv4.16.6Compare Source
Patch Changes
#11823
a3d30a6Thanks @DerTimonius! - fix: improve error message when inferSize is used in local images with the Image component#12227
8b1a641Thanks @florian-lefebvre! - Fixes a case where environment variables would not be refreshed when usingastro:env#12239
2b6daa5Thanks @ematipico! - BREAKING CHANGE to the experimental Container API onlyChanges the default page rendering behavior of Astro components in containers, and adds a new option
partial: falseto render full Astro pages as before.Previously, the Container API was rendering all Astro components as if they were full Astro pages containing
<!DOCTYPE html>by default. This was not intended, and now by default, all components will render as page partials: only the contents of the components without a page shell.To render the component as a full-fledged Astro page, pass a new option called
partial: falsetorenderToString()andrenderToResponse():v4.16.5Compare Source
Patch Changes
ff68ba5Thanks @martrapp! - Fixes an issue with cssesc in dev mode when settingvite.ssr.noExternal: truev4.16.4Compare Source
Patch Changes
#12223
79ffa5dThanks @ArmandPhilippot! - Fixes a false positive reported by the dev toolbar Audit app where a label was considered missing when associated with a buttonThe
buttonelement can be used with a label (e.g. to create a switch) and should not be reported as an accessibility issue when used as a child of alabel.#12199
c351352Thanks @ematipico! - Fixes a regression in the computation ofAstro.currentLocale#12222
fb55695Thanks @ematipico! - Fixes an issue where the edge middleware couldn't correctly compute the client IP address when callingctx.clientAddress()v4.16.3Compare Source
Patch Changes
#12220
b049359Thanks @bluwy! - Fixes accidental internalsetOnSetGetEnvparameter rename that caused runtime errors#12197
2aa2dfdThanks @ematipico! - Fix a regression where a port was incorrectly added to theAstro.urlv4.16.2Compare Source
Patch Changes
12b0022Thanks @bluwy! - Reverts https://github.com/withastro/astro/pull/12173 which causedCan't modify immutable headerswarnings and 500 errors on Cloudflare Pagesv4.16.1Compare Source
Patch Changes
#12542
65e50ebThanks @kadykov! - Fix JPEG image size determination#12525
cf0d8b0Thanks @ematipico! - Fixes an issue where withi18nenabled, Astro couldn't render the404.astrocomponent for non-existent routes.v4.16.0Compare Source
Minor Changes
#12039
710a1a1Thanks @ematipico! - Adds amarkdown.shikiConfig.langAliasoption that allows aliasing a non-supported code language to a known language. This is useful when the language of your code samples is not a built-in Shiki language, but you want your Markdown source to contain an accurate language while also displaying syntax highlighting.The following example configures Shiki to highlight
cjscode blocks using thejavascriptsyntax highlighter:Then in your Markdown, you can use the alias as the language for a code block for syntax highlighting:
#11984
3ac2263Thanks @chaegumi! - Adds a newbuild.concurrencyconfiguration option to specify the number of pages to build in parallelIn most cases, you should not change the default value of
1.Use this option only when other attempts to reduce the overall rendering time (e.g. batch or cache long running tasks like fetch calls or data access) are not possible or are insufficient.
Use this option only if the refactors are not possible. If the number is set too high, the page rendering may slow down due to insufficient memory resources and because JS is single-threaded.
Patch Changes
#12160
c6fd1dfThanks @louisescher! - Fixes a bug whereastro.config.mtsandastro.config.ctsweren't reloading the dev server upon modifications.#12130
e96bcaeThanks @thehansys! - Fixes a bug in the parsing ofx-forwarded-\*Requestheaders, where multiple values assigned to those headers were not correctly parsed.Now, headers like
x-forwarded-proto: https,httpare correctly parsed.#12147
9db755aThanks @ascorbic! - Skips setting statusMessage header for HTTP/2 responseHTTP/2 doesn't support status message, so setting this was logging a warning.
#12151
bb6d37fThanks @ematipico! - Fixes an issue whereAstro.currentLocalewasn't incorrectly computed when thedefaultLocalebelonged to a custom locale path.Updated dependencies [
710a1a1]:v4.15.12Compare Source
Patch Changes
#12121
2490cebThanks @ascorbic! - Support passing the valuesInfinityand-Infinityas island props.#12118
f47b347Thanks @Namchee! - Removes thestrip-ansidependency in favor of the native Node API#12126
6e1dfebThanks @ascorbic! - Clear content layer cache when astro version changes#12117
a46839aThanks @ArmandPhilippot! - Updates Vite links to use their new domain#12124
499fbc9Thanks @ascorbic! - Allows special characters in Action names#12123
b8673dfThanks @Princesseuh! - Fixes missingbodyproperty on CollectionEntry types for content layer entries#12132
de35daaThanks @jcayzac! - Updates thecookiedependency to avoid the CVE 2024-47764 vulnerability.#12113
a54e520Thanks @ascorbic! - Adds a helpful error when attempting to render an undefined collection entryv4.15.11Compare Source
Patch Changes
#12097
11d447fThanks @ascorbic! - Fixes error where references in content layer schemas sometimes incorrectly report as missing#12108
918953bThanks @lameuler! - Fixes a bug where data URL images were not correctly handled. The bug resulted in anENAMETOOLONGerror.#12105
42037f3Thanks @ascorbic! - Returns custom statusText that has been set in a Response#12109
ea22558Thanks @ematipico! - Fixes a regression that was introduced by an internal refactor of how the middleware is loaded by the Astro application. The regression was introduced by #11550.When the edge middleware feature is opted in, Astro removes the middleware function from the SSR manifest, and this wasn't taken into account during the refactor.
#12106
d3a74daThanks @ascorbic! - Handles case where an immutable Response object is returned from an endpoint#12090
d49a537Thanks @markjaquith! - Server islands: changes the server island HTML placeholder comment so that it is much less likely to get removed by HTML minifiers.v4.15.10Compare Source
Patch Changes
#12084
12dae50Thanks @Princesseuh! - Adds missing filePath property on content layer entries#12046
d7779dfThanks @martrapp! - View transitions: Fixes Astro's fade animation to prevent flashing during morph transitions.#12043
1720c5bThanks @bluwy! - Fixes injected endpointprerenderoption detection#12095
76c5fbdThanks @TheOtterlord! - Fix installing non-stable versions of integrations withastro addConfiguration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.