Startup safety checks run only in Production, and two unsafe defaults ship switched on

Đang mở
#3,298 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
45/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ệ
csharp
Lĩnh vực
backend, devops, security

Hướng nghiên cứu

Start with DependencyInjection/ProductionStartupChecks.cs, PublicOriginCheck.cs, and UnencryptedKeyRingCheck.cs, then read docs/host-configuration.md and the named OpenAPI cache policy and .env.example entries. Check the existing tests around the environment gate and cache policy. Done means checks run outside Development, both opt-ins are off by default, and OpenAPI caching is shared across Host values with a relative server URL when no origin is configured.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area:host area:operations security type:bug

Problem

  1. Startup safety checks run only in Production. DependencyInjection/ProductionStartupChecks.cs:19 returns unless IsProduction(); PublicOriginCheck.cs:11 and UnencryptedKeyRingCheck.cs:11 gate again. docs/host-configuration.md:195 documents it. A Staging or custom-named environment starts with no PublicOrigin, a generated signing key and an unencrypted key ring, and builds reset links from a forged Host (Api/Account/ForgotPasswordModel.cs:23).
  2. .env.example ships two unsafe opt-ins switched on. src/FluentCMS.Host/.env.example:20-21 set FLUENTCMS_ALLOW_GENERATED_SIGNING_KEY=true and FLUENTCMS_ALLOW_UNENCRYPTED_KEY_RING=true; compose defaults both to false.
  3. The OpenAPI document is cached per Host value. Api/OpenApi/OpenApiDocumentCachePolicy.cs:27-35 varies by host for one day when no public origin is set. Forged hosts each cost a document build and evict other entries of the shared output cache.

Paths are under src/FluentCMS.Core/ unless they start with src/ or docs/.

Proposal

  • Enforce the checks in every environment except Development; update docs/host-configuration.md.
  • Ship the two opt-ins commented out, with the line that explains them.
  • Do not vary the OpenAPI cache by host; emit a relative server URL when no origin is set.

Done together with #3286 and #3275, which touch the same host startup and probe code.

Acceptance

  • A host in Staging without the settings refuses to start and names what is missing
  • Development still starts without them
  • A copy of .env.example has neither opt-in on
  • Requests with different Host values share one cached OpenAPI document
  • Tests for the environment gate and the cache policy

Found in the code review of 17 Nov 2026.

Ngôn ngữ chính
C#
Star
569
Fork
107
Merge trung bình
2 giờ 49 phút
Pull request đã merge (30 ngày)
397

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của fluentcms/FluentCMS

Tất cả issue của fluentcms/FluentCMS

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.