This roadmap defines the next development phases for SafeWebCore and SafeWebCore.FraudDetection.
It is based on the following hard requirements:
- 100% backward compatibility
- Target framework remains .NET 10
- Tests use xUnit v3
- New features must be additive
- Existing public APIs, configuration paths, and presets must remain supported
- No existing default behavior may change unless introduced behind a new opt-in API
The next releases should increase developer value by improving:
- Developer experience
- Configuration simplicity
- Diagnostics
- Tooling
- Observability
- Fraud-detection extensibility
The goal is to evolve SafeWebCore from a strong runtime middleware library into a broader developer security experience platform, without breaking current consumers.
The following rules apply to all roadmap items:
- No removal of supported public APIs
- No renaming of supported public APIs
- No behavior-changing default modifications without opt-in
- Existing presets must keep their documented behavior unless a new preset/helper is introduced
- Existing configuration styles must remain supported
- New functionality should prefer:
- new extension methods
- new packages
- new opt-in services
- new additive options
- Hot-path runtime performance must not regress materially
- Public APIs must keep XML documentation coverage
- All roadmap items require tests and documentation updates
Improve onboarding, configuration, diagnostics, and release safety.
Create a documented compatibility policy for SafeWebCore and SafeWebCore.FraudDetection.
Deliverables
docs/development/backward-compatibility-policy.md- link from
CONTRIBUTING.md
Acceptance criteria
- policy defines supported compatibility guarantees
- policy covers APIs, defaults, presets, and configuration
- contributors can use it during design and review
Add public API compatibility validation to detect accidental breaking changes.
Deliverables
- public API baseline for:
SafeWebCoreSafeWebCore.FraudDetection
Acceptance criteria
- baseline mechanism exists
- API delta can be validated locally and/or in CI
- current public surface is recorded
Status (implemented)
Microsoft.CodeAnalysis.PublicApiAnalyzersadded to both libraries.PublicAPI.Shipped.txt+PublicAPI.Unshipped.txtpresent (seeded; surface can be curated over time).RS0037treated as hard error (removals/renames are breaking).RS0016/RS0017treated as warnings during initial adoption (viaNoWarn/WarningsNotAsErrors).- Both projects build cleanly with the analyzer enabled.
- Guidance added to backward-compatibility policy and contributor docs.
Improve contributor workflow by including test projects in the solution.
Deliverables
- include
tests/SafeWebCore.Tests/SafeWebCore.Tests.csprojinSafeWebCore.slnx
Acceptance criteria
- solution opens cleanly in Visual Studio
- test project is visible and runnable
- no package/runtime behavior changes
Introduce a new additive registration helper that binds options directly from configuration.
Why
Many consumers prefer appsettings.json-driven setup over inline code configuration.
Deliverables
- new configuration registration extension method
- docs and examples
Acceptance criteria
- existing registration APIs remain unchanged
- uses existing
NetSecureHeadersOptions - docs show minimal example
- behavior is fully backward compatible
Introduce a new opt-in helper for safe rollout across development, staging, and production.
Example direction
- Development: optional
Report-Only - Staging: reporting + diagnostics
- Production: enforce mode
Deliverables
- new helper API
- tests for environment-based behavior
- documentation
Acceptance criteria
- no existing defaults change
- feature is opt-in only
- rollout behavior is clearly documented
Expand option validation so misconfigurations are easier to understand and fix.
Focus areas
- CSP
- NEL
- reporting
- conflicting options
- path policies
Deliverables
- improved validation messages
- tests for new validation paths
Acceptance criteria
- messages explain cause and suggested fix
- valid configurations behave unchanged
- diagnostics quality improves without changing API shape
Status (implemented)
- Expanded
NetSecureHeadersOptionsValidatorwith NEL JSON structure validation (report_to/max_ageguidance) andCsp.ReportTo↔ReportingEndpointsconsistency check. - All failure messages now include actionable
Fix: ...suggestions for CSP, NEL, Reporting, AdditionalHeaders, and PathPolicies. - Added 4 new validation tests (NEL empty/invalid, ReportTo mismatch, valid happy path) plus improved assertions on existing messages.
- Fully additive; no behavior change for previously valid configurations.
Add an internal diagnostics service/model that computes effective SafeWebCore output.
Capabilities
- list enabled headers
- show effective CSP mode
- show active preset metadata
- resolve path policies
- preview effective header output
Deliverables
- diagnostics model/service
- tests
Acceptance criteria
- no runtime impact unless explicitly used
- logic is deterministic and testable
Add a new developer-facing, opt-in diagnostics endpoint.
Possible API
MapSafeWebCoreDiagnostics()
Possible output
- active headers
- CSP preview
- effective path policy
- hosting/proxy warnings
Deliverables
- endpoint mapping API
- docs and tests
Acceptance criteria
- endpoint is never enabled by default
- production usage guidance is documented
- backward compatibility preserved
Add practical troubleshooting documentation for common real-world issues.
Priority scenarios
- IIS / AspNetCoreModule
- reverse proxy / CDN behavior
- CSP blocked scripts/styles
- report-only rollout debugging
Deliverables
- new recipe docs under
docs/
Acceptance criteria
- docs match actual APIs
- examples are copy/paste-friendly
- recipes linked from existing docs
Reduce common implementation mistakes and make testing and adoption easier.
Create a new analyzer package for SafeWebCore-specific diagnostics.
Deliverables
SafeWebCore.Analyzersproject/package
Acceptance criteria
- analyzer package builds separately
- no runtime dependency impact on core package
- package structure supports future rules
Add a rule that detects when services are registered but middleware is not added to the pipeline.
Deliverables
- analyzer rule
- tests
- rule documentation
Acceptance criteria
- warns when
AddNetSecureHeaders...()is used withoutUseNetSecureHeaders() - warning includes actionable fix
- advisory only, not breaking
Add initial analyzer coverage for suspicious CSP configurations.
Candidate patterns
unsafe-inline- broad wildcards
- inconsistent nonce usage
- risky combinations
Deliverables
- initial CSP analyzer rules
- tests and rule docs
Acceptance criteria
- warnings are actionable
- rules are advisory
- no runtime changes required
Status (implemented)
SafeWebCore.Analyzersproject exists and builds as a separate package.RegistrationWithoutMiddlewareAnalyzercovers all registration helpers (including Swagger / ReverseProxy / BlazorWebSocket presets).RiskyCspPatternAnalyzerdetects unsafe-inline without nonce and broad wildcards.- Analyzer rules are advisory and produce build-time diagnostics.
Document rule IDs, behavior, and suppressions.
Deliverables
- analyzer docs page or README
- sample usage
Acceptance criteria
- rule catalog documented
- suppressions documented
- examples included
Create a separate package with consumer-facing test helpers.
Deliverables
SafeWebCore.Testingproject/package
Acceptance criteria
- package is separate from runtime library
- aligned with
.NET 10andxUnit v3 - ready for future helpers
Status (implemented)
SafeWebCore.Testingproject exists as a separate package (no runtime dependency on SafeWebCore).- Provides
HeaderAssertions,CspNonceAssertions, andTestHostBootstrapExtensions. - Aligned with xUnit v3 and .NET 10.
- Used in the main test suite; fully additive for consumers.
Add helpers for response header verification in integration tests.
Candidate helpers
- assert header exists
- assert header absent
- assert header equals expected value
- assert header contains expected fragment
Deliverables
- header assertion helpers
- example tests
Acceptance criteria
- helpers reduce consumer boilerplate
- no runtime package changes required
Add helpers for common CSP validation scenarios.
Candidate helpers
- assert CSP header exists
- assert report-only vs enforce mode
- assert nonce exists
- assert nonce consistency within a request
Deliverables
- CSP and nonce test helpers
- example tests
Acceptance criteria
- useful for both minimal API and MVC scenarios
- fully backward compatible
Add helpers to simplify SafeWebCore integration test setup.
Target scenarios
- minimal API
- MVC
- API preset usage
Deliverables
- bootstrap helper API
- examples
Acceptance criteria
- package remains optional
- consumer setup becomes simpler
- no changes required in core runtime package
Add practical docs for common integration cases.
Priority recipes
- MVC + CDN
- Swagger
- Blazor nonce setup
- Report-only rollout
- reverse proxy deployment
Deliverables
docs/recipes/content or equivalent structure
Acceptance criteria
- examples are real and current
- recipes align with shipped APIs
- docs are easy to copy into projects
Document new APIs as conveniences, not replacements.
Deliverables
- docs updates across README and guides
Acceptance criteria
- old and new setup paths are both documented where appropriate
- documentation does not imply forced migration
Add opt-in visibility, richer presets, and extend SafeWebCore.FraudDetection into a broader platform.
Add additive abstractions for runtime events and security signals.
Candidate areas
- CSP violations
- path policy hits
- diagnostics warnings
- fraud detection events
Deliverables
- telemetry abstraction layer
- tests and docs
Acceptance criteria
- existing
ICspReportSinkremains supported - no mandatory telemetry dependency in core package
- abstractions are additive only
Status (implemented + enhanced)
SecurityEventDispatcher+ISecurityEventSinkalready provide opt-in telemetry for security signals (CSP, path policies, headers).IFraudEventSink+FraudEvent(additive, opt-in) deliver the completeFraudReportafter every analysis.FraudReportnow includes the additiveRiskproperty (RiskScore+RiskLevel), so every fraud event automatically carries structured risk scoring without any consumer change.ICspReportSinkremains the dedicated extensibility point for raw CSP report payloads.- All abstractions are additive; no mandatory dependency is introduced in the core package.
- Consumers can subscribe to rich events containing
Riskfor metrics, SIEM, alerting, or custom policies.
Build optional integrations for structured logs and metrics.
Use cases
- count CSP violations
- inspect most-hit policies
- understand policy exceptions
Deliverables
- optional logging/metrics integration
- examples
Acceptance criteria
- integration is opt-in
- no existing defaults change
- docs show practical usage
Status (implemented)
- Added opt-in metrics using
System.Diagnostics.Metrics(standard .NET, OTEL-compatible, zero overhead when not observed). SafeWebCoreMetrics(meter:SafeWebCore) with counters:safewebcore.headers_applied_totalsafewebcore.csp_violations_totalsafewebcore.path_policy_matches_total
SafeWebCoreFraudMetrics(meter:SafeWebCore.FraudDetection) with counters:safewebcore.fraud_analyses_totalsafewebcore.fraud_events_by_risk_total(tagged byrisk_level)safewebcore.fraud_events_by_verdict_total(tagged byverdict)
- Metrics instances are registered automatically when using
AddNetSecureHeaders*/AddSafeWebCoreFraudDetection. - Existing
ISecurityEventSinkandIFraudEventSinkcontinue to be the primary event extensibility points. - Fully additive: no behavior change for consumers who do not configure metric exporters.
- Tests: direct
MeterListenerunit tests + integration test exercising real middleware path and asserting counter movement.
Document how to operationalize SafeWebCore telemetry.
Deliverables
- observability guide
- dashboard/query examples
Acceptance criteria
- examples are concrete
- docs reflect actual implementation
- supports adoption without requiring a specific monitoring stack
Add a helper or preset for Swagger-enabled applications.
Why Swagger is a common friction point for strict CSP and header posture.
Deliverables
- new preset/helper
- tests and docs
Acceptance criteria
- additive only
- existing presets unchanged
- usage guidance includes trade-offs
Status (implemented + enhanced)
SecurePresets.Swagger()+AddNetSecureHeadersSwagger(...)helper exist and are additive.- Added dedicated preset tests (unsafe-inline/CDN behavior, base headers retained).
- Added registration test for the helper.
- Updated
docs/recipes/swagger.mdto lead with the dedicated helper + environment-aware alternatives + diagnostics tip. - Analyzer now covers
AddNetSecureHeadersSwagger.
Add a scenario-specific helper for proxy-based deployments.
Deliverables
- new preset/helper
- docs and tests
Acceptance criteria
- existing presets remain unchanged
- guidance clearly explains intended usage
Status (enhanced)
SecurePresets.ReverseProxy()+AddNetSecureHeadersReverseProxyPreset(...)exist and are additive.- Added dedicated preset test (https/wss connect sources).
- Added registration test for the helper.
- Analyzer now covers
AddNetSecureHeadersReverseProxyPreset.
Add scenario support for hosted Blazor and websocket-heavy apps.
Deliverables
- new additive helpers/presets
- examples and tests
Acceptance criteria
- current API behavior stays intact
- scenarios are documented clearly
Status (enhanced)
SecurePresets.BlazorWebSocket()+AddNetSecureHeadersBlazorWebSocketPreset(...)exist and are additive.- Added dedicated preset test (explicit ws: + wss:).
- Added registration test for the helper.
- Analyzer now covers
AddNetSecureHeadersBlazorWebSocketPreset.
Introduce risk scoring as extra metadata on fraud results.
Deliverables
- risk score model
- tests and docs
Acceptance criteria
- existing detection/report flows still work
- score is additive, not replacement
- default behavior unchanged
Status (implemented)
- New public
RiskLevelenum (Low / Medium / High / Critical) andRiskScorerecord added (additive metadata only). FraudReport.Riskproperty added (defaults toRiskScore.Noneso all existing callers and serialized output are unaffected).- Populated in both
GeoCulturalConsistencyDetectorand legacyWesternImpersonationDetector(bypass paths + normal analysis) usingRiskScore.FromScoreAndVerdict(score, verdict). PublicAPI.Unshipped.txtupdated.- New tests verify bypass → Low and high-inconsistency → Critical while
SuspicionScore,Verdict, andRecommendedActioncontinue to behave exactly as before. - No changes to thresholds, verdicts, actions, or existing report fields.
Allow consumers to configure reactions to fraud outcomes.
Candidate actions
- log
- notify
- webhook
- custom consumer pipeline
Deliverables
- action abstractions
- examples and tests
Acceptance criteria
- current event-driven notifications remain supported
- injected mail client pattern remains supported
- new pipeline is additive only
Status (implemented + enhanced)
IFraudEventSink+FraudEventintroduced (additive, opt-in).- Both
GeoCulturalConsistencyDetectorand legacyWesternImpersonationDetectordispatch after producing aFraudReport. - Default
LoggingFraudEventSinkregistered automatically. AddFraudEventSink<T>()helper for consumers.- Pen-test notification pattern (
IPenTestAuthorizationNotificationConsumer) remains unchanged. - Added
WebhookFraudEventSink(best-effort JSON POST) +AddFraudWebhookSink(webhookUrl, httpClientName)registration helper. - Tests: registration + actual POST verification using mock handler (payload round-trips with correct
SuspicionScore/Verdict). - First concrete slice for Epic 9.2 delivered. Further pipeline helpers (webhook, policy-driven actions) can follow.
Improve per-tenant configurability and override support.
Deliverables
- additive tenant-aware extension points
- docs and tests
Acceptance criteria
- existing config paths remain supported
- examples show realistic tenant override scenarios
These should be considered first:
- backward compatibility policy
- public API baseline
- add tests to solution
AddNetSecureHeadersFromConfiguration(...)- improved validation messages
- diagnostics model
- diagnostics endpoint
- analyzer package scaffold
- missing
UseNetSecureHeaders()analyzer - testing package scaffold
A roadmap item is only complete when:
- public API is documented with XML comments where applicable
- backward compatibility has been reviewed
- tests are added or updated
- performance impact has been considered for hot paths
- docs are updated
- examples are added when relevant
- changelog is updated for shipped work
- default behavior for existing consumers is unchanged unless the feature is opt-in
Focus on:
- compatibility safety
- easier configuration
- diagnostics
- contributor workflow
Focus on:
- analyzers
- test helpers
- recipe docs
- misuse prevention
Focus on:
- telemetry
- scenario presets
- fraud detection extensibility
- platform positioning
This roadmap intentionally favors opt-in additions over behavioral changes so that SafeWebCore can keep growing in developer value without forcing migrations or breaking existing consumers.