-
-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/better resolution events #897
Conversation
if (options.CurrentValue.IgnoredIdentifiers.Contains(identifier, StringComparer.OrdinalIgnoreCase)) | ||
{ | ||
(loggerFactory?.CreateLogger(GetType()) ?? NullLogger.Instance).LogInformation( | ||
"Ignored identifier: {Identifier}", identifier); | ||
tenantResoloverLogger.LogDebug("Ignored identifier: {Identifier}", identifier); |
Check failure
Code scanning / CodeQL
Log entries created from user input High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to sanitize the identifier
before logging it. Since the log entries are plain text, we should remove any newline characters from the identifier
to prevent log forging attacks. This can be done using the String.Replace
method to replace newline characters with an empty string.
-
Copy modified line R69
@@ -68,3 +68,3 @@ | ||
{ | ||
tenantResoloverLogger.LogDebug("Ignored identifier: {Identifier}", identifier); | ||
tenantResoloverLogger.LogDebug("Ignored identifier: {Identifier}", identifier?.Replace(Environment.NewLine, "").Replace("\n", "").Replace("\r", "")); | ||
identifier = null; |
# [9.0.0](v8.0.0...v9.0.0) (2024-11-13) * multitenant db factory ([#894](#894)) ([ea216ff](ea216ff)) ### Bug Fixes * remove deprecated dotnet ([#891](#891)) ([1429cbf](1429cbf)) ### Features * add multitenant db factory method ([#896](#896)) ([8728447](8728447)) * better tenant resolution events ([#897](#897)) ([956ca36](956ca36)) * dotnet 9 support ([#893](#893)) ([4be1b88](4be1b88)) * Make builds deterministic and set latest GH actions ([#889](#889)) ([d82f89d](d82f89d)) ### Reverts * Revert "multitenant db factory ([#894](#894))" ([#895](#895)) ([0e164a8](0e164a8)) ### BREAKING CHANGES * `OnTenantResolved` and `OnTenantNotResolved` are no longer used. Use the `OnStrategyResolveCompleted`, `OnStoreResolveCompleted`, and `OnTenantResolveCompleted` events instead. * `MultiTenantDbContext` constructors accepting ITenantInfo removed, use `MultiTenantDbContext.Create` factory method * `MultiTenantDbContext` constructors accepting ITenantInfo removed, use `MultiTenantDbContext .Create` factory method instead * net6.0 and net7.0 are no longer supported targets. * Dotnet runtime specific dependencies now float to the latest patch version and are locked at release time with a NuGet lock file. This is a security mitigation and may break some builds not on the latest SDKs.
🎉 This PR is included in version 9.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
OnStrategyResolveCompleted
- Called after each strategy has attempted to resolve a tenant identifier. TheIdentifierFound
property will betrue
if the strategy resolved a tenant identifier. TheIdentifier
propertycontains the resolved tenant identifier and can be changed by the event handler to override the strategy's result
OnStoreResolveCompleted
- Called after each store has attempted to resolve a tenant. TheTenantFound
propertywill be
true
if the store resolved a tenant. TheTenantInfo
property contains the resolved tenant and can bechanged by the event handler to override the store's result. A non-null
TenantInfo
object will stop the resolverfrom trying additional strategies and stores.
OnTenantResolveCompleted
- Called once after a tenant has been resolved. TheMultiTenantContext
propertycontains the resolved multi-tenant context and can be changed by the event handler to override the resolver's
result.