Skip to content

Make the template safe by default - #96

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

stphnwlsh merged 21 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.
  • /mcp answers 403 to a browser request whose Origin isn't localhost or listed in Mcp:AllowedOrigins, as the MCP specification asks, so a web page can't reach a server on your machine through DNS rebinding.
  • 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

Closes LeanMeanCleanApps/.github#33
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
@stphnwlsh stphnwlsh mentioned this pull request Dec 5, 2026
7 of 13 tasks
@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.301-pr-96 · Template package 268 KB
Test 🟢 Passed 346 passed · 0 failed · 0 skipped · Template installs, builds and passes its tests
Coverage 🟢 Passed 100% (1212 of 1212 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 1072279 · 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 6a7b032 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.

S1: check the Origin header on the MCP endpoint

1 participant