Debug ID changes the bytes of polyfills and main but not their file names, so cached files fail the SRI check
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- angular, typescript
- Lĩnh vực
- build-system
Hướng nghiên cứu
Start by tracing how the Angular build builder adds debug IDs to esbuild-named main and polyfills files, and compare that with the chunk optimizer fix in #34583. Use the reproduction steps to build with source maps and subresource integrity enabled, then check whether changed JavaScript bytes receive changed filenames and the generated index.html digests match. Done means the reported cache and SRI mismatch is reproduced and fixed for these files.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Command
build
Is this a regression?
Yes. It started with the debug IDs in 22.1.0.
Description
Follow-up to #34574.
The builder names polyfills-<hash>.js and main-<hash>.js first. Then it adds a //# debugId=<id> line to the file. It computes <id> from the source map after it rewrites the map to add x_google_ignoreList. The file name does not cover that line.
So when a builder release writes the source map differently, the JS bytes change and the file name stays the same. 22.1.8 did that. Commit 5a0d226b7c moved x_google_ignoreList to the start of the map.
With subresourceIntegrity, the new index.html pins the new bytes. A CDN or browser cache that kept the old file under the same URL serves the old bytes, and the browser blocks the script. This happened to us in production with polyfills-<hash>.js.
#34583 fixed this for the chunks of the chunk optimizer. It does not cover files that esbuild names, such as main and polyfills. 22.2.6 still computes their debug ID from the rewritten map.
Minimal Reproduction
npx @angular/[email protected] new repro --defaults --ssr=false
cd repro
npm install zone.js
npm install -D @angular/[email protected]
npx ng config projects.repro.architect.build.options.polyfills '["zone.js"]'
npx ng config projects.repro.architect.build.configurations.production.sourceMap true
npx ng config projects.repro.architect.build.configurations.production.subresourceIntegrity true
npx ng build && mv dist/repro/browser ../build-22.1.6
npm install -D @angular/[email protected]
npx ng build && mv dist/repro/browser ../build-22.1.8
Both builds write polyfills-QWJLBG44.js and main-HHND32NM.js. In each file, only the //# debugId= line differs:
polyfills-QWJLBG44.js
build-22.1.6: //# debugId=d932f97d-b667-5462-b3b7-b328a1ce7f5a
build-22.1.8: //# debugId=81c8766a-7d41-50fd-ac6d-16c3c4ed6358
main-HHND32NM.js
build-22.1.6: //# debugId=e3a30145-1442-57c2-96a7-a88f9bf43b0a
build-22.1.8: //# debugId=50dd2d3c-f1e3-5224-9587-43f24f562421
The two index.html files pin different hashes for the same URLs. For both files, the two source maps have the same content in a different key order.
Exception or Error
Failed to find a valid digest in the 'integrity' attribute for resource 'https://example.com/polyfills-JTOAPWZJ.js' with computed SHA-384 integrity '...'. The resource has been blocked.
Your Environment
Angular CLI: 22.1.8
@angular/build: 22.1.6, then 22.1.8
@angular/core: 22.2.5
zone.js: 0.16.3
Node: 24.17.0
OS: macOS
Anything else relevant?
Expected: when the bytes of a hashed file change, its name changes too.
A possible fix is to compute the debug ID from the JS before the builder adds the debug ID line, not from the rewritten map. The file name already covers the JS.
- Ngôn ngữ chính
- TypeScript
- Star
- 27k
- Fork
- 11.8k
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 271
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của angular/angular-cli
-
Font inlining cache is not created or reusedCó thể đã có người làm @nagahara-naoki đã nhận hôm nay. Đang mởarea: @angular/build
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
angular/angular-cli#34719 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: @angular/cli
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 42/100
angular/angular-cli#34716 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
angular/angular-cli#34688 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`ng generate application` produces a missing stylesheet when a workspace component type is configuredCó thể đã có người làm @nagahara-naoki đã nhận 2 ngày trước. Đang mởarea: @schematics/angular
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
angular/angular-cli#34684 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Tailwind CSS v4 classes in new or moved files are not picked up by ng serve until another rebuildCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởarea: @angular/build
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
angular/angular-cli#34446 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của angular/angular-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
OHDSI/Data2Evidence#3693 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
severity:low triage:confirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Cotal-AI/Cotal#6803 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug package:workers-shared
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cloudflare/workers-sdk#16924 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug frontend priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
nooriegarg/ContribIQ#74 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
parse: child keys like `007`, `1e3`, `0x1f`, `-1` make the parent an empty array and hide the valueĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100