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

Aperta
#3,298 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C#
Stelle
569
Fork
107
Merge medio
2h 49m
PR unite (30g)
397

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fluentcms/FluentCMS

Tutte le issue di fluentcms/FluentCMS

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.