Delete the modules/operation-rate-limiting projects and their EF Core/application tests, remove InvalidateCacheAsync from the dynamic policy store, and update the error code namespace, localization keys and documentation to the framework-only layout.
Add LINGYUN.Abp.OperationRateLimiting.Abstractions for models, attributes, enums and constants, keep the interfaces in the core package, remove the Redis state accessor in favor of rule reset/release services, align the management rule records, and split the tests into core, EF Core, application and Redis projects.
Use conventional DI for the static policy store, null dynamic store, Redis executor and Redis state accessor instead of explicit service registrations; rename the options-backed static store to StaticOperationRateLimitingPolicyStore.
- Re-add ImplicitUsings, NSubstitute and Volo.Abp.Autofac that upstream
BlobContainerAuthorizationTests depends on, so the merged test project compiles
- Add LINGYUN.Abp.BlobManagement.EntityFrameworkCore.Tests with an in-memory EF host
and repository tenant-isolation tests
- Add LINGYUN.Abp.BlobManagement.Application.Tests covering tenant isolation,
resource-level authorization and download-key round trips
- Extend the domain tests with time-window, tampering, expiration and lifetime cases
- Register the new test projects in the solution
`NotificationChannelDataPropertyCache.GetProperties` is read for every payload on the
publish path (`NotificationChannelDataResolver` and `NotificationChannelDataSerializer`),
but it guarded the whole lookup with one process wide lock, so every cache hit queued
behind the lock and the first reflection plus `Expression.Compile()` for one payload type
blocked all the others. Types that have nothing to do with each other were serialized on
a single lock.
- replace the `Dictionary` plus `SyncLock` pair with a `ConcurrentDictionary<Type,
Lazy<NotificationChannelDataProperty[]>>`, so the hit path takes no lock and building
one type no longer blocks reads of another
- `Lazy<T>` keeps the build at most once: `GetOrAdd` may invoke its factory more than once
under contention, but only one instance is stored and returned, and
`LazyThreadSafetyMode.ExecutionAndPublication` makes the other threads wait for it
- move the reflection and the expression compiling behind the `Lazy` factory so they never
run while a lock is held
- extract the population into `CreateProperties`; the selector, the attribute driven key
resolution and the compiled getters/setters are unchanged, as is the returned array
(callers only enumerate it)
Tests: the cache had no concurrency coverage, which is the property this change rests on.
Add `Should_Build_Property_Metadata_Once_Under_Concurrency`, which reads five payload types
from 320 parallel calls and asserts every call observed the very same metadata instance, and
`Should_Return_Same_Instance_On_Repeated_Calls`.
Every channel needs its own message shape (a WeChat Work template card, a webhook news
article, a wx-pusher URL), but the only way to carry it was to stuff those types into
`NotificationData`, which couples the producer to the channels and forces a schema change
whenever a channel gains a field. Channels now declare their own payload types and the
property bag carries them under per channel key prefixes, so one `ExtraProperties` column
serves every channel and no notification table has to change.
- add the channel data contract to `LINGYUN.Abp.Notifications.Core`:
`NotificationChannelData` base type, `[NotificationChannelData]` /
`[NotificationChannelProperty]` annotations, `NotificationChannelDataDescriptor`,
`NotificationChannelDataFormat` and `NotificationChannelDataPresenceMode`
- add the implementation to `LINGYUN.Abp.Notifications`: `INotificationChannelDataResolver`
dispatching payloads in priority order, `INotificationChannelDataAccessor` reading and
writing typed values in the property bag, `INotificationChannelDataSerializer` for the
producer side, `INotificationChannelDataPresenceProvider`, `AbpNotificationChannelDataOptions`
and `AbpNotificationChannelDataConfigurationException` for registration time validation
- keys are namespaced per channel (`wx-work:`, `wx-work-hook:`, `wx-mp:`, `pusher:`, `plus:`)
and matched case insensitively, so channels cannot collide in the shared property bag;
complex payloads are stored as JSON strings and deserialized back with the configured
`IJsonSerializer`
- the WeChat Work channel gains 18 channel data types plus `WeChatWorkMessageFactory`, and
the webhook channel 16 plus `WeChatWorkWebhookMessageFactory`, covering text, markdown,
markdown_v2, image, news, file, voice, template card, mini program notice and mp news
- PushPlus, WxPusher and the WeChat mini program channel adopt the same contract; the mini
program keys are prefixed and the historical bare keys are kept as a read only fallback,
marked `[Obsolete]` with the provider's `ApplyLegacyKeys` as the only sanctioned read site
- delete the WxPusher `NotificationDataExtensions.SetUrl` in favour of the typed accessor
- add `WebhookTemplateCardSystemTextJsonConverter` so the abstract webhook template card
survives the property bag round trip, and make `WeChatWorkWebhookNewsMessage` public
- test projects `LINGYUN.Abp.Notifications.ChannelData.Tests`, `...PushPlus.Tests`,
`...WeChat.Work.Tests` and `...Webhook.WeChat.Work.Tests` (real ABP container, fake
senders registered through `context.Services.Replace` so no real API is called), the
mini program and wx-pusher tests now drive a fake sender, and each channel verifies
payloads restored from a raw database JSON string as well as from memory
The template card payload is written into the notification property bag as JSON and read
back when the notification is published, but TemplateCard is abstract, so Newtonsoft.Json
could never restore it ("Could not create an instance of type ... abstract class") and the
card was lost as soon as the notification was persisted or queued for a retry.
- add TemplateCardJsonConverter and TemplateCardSystemTextJsonConverter, which resolve the
concrete card from the card_type discriminator (read from the constructor IL, falling back
to the type name) and reject an unknown discriminator
- split NotificationDataWeChatWorkExtensions into partials per message type (file, mini
program, mp news, template card, text card, video, voice) and add the shared
TryGetMessagePayload helper that deserializes with the converter
- add the Safe, EnableIdTrans, EnableDuplicateCheck and DuplicateCheckInterval switches
- migrate TuiJuheNotificationPublishProvider to the NotificationPublishContext contract the
other providers already use, and skip the interceptors for notifications at or above Warn
- bind the WeChat Work mini program account through the new work-weixin/miniprogram/bind
endpoint using the code2session user id
- rename AbpNotificationOptions to AbpNotificationsPublishOptions in the tests, fix the SMS
test project reference, retarget the templating tests to net10.0, register the webhook
notification projects and add the missing IP2Region reference
The FileSystem provider combined the user controlled blob name (and container name)
into the storage path without any validation, so an authenticated user holding the
BlobManagement permissions could read, overwrite or delete arbitrary files - and, with
the PublicAccess feature enabled, do it anonymously through the public download endpoint.
Fix (defence in depth):
- CalculateBlobName now resolves the path with Path.GetFullPath and asserts it is still
inside the current tenant directory (host or tenants/{id}); this also stops absolute
path injection, because Path.Combine discards its prefix when the second argument is
rooted. The prefix comparison adds a directory separator to avoid the classic
"blobs-evil" prefix bypass, and uses Ordinal on case sensitive file systems (Linux)
and OrdinalIgnoreCase on Windows/macOS
- new BlobManagementNameValidator (Domain.Shared) with a cross platform rule set shared by
the entities and the provider: rejects path separators, . and .. segments, the union of
invalid characters (\0 / \ : * ? " < > |), trailing dots/spaces and reserved device names
(CON/PRN/AUX/NUL/COM1-9/LPT1-9); CheckName validates a single segment, CheckPath validates
a path segment by segment
- container names are validated too: a name such as "x/../abp-c" stays inside the base path
(so the containment check cannot catch it) but resolves to another container directory,
which broke container isolation (e.g. writing into the private "users" container)
- BlobContainer.Name, Blob.Name and Blob.FullName are validated in the domain as well, so
invalid names are rejected before they are persisted
- new error codes BlobManagement:001005 (container name) and BlobManagement:002008 (blob name)
with zh-Hans/en texts
Tests:
- LINGYUN.Abp.BlobManagement.Domain.Tests (76 tests) for Blob / BlobContainer / the validator
- LINGYUN.Abp.BlobManagement.FileSystem.Tests (54 tests) drives the provider resolved from DI
(the test module enables BlobManagement:Provider=FileSystem with a temporary BasePath and
removes it on shutdown), covering traversal, absolute paths, NTFS alternate data streams,
Windows normalization collisions, container names/aliases, tenant isolation and legitimate
names
This also repairs the LINGYUN.Abp.MaxMindGeoIP2.Tests build: the previous commit removed
AbpMaxMindGeoIP2Module.DefaultDatabaseFile while this project still referenced it.
Add an OpenObserve implementation of the audit logging stores as an alternative to
Elasticsearch: audit logs, security logs, entity changes and actions go into separate
streams and are queried with OpenObserve SQL.
LINGYUN.Abp.AuditLogging.OpenObserve:
- AbpAuditLoggingOpenObserveOptions binds AuditLogging:OpenObserve; the child streams are
derived from AuditLogStream (GetEntityChangeStream/GetActionStream), no separate options
- OpenObserveAuditLogWriter / OpenObserveSecurityLogWriter replace IAuditLogWriter /
ISecurityLogWriter; OpenObserveAuditLogManager / OpenObserveSecurityLogManager replace
IAuditLogManager / ISecurityLogManager; OpenObserveEntityChangeStore replaces IEntityChangeStore
- entity changes and actions are flattened into their own streams; Actions.* conditions use a
two-step query (match auditlogid in the actions stream, then filter the main stream by id),
because OpenObserve cannot query nested arrays structurally
- multi-tenancy: stream names are per tenant (audit_log_{tenantId:N}) via
IOpenObserveStreamNameNormalizer; writes resolve the log's own tenant, queries the current one
- writes may override _timestamp with the log time (AuditLog.ExecutionTime /
SecurityLog.CreationTime), bounded by TimestampAllowedUptoHours since OpenObserve only accepts
data within ZO_INGEST_ALLOWED_UPTO (5 hours by default)
- entity change details and _timestamp are handled by OpenObserveEntityChangeConverter through
IAuditLoggingOpenObserveSerializer (ABP IJsonSerializer by default), so entities never use
JsonSerializer directly
- deletion is not supported by OpenObserve (append-only, no DELETE/UPDATE): DeleteAsync /
DeleteManyAsync throw the business exception AuditLoggingOpenObserve:010001
("当前日志设施不支持删除记录!" / "The current logging facility does not support deleting records!")
backed by a zh-Hans/en localization resource
- a stream that does not exist yet (nothing ingested) yields an empty result and logs a warning
instead of failing
Shared infrastructure:
- move Condition / ComparisonOp / ExpressionParser from LINGYUN.Abp.Logging.Serilog.OpenObserve
to LINGYUN.Abp.OpenObserve (the parser now also handles Any(member) expressions) and add
OpenObserveSqlBuilder for SQL condition building
Tests:
- LINGYUN.Abp.AuditLogging.OpenObserve.Tests runs the shared AuditLogManager_Tests suite (delete
hooks overridden to assert the not-supported exception) plus tests for the timestamp helper,
localization, entity change round-trip, multi-tenant isolation and the missing-stream warning;
test streams are unique per host instance and cleaned up on shutdown
- AuditLogManager_Tests gains virtual DeleteAsync / DeleteManyAsync hooks (default behaviour unchanged)
- migrate both test modules to the new options: RemoveCountry / RemoveProvince
name arrays instead of the previous UseCountry / UseProvince predicates
- add IPLocationRemarksTest: a table driven test for the shared remark rules with one
dedicated address per case (IPv4 and IPv6), covering
* nothing configured -> country only (中国)
* country matches RemoveCountry -> province + city (浙江省杭州市), same-name
collapse (重庆市), province only (香港特别行政区), country data only -> empty remarks
* country does not match -> unchanged (日本, 德国)
* province matches RemoveProvince -> city only (吉林市), no city -> empty remarks,
and it also applies to non-Chinese addresses (2001:200::1 -> 新宿区)
* province takes precedence over country (8.8.8.8 -> 杭州市)
- update the provider expectations for the new rules:
* IP2Region: 220.246.0.1 -> 香港特别行政区 (was 中国香港特别行政区);
the physical file test now expects the default country-only remark (中国)
* MaxMind: the two "country data only" cases (114.114.114.114, 180.76.76.76) moved to
TestSearchRemovedCountryOnly, which asserts Country == "中国" while Remarks is empty
No production code changes; these tests pin the shared rules implemented in
LINGYUN.Abp.IP.Location.
Verified: dotnet test LINGYUN.Abp.IP2Region.Tests (85 passed) and
LINGYUN.Abp.MaxMindGeoIP2.Tests (42 passed), 0 failed.
- Increase by Specification the query of audit logs.
- Optimize the query of ES audit logs. Use the "search_after" feature when the number of records exceeds 10,000.