Skip to content

Make the template safe by default - #116

Merged
stphnwlsh merged 18 commits into
mainfrom
feature/optional-rate-limiting
Dec 6, 2026
Merged

stphnwlsh merged 18 commits into
mainfrom
feature/optional-rate-limiting

Conversation

@stphnwlsh

@stphnwlsh stphnwlsh commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Summary

A new solution shouldn't expose itself by accident once it's deployed. This is the December security work for the 1 January release, in one pull request.

  • docker compose up publishes every port on 127.0.0.1 only, so it listens on your machine and not your whole network.
  • service.version on traces, metrics and logs comes from VersionInfo, the same version the app reports about itself.
  • Every response carries X-Content-Type-Options: nosniff, X-Frame-Options: DENY and Referrer-Policy: no-referrer.
  • dotnet run uses the standard Development environment instead of local, so appsettings.local.json becomes appsettings.Development.json.
  • A copy deployed with authentication off refuses to start, and says how to fix it, unless Authentication:AllowAnonymous is true. With --include-auth a set authority must be an https URL. The image defaults to Production.
  • With --include-auth, dotnet run accepts dotnet user-jwts tokens, so the protected app can be tried without a real authority. docs/RUN.md has the steps.
  • New --include-rate-limiting option, off by default: a fixed window per client IP address that stays off until RateLimiting:PermitLimit is set. Verify Template checks it on its own and with every option on.
  • New security-defaults skill, with the other skills and docs/RUN.md updated to match.

Related issues

Part of LeanMeanCleanApps/.github#34
Part of LeanMeanCleanApps/.github#35
Part of LeanMeanCleanApps/.github#37
Part of LeanMeanCleanApps/.github#38
Part of LeanMeanCleanApps/.github#39
Part of LeanMeanCleanApps/.github#40
Part of LeanMeanCleanApps/.github#42
Part of LeanMeanCleanApps/.github#48

Type of change

  • Bug fix
  • New feature
  • Breaking change (the generated solution or template parameters change in a way existing users will notice)
  • Refactoring or clean-up
  • Documentation
  • Build, pipeline or dependency update

Shared layers

  • This only touches the Presentation layer of this template.
  • This touches the Application or Infrastructure layers, tests, pipeline or repository setup, so it needs to be carried across all five templates.

Checklist

  • dotnet build and dotnet test pass locally with no warnings.
  • I added or updated tests, and line coverage stays at or above 95%.
  • I updated the README or docs where behaviour changed.
  • If this changes how we do something, I updated the matching skill in .agents/skills.
  • I checked the template still installs and creates a working solution (see CONTRIBUTING.md).

@stphnwlsh stphnwlsh self-assigned this Dec 5, 2026
@github-actions github-actions Bot added enhancement New feature or request build labels Dec 5, 2026
@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Build Pipeline

✅ Ready to merge. Every stage passed.

Stage Result Details
Build 🟢 Passed Version 2026.12.06.423-pr-116 · Template package 244 KB
Test 🟢 Passed 291 passed · 0 failed · 0 skipped · Template installs, builds and passes its tests
Coverage 🟢 Passed 100% (916 of 916 lines) · Needs 95%
Static Analysis 🟢 Passed No open CodeQL alerts
Dependency Review 🟢 Passed 0 vulnerable packages · 0 licence problems
Container Scan 🟢 Passed Image starts and answers · No open Trivy alerts

Commit 53dfd55 · Full run

An authority without an audience used to reject every token without saying why. The deployment guard now stops at startup and names the setting, and --audience is required with --include-auth.
@stphnwlsh
stphnwlsh merged commit 9e6f243 into main Dec 6, 2026
14 checks passed
@stphnwlsh
stphnwlsh deleted the feature/optional-rate-limiting branch December 6, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant