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

Open
#3,298 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp

Research direction

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.

Written by the indexing model from the issue text.

Description

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.

Dominant language
C#
Stars
569
Forks
107
Avg merge
2h 49m
Merged PRs (30d)
397

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fluentcms/FluentCMS

All issues in fluentcms/FluentCMS

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.