angular-ngrx-nx-realworld-example-app
angular-ngrx-nx-realworld-example-app copied to clipboard
fix(deps): update dependency astro to v4.16.1 [security]
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| astro (source) | 4.15.4 -> 4.16.1 |
GitHub 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., iframe tags with unsanitized name attributes) 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.scripts lookup 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 a type attribute.
Finally, the innerHTML of an attacker-injected non-script HTML elements, which is plain text content before, will be set to the .innerHTML of 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., form or iframe). 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 an alert(1) from an attacker-injected form element.
---
import Header from "../components/Header.astro";
import Footer from "../components/Footer.astro";
import { ViewTransitions } from "astro:transitions";
import "../styles/global.css";
const { pageTitle } = Astro.props;
---
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>{pageTitle}</title>
<ViewTransitions />
</head>
<body>
<!--USER INPUT-->
<iframe name="scripts">alert(1)</iframe>
<iframe name="scripts">alert(1)</iframe>
<!--USER INPUT-->
<Header />
<h1>{pageTitle}</h1>
<slot />
<Footer />
<script>
import "../scripts/menu.js";
</script>
</body>
</html>
Impact
This vulnerability can result in cross-site scripting (XSS) attacks on websites that built with Astro that enable the client-side routing with ViewTransitions and store the user-inserted scriptless HTML tags without properly sanitizing the name attributes on the page.
Patch
We recommend replacing document.scripts with document.getElementsByTagName('script') for referring to script elements. This will mitigate the possibility of DOM Clobbering attacks leveraging the name attribute.
Reference
Similar issues for reference:
- Webpack (CVE-2024-43788)
- Vite (CVE-2024-45812)
- layui (CVE-2024-47075)
Release Notes
withastro/astro (astro)
v4.16.1
Patch Changes
-
#12177
a4ffbfaThanks @matthewp! - Ensure we target scripts for execution in the routerUsing
document.scriptsis unsafe because if the application has aname="scripts"this will shadow the built-indocument.scripts. Fix is to usegetElementsByTagNameto ensure we're only grabbing real scripts. -
#12173
2d10de5Thanks @ematipico! - Fixes a bug where Astro Actions couldn't redirect to the correct pathname when there was a rewrite involved.
v4.16.0
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:import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { shikiConfig: { langAlias: { cjs: 'javascript', }, }, }, });Then in your Markdown, you can use the alias as the language for a code block for syntax highlighting:
```cjs 'use strict'; function commonJs() { return 'I am a commonjs file'; } ``` -
#11984
3ac2263Thanks @chaegumi! - Adds a newbuild.concurrenyconfiguration 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.
[!WARNING] This feature is stable and is not considered experimental. However, this feature is only intended to address difficult performance issues, and breaking changes may occur in a minor release to keep this option as performant as possible.
// astro.config.mjs import { defineConfig } from 'astro'; export default defineConfig({ build: { concurrency: 2, }, });
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.12
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 entry
v4.15.11
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.10
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 add
v4.15.9
Patch Changes
-
#12034
5b3ddfaThanks @ematipico! - Fixes an issue where the middleware wasn't called when a project uses404.astro. -
#12042
243ecb6Thanks @ematipico! - Fixes a problem in the Container API, where a polyfill wasn't correctly applied. This caused an issue in some environments wherecryptoisn't supported. -
#12038
26ea5e8Thanks @ascorbic! - Resolves image paths in content layer with initial slash as project-relativeWhen using the
image()schema helper, previously paths with an initial slash were treated as public URLs. This was to match the behavior of markdown images. However this is a change from before, where paths with an initial slash were treated as project-relative. This change restores the previous behavior, so that paths with an initial slash are treated as project-relative.
v4.15.8
Patch Changes
-
#12014
53cb41eThanks @ascorbic! - Fixes an issue where component styles were not correctly included in rendered MDX -
#12031
8c0cae6Thanks @ematipico! - Fixes a bug where the rewrite vianext(/*..*/)inside a middleware didn't compute the newAPIContext.params -
#12026
40e7a1bThanks @bluwy! - Initializes the Markdown processor only when there's.mdfiles -
#12028
d3bd673Thanks @bluwy! - Handles route collision detection only if it matchesgetStaticPaths -
#12027
dd3b753Thanks @fviolette! - Addselectedto the list of boolean attributes -
#12001
9be3e1bThanks @uwej711! - Remove dependency on path-to-regexp
v4.15.7
Patch Changes
-
#12000
a2f8c5dThanks @ArmandPhilippot! - Fixes an outdated link used to document Content Layer API -
#11915
0b59fe7Thanks @azhirov! - Fix: prevent island from re-rendering when using transition:persist (#11854)
v4.15.6
Patch Changes
-
#11993
ffba5d7Thanks @matthewp! - Fix getStaticPaths regressionThis reverts a previous change meant to remove a dependency, to fix a regression with multiple nested spread routes.
-
#11964
06eff60Thanks @TheOtterlord! - Add wayland (wl-copy) support toastro info
v4.15.5
Patch Changes
-
#11939
7b09c62Thanks @bholmesdev! - Adds support for Zod discriminated unions on Action form inputs. This allows forms with different inputs to be submitted to the same action, using a given input to decide which object should be used for validation.This example accepts either a
createorupdateform submission, and uses thetypefield to determine which object to validate against.import { defineAction } from 'astro:actions'; import { z } from 'astro:schema'; export const server = { changeUser: defineAction({ accept: 'form', input: z.discriminatedUnion('type', [ z.object({ type: z.literal('create'), name: z.string(), email: z.string().email(), }), z.object({ type: z.literal('update'), id: z.number(), name: z.string(), email: z.string().email(), }), ]), async handler(input) { if (input.type === 'create') { // input is { type: 'create', name: string, email: string } } else { // input is { type: 'update', id: number, name: string, email: string } } }, }), };The corresponding
createandupdateforms may look like this:
Configuration
📅 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.
- [ ] If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| angular-ngrx-nx-realworld-example-app | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Feb 9, 2025 4:47pm |
| angular-ngrx-nx-realworld-example-docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Feb 9, 2025 4:47pm |
Deploy Preview for angular-ngrx-nx ready!
| Name | Link |
|---|---|
| Latest commit | 451932b22e294a40bfaa9d1ce5181550002862c2 |
| Latest deploy log | https://app.netlify.com/sites/angular-ngrx-nx/deploys/67a8dbe14d2a4100086b09eb |
| Deploy Preview | https://deploy-preview-320--angular-ngrx-nx.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.