Skip to content

[DRK-145] Release - #337

Merged
baoduy merged 14 commits into
mainfrom
dev
Aug 5, 2026
Merged

[DRK-145] Release#337
baoduy merged 14 commits into
mainfrom
dev

Conversation

@baoduy

@baoduy baoduy commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Promote the merged idempotency SanitizeKey collision fix from dev to main.

Changes included:

  • Hash SanitizeKey in NpgsqlStore and DistributedCacheStore to prevent key collisions (internal key-derivation fix only — no consumer-facing API change; old-format keys expire naturally)
  • Add tests for idempotency SanitizeKey collision fixes
  • Move DistributedCacheStore tests to correct project
  • Various test improvements and fixes

Packages affected: DKNet.AspCore.Idempotency, DKNet.AspCore.Idempotency.NpgsqlStore

baoduy and others added 14 commits August 4, 2026 14:22
…/AzureStorage

Gate the extension allow-list check behind IncludedExtensions.Any() so an
unset/empty allow-list means no restriction, matching MaxFileNameLength and
MaxFileSizeInMb. Call ValidateFile(blob) as the first statement in each
provider's SaveAsync override so configured limits are actually enforced.

Co-authored-by: multica-agent <github@multica.ai>
…viders

Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
SanitizeKey stripped every non-alphanumeric character, including the
":"/"/" delimiters separating Method:Endpoint:IdempotentKey, so distinct
composite keys could collapse onto the same DB key backed by
UX_CompositeKey and serve one request's cached response to another.
Replace the strip-and-truncate logic with a SHA-256 hash of the full
key, which is fixed-length, collision-resistant, and fits the existing
128-char column without truncation.

Co-authored-by: multica-agent <github@multica.ai>
…gBehaviourTests

EfCoreAuditHook publishes audit logs fire-and-forget (Task.Run, not
awaited) after SaveChangesAsync returns. Every Create-block assertion
on BehaviourCapturingPublisher.Logs.Count raced that background
publish because it ran immediately after SaveChangesAsync with no
delay, unlike the Update-block assertions in the same file which
already wait. Add the same Task.Delay(1000) used elsewhere in this
test class before each Create-block count assertion.

Co-authored-by: multica-agent <github@multica.ai>
…enforcement

[DRK-82] Enforce ValidateFile in blob SaveAsync (Local/AwsS3/AzureStorage)
…llision

[DRK-76] Fix IdempotencyKeyEntity.SanitizeKey composite-key collision
Class-level meaning stays in <summary>; the property-level, policy-
dependent meaning moves to a separate <remarks> section.

Co-authored-by: multica-agent <github@multica.ai>
[DRK-133] Split AuditLogAttribute XML doc: move property-level behaviour into remarks
…eStore

Replace lossy sanitization (regex-strip in NpgsqlStore, character
replacement + whole-string lowercasing in DistributedCacheStore) with
SHA-256 hex hashing, mirroring the fix already merged for MsSqlStore
(PR #334). Guarantees structurally distinct composite keys never
collapse onto the same stored/lookup key.

- NpgsqlStore.IdempotencyKeyEntity.SanitizeKey: same hash approach as
  MsSqlStore; dead "no valid characters" branch and 128-char
  truncation removed (SHA-256 hex is always 64 chars).
- IdempotencyDistributedCacheStore.SanitizeKey: hash the raw key,
  lowercase only the hex digest, keep the CachePrefix behavior.
- Updated IdempotencyKeyRepositoryTests test that asserted the old
  case-folding collision as correct behavior; it now asserts the
  keys are treated as distinct per the fix.

Old-format stored/cached keys will no longer match after upgrade;
accepted per spec since idempotency entries are short-lived.

Co-authored-by: multica-agent <github@multica.ai>
…and DistributedCacheStore

Co-authored-by: multica-agent <github@multica.ai>
…orrect project

Co-authored-by: multica-agent <github@multica.ai>
…izekey-hash

[DRK-145] Fix idempotency SanitizeKey collisions in NpgsqlStore and DistributedCacheStore
@baoduy
baoduy merged commit 55c960c into main Aug 5, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant