Server builder assets can overwrite the generated main.js entry point
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 68/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- angular, typescript
- Bereich
- build-system, security
Rechercherichtung
Start with packages/angular_devkit/build_angular/src/builders/server/index.ts, especially the call to copyAssets(), then read packages/angular_devkit/build_angular/src/utils/copy-assets.ts to trace destination writes. Run scripts/validate.sh in the linked reproduction to confirm the collision. Done means the server builder no longer allows an asset to replace generated main.js and the clean and attack scenarios behave as intended.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Command
build, run
Is this a regression?
No. The server builder has copied configured assets after Webpack output since the assets option was released in 15.1.0.
The previous version in which this bug was not present was
No response.
Description
@angular-devkit/build-angular:server copies configured assets after Webpack emits the server program, without checking whether an asset destination is already a generated file.
With a recursive asset tree copied to output ., an asset named main.js silently replaces the generated server entry point. The build reports success, and normal node dist/server/main.js startup executes the asset instead of the generated application bundle.
I reproduced this with an asset-only dependency update. Version 1.0.0 contains only assets/data.json; version 1.0.1 adds only assets/main.js. Neither version declares scripts, main, exports, imports, or bin, installation uses --ignore-scripts, and the application never imports the package.
Expected: the build should reject an asset/generated-output collision, or keep generated output authoritative.
Actual: the build succeeds and the final dist/server/main.js is byte-for-byte identical to the dependency asset. Starting it executes dependency-controlled code as the deployed server process.
Minimal Reproduction
Repository: https://github.com/BlueIridium-Security/angular-server-asset-entry-collision-repro
git clone https://github.com/BlueIridium-Security/angular-server-asset-entry-collision-repro.git
cd angular-server-asset-entry-collision-repro
./scripts/validate.sh
The validator runs clean → attack → restored-clean → restored-attack. Across two fresh-container runs, clean 1.0.0 always emitted and started the same genuine 782,472-byte bundle with no marker; attack 1.0.1 always emitted the exact 192-byte package asset and executed its marker. Runtime networking is disabled, and the script fails on any control mismatch.
Exception or Error
No exception is reported. The builder reports successful bundle generation and asset copying.
Your Environment
Angular CLI: 22.2.0
@angular-devkit/build-angular: 22.2.0
Angular: 22.2.0
Node: 24.21.0
npm: 11.19.0
OS: Linux arm64 container (node:24.21.0-bookworm-slim)
Anything else relevant?
The builder is deprecated but remains shipped. The default server assets list is empty, and exploitation requires an opt-in recursive root-output rule plus an accepted package update, build, deployment, and startup. I therefore assess this as High rather than Critical.
Current source shows the server builder calling copyAssets() after successful Webpack output, while copyAssets() writes each destination without checking generated outputs.
This is distinct from #19157 and #16670, which discuss precedence between two configured asset inputs rather than a post-Webpack asset replacing the executable generated entry point.
Should the server builder reject configured asset destinations that collide with generated output files?
- Vorherrschende Sprache
- TypeScript
- Sterne
- 27k
- Forks
- 11.8k
- Ø Merge
- 21 Std. 32 Min.
- Gemergte PRs (30 T.)
- 162
Entwicklungsumgebung
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus angular/angular-cli
-
area: @angular/build gemini-triaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
angular/angular-cli#33955 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area: @angular/cli gemini-triaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
angular/angular-cli#33055 · 1 Kommentar · 3 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag
-
library builder: tslib is not added to the output package.jsonEvtl. vergeben @alan-agius4 hat das vor 8 Tagen übernommen. Offenangular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
library builder: a name re-exported through two "export *" paths is dropped from the bundleEvtl. vergeben @alan-agius4 hat das vor 8 Tagen übernommen. Offenangular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
library builder: entry points a/b and a-b are built into the same bundleEvtl. vergeben @alan-agius4 hat das vor 9 Tagen übernommen. Offenangular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in angular/angular-cli
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
openedx/frontend-app-authoring#3274 ·
Maintainer antworten meist innerhalb von 1 Tag
-
🎙️ task - fix(deployer): deploy --env prep runs deploy:dev where the repo declares deploy:prepOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
area/documentation status/need-triage
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100
google-gemini/gemini-cli#29548 ·
Maintainer antworten meist innerhalb von 1 Tag
-
sdk-typescript vector-store
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 82/100
mem0ai/mem0#7495 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag