Architecture Decision Record
ADR-045: Managed File Storage and User Avatars
Status
Accepted (2026-07-11). Records the BR-116 amendment (ADC): avatar photos are IN scope, powered
by two new framework extension points. The framework legs are implemented; each consumer provisions its
own storage account and wires the upload endpoints.
Revised 2026-09-07 (a decoded-pixel and dimension ceiling is checked from the image header before
any frame buffer is allocated, beside the existing compressed-size cap).
Revised 2026-09-12 (the extension points here carry DOCUMENT uploads as well as images; the
avatar-only scope statement below is superseded by
ADR-123).
Revised 2026-10-01 (avatar blob deletion is a durable internal command rather than an inline
storage call; see Revision below).
Revised 2026-10-21: the image processor registers only the JPEG, PNG, WebP and GIF decoders and
nulls the EXIF, XMP and IPTC profiles rather than all metadata, and five ImageSharp advisories
are accepted under a standing audit suppression (both superseded on 2026-10-25: the framework no
longer holds an image processor or those suppressions).
Revised 2026-10-24: the Azure Blob implementation moved to MMCA.Common.Azure and an S3-compatible implementation ships in MMCA.Common.Aws (ADR-134); see Revision (2026-10-24).
Revised 2026-10-25: a Google Cloud Storage implementation ships in MMCA.Common.Gcp, so three adapters read the shared FileStorage section, each keyed on its own field; see Revision (2026-10-25).
Revised 2026-10-25 (image processing): IImageProcessor and its SkiaSharp implementation are ADC's Identity module's, not framework types; MMCA.Common keeps IFileStorageService and the dependency-free upload guards, ImageContentSniffer among them; see Revision (2026-10-25, image processing moves to ADC).
Revised 2026-10-26: anchors refreshed after MMCA.Common v1.261.0 (the GCS delete posture, the Consequences CHANGELOG cite and the revision-section anchors moved; no behavior changed); see Revision (2026-10-26).
Revised 2026-10-28: the three adapters answer a transport failure with no service response as a FileStorage.UploadFailed / FileStorage.DeleteFailed Result rather than an exception (MMCA.Common v1.261.0), and the anchors are refreshed after v1.265.1; see Revision (2026-10-28).
Revised 2026-11-23: the avatar contract records the fourth path that schedules a blob delete (the orphaned new upload after a failed save), the Consequences say the framework's two audit suppressions are net11.0 false positives rather than an empty list, and the anchors are refreshed after MMCA.Common v1.315.0; see Revision (2026-11-23).
Revised 2026-11-24: the framework carries no audit suppression again (MMCA.Common 1.318.0 drops the
Pkcs pin and its two net11.0 entries); the Consequences bullet is corrected in place.
Revised 2026-12-05 (MMCA.Common v1.335.0): a storage credential that cannot produce a token answers a failed Result in the Blob and S3 adapters, and the GCS client is built and validated at host start; the Decision is corrected in place.
Context
The MAUI capability program (ADR-042) brought MediaPicker/camera within reach, and ADC amended BR-116 to include user avatar photos. That needs binary blob storage (the databases store entities, not images), untrusted-image handling (uploads are attacker-controlled bytes; EXIF metadata carries GPS coordinates, which are PII), and a client affordance that is native pick/capture on phones and a plain file input on the web.
The framework had no file-storage abstraction: anything blob-shaped would otherwise be written directly against the Azure SDK inside a module, unusable by the next consumer and untestable.
Decision
IFileStorageService(Application,MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Storage/IFileStorageService.cs:15): upload-by-blob-name returning the public URI, plus idempotent delete (:47). Default is an unconfigured Null implementation whose uploads fail with a clear error. Three adapters bind the sameFileStoragesection, each keyed on a field of its own, so a shared section switches on only the adapter whose key it carries:AddAzureBlobFileStorage(configuration)(MMCA.Common.Azure) whenContainerName(MMCA.Common/Source/Hosting/MMCA.Common.Azure/Storage/AzureBlobFileStorageSettings.cs:22) is present with eitherServiceUrifor DefaultAzureCredential/managed-identity auth, the production path, orConnectionStringfor local Azurite.AddS3FileStorage(configuration)(MMCA.Common.Aws) whenBucket(MMCA.Common/Source/Hosting/MMCA.Common.Aws/Storage/S3FileStorageSettings.cs:19) is present (MMCA.Common/Source/Hosting/MMCA.Common.Aws/AwsServiceCollectionExtensions.cs:59), for Amazon S3, Cloudflare R2, MinIO and the GCS XML API.AddGoogleCloudStorage(configuration)(MMCA.Common.Gcp,MMCA.Common/Source/Hosting/MMCA.Common.Gcp/GcpServiceCollectionExtensions.cs:50) whenGcsBucket(.../MMCA.Common.Gcp/Storage/GcsFileStorageSettings.cs:18) is present (:58), over Application Default Credentials with no HMAC keys (:38-39). TheStorageClientis built and validated when the host starts (:63-70), so a host with no usable credentials fails its boot rather than every upload. A section carrying only the S3Bucketor the AzureContainerNameleaves it a no-op (:40-41). Its delete answers success for any HTTP 404 (.../Storage/GcsFileStorageService.cs:87-92); the filter does not tell a missing object from a missing bucket, so a delete against a missing bucket also reads as success.
All three adapters answer a service failure, and a transport failure that never produced a service response (
HttpRequestException,IOException, or a timeout the caller did not request), with aFileStorage.UploadFailed/FileStorage.DeleteFailedResult rather than an exception; the caller's own cancellation still propagates (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Diagnostics/TransportFailure.cs:23; one catch per operation at.../MMCA.Common.Gcp/Storage/GcsFileStorageService.cs:69,:93,.../MMCA.Common.Azure/Storage/AzureBlobFileStorageService.cs:59,:78and.../MMCA.Common.Aws/Storage/S3FileStorageService.cs:79,:101). A credential that cannot produce a token is a failed Result too: Blob storage reportsAuthenticationFailedException(andCredentialUnavailableException, which derives from it) and S3 reportsAmazonClientException, the credential-chain failure that never reaches the service (AzureBlobFileStorageService.cs:95-98;MMCA.Common/Source/Hosting/MMCA.Common.Aws/AwsCallFailure.cs:23-25), while GCS fails at start-up instead, so a misconfigured host is not hidden behind per-call failures (MMCA.Common v1.335.0,MMCA.Common/CHANGELOG.md:30).The container or bucket is provisioned by infrastructure, never created by the app (the GCS identity needs only object create and delete,
GcpServiceCollectionExtensions.cs:44-46).IImageProcessoris ADC's, not the framework's: the interface is declared in the Identity application layer (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/IImageProcessor.cs:11,NormalizeToSquareJpegAsyncat:18) and implemented bySkiaSharpImageProcessor(MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Infrastructure/Services/Users/SkiaSharpImageProcessor.cs:16), registered as a singleton byAddModuleIdentityInfrastructure(MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Infrastructure/DependencyInjection.cs:25). It reads the header and refuses an oversize image before any frame is allocated (SkiaSharpImageProcessor.cs:81-90); accepts JPEG, PNG and WebP only, checked first by magic bytes before any decoder parses the upload and then on the codec Skia picked (:146-148,HasAllowedSignatureat:301,IsAllowedFormatat:307-308); decodes the first frame only (:185-202); applies the EXIF orientation before a centered cover crop to an exact square (:224-229); and encodes a quality-85 JPEG (:46,:105) from the fresh pixel buffer alone, which carries no color space and no metadata (:103-104), so EXIF GPS, XMP, IPTC, the ICC profile and any polyglot payload in the original file are discarded (:11-14). Full re-encode is the security boundary. Undecodable content, including any format outside the allowlist (Skia also decodes BMP, ICO, HEIF, AVIF and RAW,:146-148), is theImage.Undecodablevalidation failure (:338), not an exception. SkiaSharp is MIT-licensed and an ADC dependency (MMCA.ADC/Directory.Packages.props:88-90), not a framework one.Dependency-free upload guards (MMCA.Common):
ImageContentSniffer(MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Storage/ImageContentSniffer.cs:9), a magic-byte allowlist (IsAllowedImage,:14, overIsJpeg,IsPngandIsWebPat:20,:26,:32), stays in the framework besideIFileStorageServiceand takes no image library. ADC's avatar validator and handler call it (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/SetUserAvatar/SetUserAvatarCommandValidator.cs:35,.../SetUserAvatar/SetUserAvatarHandler.cs:63), and so does Store's product-image validator (MMCA.Store/Source/Modules/Catalog/MMCA.Store.Catalog.Application/Products/UseCases/UploadImage/UploadProductImageCommandValidator.cs:71).IMediaPickerService(UI capability, ADR-042 pattern): native photo pick/capture with the permission flow encapsulated; cancelled/denied returns null. Web heads keep the Null default (IsSupported == false) and render anInputFileinstead - an affordance switch, not a degraded path.Avatar contract (BR-116a, applied per consumer): one avatar per user; accept jpeg/png/webp up to 2 MB; server re-encodes to 256x256 JPEG via
IImageProcessor(client-declared content types are advisory only); blob name{userId}-{random8}.jpgin the infrastructure-provisioned public-readavatarscontainer (so the URL path readsavatars/{userId}-{random8}.jpg); replacing, removing or erasing an avatar, and a failed save that leaves a freshly uploaded blob with no row pointing at it, schedules a durableDeleteAvatarBlobInternalCommand(ADR-114) rather than deleting the blob inline; the URL lives on the user entity as[Pii], nulled on anonymize with the blob delete scheduled in the same transaction; exported in the GDPR data export.
Consequences
- The avatars container is public-read by design: avatar URLs render in
<img>tags on anonymous-visible surfaces without SAS plumbing. The random blob suffix prevents enumeration; the trade-off (anyone with the URL can fetch the image) is accepted and documented in the consumer's privacy policy. - A replaced or deleted avatar has its blob deleted eventually (at-least-once, through the internal-command processor, within its retry budget), and CDN/browser caches may serve the old URL briefly; the random suffix means the new upload never reuses the old URL, so staleness is bounded by cache TTLs.
DefaultAzureCredentialin production means the storage account needs a data-plane role (Storage Blob Data Contributor) for the app identity - a bicep-level grant, not a secret.- Image decoding is an application dependency, not a framework one:
AddInfrastructureregisters no image processor and MMCA.Common.Infrastructure takes no image library (MMCA.Common/CHANGELOG.md:1029), and the framework accepts no advisory risk: it carries noNuGetAuditSuppressentry (MMCA.Common/Directory.Build.props:65-69). ADC confines SkiaSharp's native libraries to the projects that run it:MMCA.ADC.Identity.Infrastructuretakes the managed assembly only (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Infrastructure/MMCA.ADC.Identity.Infrastructure.csproj:10), and the native packages are referenced by the Identity host (MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/MMCA.ADC.Identity.Service.csproj:27-28) and the processor's tests (MMCA.ADC/Tests/Modules/Identity/MMCA.ADC.Identity.Infrastructure.Tests/MMCA.ADC.Identity.Infrastructure.Tests.csproj:13-14).
Revision (2026-09-07)
The 2 MB compressed upload cap bounds the bytes on the wire; it does not bound what those bytes decode to. A highly compressible image declares its dimensions in a header that costs nothing to read and expands to a frame buffer of width times height times bytes-per-pixel, which is how a small upload becomes a multi-gigabyte allocation (SEC-Common-28).
ImageSharpImageProcessor now reads the header first with Image.IdentifyAsync
(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Storage/ImageSharpImageProcessor.cs:47) and
refuses anything past MaxDecodedPixels (50,000,000, :26) or MaxDecodedDimension (20,000, :33)
as Image.TooLarge, using the predicate at :112-114. The dimension ceiling exists beside the pixel
one because a long thin image can stay under the area limit and still be pathological for the
resampler (:30). The decoded frame is re-checked after decoding, so a header that under-reports
does not get through.
Revision (2026-09-12)
This record scoped managed uploads to avatars and said so: "no other managed uploads exist". That
statement is superseded by ADR-123, which publishes speaker session
materials (decks, handouts, archives, links) through the same IFileStorageService. The framework
extension points here grew three pieces to carry it, and every one of them is document-shaped rather
than avatar-shaped:
DocumentContentSniffer(MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Storage/DocumentContentSniffer.cs:49), the sibling ofImageContentSniffer. It accepts pdf, pptx, docx, xlsx, zip, txt and md, and only when the real bytes and the file-name extension agree (Detect,:91); the client-declared content type is never consulted. It exists because the avatar boundary does NOT transfer: an image is safe because it is re-encoded pixel by pixel, and a document is stored exactly as uploaded, so the defence has to be a gate at the door. Office Open XML is decided by opening the package and looking for a[Content_Types].xmlentry BY NAME, never by reading an entry stream, with a 4096-entry bail-out for zip bombs (:153-188).BlobNames.SanitizeFileName(.../Storage/BlobNames.cs:33), because a user-supplied file name reaches a blob name and therefore a URL. Avatars never needed it: their blob name is composed entirely of a user id and a random suffix.FileUploadOptions(.../Storage/FileUploadOptions.cs:13) withAttachment(:48) andInline(:59), carrying theContent-DispositionandCache-Controlheaders stored on the blob. The options-carryingUploadAsyncoverload shipped as a default interface member so adding it broke no existing implementation, and became abstract in v1.210.0 (.../Storage/IFileStorageService.cs:36) once no implementation relied on the fallback;AzureBlobFileStorageServiceimplements it and writes both headers (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Storage/AzureBlobFileStorageService.cs:27,:38-43).
The public-read container trade-off recorded above for avatars is taken again for documents, on the same terms and for the same reason, with unguessability supplied by a server-minted GUID inside the blob path instead of a random suffix. See ADR-123 for the aggregate, the authorization rule and the per-consumer contract (ADC BR-116b).
Revision (2026-10-01)
Avatar blob deletion no longer happens as an inline storage call. Every path that retires an avatar
schedules a DeleteAvatarBlobInternalCommand
(MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/DeleteAvatarBlob/DeleteAvatarBlobInternalCommand.cs:17,
named Identity.DeleteAvatarBlob.v1 at :16) through the internal-command queue of
ADR-114. Replacing an avatar schedules the previous
blob post-commit
(.../Users/UseCases/SetUserAvatar/SetUserAvatarHandler.cs:156-160), removing one does the same
(.../Users/UseCases/RemoveUserAvatar/RemoveUserAvatarHandler.cs:74-76), and deleting the user
schedules it inside the erasure transaction so the row commits or rolls back with the anonymized
aggregate (.../Users/UseCases/DeleteUser/DeleteUserHandler.cs:61-71). The reason is durability: a
best-effort call lost the instruction whenever storage was unreachable, while a queued row is
retried up to InternalCommands:MaxAttempts (default 5,
MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/InternalCommands/Administration/InternalCommandsSettings.cs:39)
and then dead-lettered for operator action
(.../Persistence/InternalCommands/Processing/InternalCommandProcessor.cs:461-467), so an outage longer
than the retry budget still needs a manual replay. Only the erasure path is fully transactional:
replace and remove schedule after SaveChangesAsync has committed
(MMCA.Common/Source/Core/MMCA.Common.Application/UseCases/Crud/MutateEntityHandlerBase.cs:316-319),
so a host death between commit and scheduling, or a failed schedule, leaves an orphaned blob that
is only logged for manual removal (.../Users/UseCases/SetUserAvatar/SetUserAvatarHandler.cs:162-165,
.../Users/UseCases/RemoveUserAvatar/RemoveUserAvatarHandler.cs:78-81). Deletion is therefore eventual
and at-least-once once scheduled, not synchronous; the Decision and Consequences bullets above are corrected to say so. The public-read
container, the random suffix and the cache-TTL bound on staleness are unchanged.
Revision (2026-10-06)
No behavior changed; the dated sections above keep the anchors recorded on their dates, and the load-bearing ones have moved to:
- Decoded-size guard: the
Image.IdentifyAsyncheader read is now atMMCA.Common/Source/Core/MMCA.Common.Infrastructure/Storage/ImageSharpImageProcessor.cs:48,MaxDecodedPixels(50,000,000) at:27,MaxDecodedDimension(20,000) at:34(the long-thin rationale is still at:30), and theTooLargeToDecodepredicate at:115; the post-decode re-check is at:70. - The abstract options-carrying
UploadAsyncis atMMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Storage/IFileStorageService.cs:37;AzureBlobFileStorageServiceimplements it atMMCA.Common/Source/Core/MMCA.Common.Infrastructure/Storage/AzureBlobFileStorageService.cs:28and writesContentDispositionandCacheControlat:42-43. - The
attempts_exhausteddead-letter is atMMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/InternalCommands/Processing/InternalCommandProcessor.cs:451-457. - The post-commit hook that replace and remove schedule from runs after
SaveChangesAsyncatMMCA.Common/Source/Core/MMCA.Common.Application/UseCases/Crud/MutateEntityHandlerBase.cs:322-325.
Anchors were re-verified against current source on this date.
Revision (2026-10-21)
Re-verified against current source. The storage abstraction, the avatar contract, the decoded-size guard and the durable blob deletion are unchanged; the image processor's decoder set, its metadata handling and the ImageSharp audit posture are corrected in the Decision and Consequences above.
- Decoder allowlist.
CreateDecoderOptions(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Storage/ImageSharpImageProcessor.cs:127-138) builds a configuration holding only the JPEG, PNG, WebP and GIF modules (:129-133), so every other format ImageSharp ships, TIFF and BMP among them, fails asUnknownImageFormatExceptionbefore any of its decoder code runs, and that exception becomes theImage.Undecodablevalidation failure (:103-108). The header read takesmaxFrames: uint.MaxValue(:52); the decode takesmaxFrames: 1(:70), so only the first frame of an animated file is decoded. - Metadata handling. After auto-orient and the square crop (
:84-90) the processor nullsExifProfile,XmpProfileandIptcProfile(:92-94) and re-encodes withJpegEncoder { Quality = 85 }(:99). Nothing in MMCA.Common source clears the ICC profile, and the ImageSharp 3.1.12 JPEG encoder writes the image's metadata profiles, ICC included (JpegEncoderCore.WriteProfilesandWriteIccProfile), so "strip ALL metadata" and "only pixels survive" overstated what the code does; the Decision now names the three profiles and scopes the polyglot claim to payloads outside the metadata profiles. - Audit posture. Five ImageSharp 3.1.12 advisories are accepted as
NuGetAuditSuppressentries inMMCA.Common/Directory.Build.props:48-52, each with its reachability argument in the comment at:33-46: the two TIFF encoder advisories and the HistogramEqualization one are unreachable because nothing encodes TIFF or calls that processor, the BigTIFF decoder one because the TIFF decoder is not registered, and the ICC CLUT parsing one is recorded as reachable in principle through an avatar upload carrying an ICC profile and accepted as a bounded denial-of-service risk. The CI audit step re-applies the same list. Each consumer carries its own copy of the same five entries (MMCA.ADC/Directory.Build.props:55-59,MMCA.Store/Directory.Build.props:55-59,MMCA.Helpdesk/Directory.Build.props:30-34), so the audit posture is four lists that must change together. - Anchors re-verified against current source:
- Decoded-size guard: the
Image.IdentifyAsyncheader read is atMMCA.Common/Source/Core/MMCA.Common.Infrastructure/Storage/ImageSharpImageProcessor.cs:52,MaxDecodedPixels(50,000,000) at:31,MaxDecodedDimension(20,000) at:38with the long-thin rationale in its doc comment at:33-37, the header check at:54, the post-decode re-check at:74, and theTooLargeToDecodepredicate at:147-150. - The erasure path schedules the blob delete inside the transaction at
MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/DeleteUser/DeleteUserHandler.cs:64-74, throughScheduleAvatarBlobDeletionAsync(:79-89), and a failed schedule fails the erasure (:88).
- Decoded-size guard: the
Revision (2026-10-24)
ADR-134 moves the Azure Blob implementation out of the
core and adds a second, S3-compatible implementation. IFileStorageService, its Null default and the
FileStorage section are unchanged.
- Azure Blob moved to the adapter.
AddAzureBlobFileStorage(configuration)keeps its name and now lives inMMCA.Common.Azure(MMCA.Common/Source/Hosting/MMCA.Common.Azure/AzureServiceCollectionExtensions.cs:41). It still registers only for aContainerNameplus an absoluteServiceUrior aConnectionString(:49-:59), usingDefaultAzureCredentialwith aServiceUri(:63-:65).AzureBlobFileStorageServiceis atMMCA.Common/Source/Hosting/MMCA.Common.Azure/Storage/AzureBlobFileStorageService.cs:15, andFileStorageSettingsis nowAzureBlobFileStorageSettings(Storage/AzureBlobFileStorageSettings.cs:10). - An S3-compatible implementation.
AddS3FileStorage(configuration)(MMCA.Common/Source/Hosting/MMCA.Common.Aws/AwsServiceCollectionExtensions.cs:44) registersS3FileStorageService(MMCA.Common/Source/Hosting/MMCA.Common.Aws/Storage/S3FileStorageService.cs:21) bound from the sameFileStoragesection (Storage/S3StorageClientFactory.cs:14) throughS3FileStorageSettings(Storage/S3FileStorageSettings.cs:13), for Amazon S3, Cloudflare R2, MinIO and the GCS XML API (MMCA.Common/CHANGELOG.md:12). Request and response checksums default toWHEN_REQUIRED(S3FileStorageSettings.cs:65,:72). Theaws-integrationCI job exercises it against LocalStack (MMCA.Common/.github/workflows/ci.yml:846). - A lost call fails the upload, not startup. File storage has no startup tripwire: a
FileStoragesection is routinely shared configuration (one user-secrets id across every service of a solution), so its presence does not declare that a host stores files (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Configuration/CloudAdapterTripwire.cs:21-26). A host that stores files and lost its adapter call fails each upload withFileStorage.NotConfigured(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Storage/NullFileStorageService.cs:31-35). v1.255.0 shipped a check on any non-blankFileStoragevalue; v1.256.0 removed it because it failed services that never store files (MMCA.Common/CHANGELOG.md:11). - The anchors into
MMCA.Common.Infrastructure/Storage/AzureBlobFileStorageService.csinside the 2026-09-12 and 2026-10-06 revisions are left as recorded; that file now lives at the adapter path above.
Revision (2026-10-25)
MMCA.Common v1.257.0 adds a third implementation, Google Cloud Storage in the new MMCA.Common.Gcp
adapter (MMCA.Common/CHANGELOG.md:16-17). IFileStorageService, its Null default and the shared
FileStorage section are unchanged; the Decision now lists the three adapters and the field each
keys on.
- Three keys in one section. Azure reads
ContainerName, S3 readsBucketand Google readsGcsBucket, all fromFileStorage(SectionNameatMMCA.Common/Source/Hosting/MMCA.Common.Azure/Storage/AzureBlobFileStorageSettings.cs:13,MMCA.Common/Source/Hosting/MMCA.Common.Aws/Storage/S3FileStorageSettings.cs:16andMMCA.Common/Source/Hosting/MMCA.Common.Gcp/Storage/GcsFileStorageSettings.cs:15). TheGcsprefix keeps the shared section unambiguous (MMCA.Common/CHANGELOG.md:17). - Google Cloud Storage.
AddGoogleCloudStorage(configuration)(MMCA.Common/Source/Hosting/MMCA.Common.Gcp/GcpServiceCollectionExtensions.cs:48) registersGcsFileStorageService(MMCA.Common/Source/Hosting/MMCA.Common.Gcp/Storage/GcsFileStorageService.cs:22) over Application Default Credentials, with optionalGcsPublicBaseUrl,GcsServiceUrlandGcsProjectId(GcpServiceCollectionExtensions.cs:34-37). AStorageClientthe host registered first is used as is (:40-42). - Delete posture. A 404 from Cloud Storage, including a missing bucket, reads as success
(
GcsFileStorageService.cs:83-87), matching the delete-if-exists contract of the Blob store. - CI. The
gcp-integrationjob runs the adapter against fake-gcs-server and is not a required check (MMCA.Common/CHANGELOG.md:23).
Revision (2026-10-25, image processing moves to ADC)
Image normalization left the framework in two releases on the same day, and ADC's Identity module,
its only caller, now owns it. IFileStorageService, the avatar contract, the decoded-size guard and
the durable blob deletion are unchanged; the Decision and Consequences above are corrected to the
current ownership.
- v1.258.0: SkiaSharp replaces ImageSharp.
ImageSharpImageProcessorwas replaced bySkiaSharpImageProcessorwith the sameIImageProcessorbehavior and the sameMaxDecodedPixels/MaxDecodedDimensionconstants, and MMCA.Common.Infrastructure tookSkiaSharpandSkiaSharp.NativeAssets.Linux.NoDependencies4.153.1 in place ofSixLabors.ImageSharp(MMCA.Common/CHANGELOG.md:23). The five ImageSharp 3.1.12 advisories accepted in 1.234.0 no longer applied, so theirNuGetAuditSuppressentries went with it (:23), as didDependencyVersionTestsBase.ImageSharp_MustNotExceed_MajorVersion3andImageSharpPackageIds(MMCA.Common/UPGRADING.md:66-68). The framework's accepted-advisory list now reads none (MMCA.Common/Directory.Build.props:33). - v1.259.0: the processor leaves the framework.
IImageProcessor(MMCA.Common.Application) andSkiaSharpImageProcessor(MMCA.Common.Infrastructure) were removed,AddInfrastructurestopped registering an image processor, and MMCA.Common.Infrastructure dropped SkiaSharp (MMCA.Common/CHANGELOG.md:17,MMCA.Common/UPGRADING.md:40-44). The reason is cost: SkiaSharp's native libraries, about 490 MB per project (322 MB for the three Windows builds, 149 MB for 13 Linux builds, 16 MB for macOS), were copied into every project that referenced MMCA.Common.Infrastructure, which ran consumer CI runners out of disk, while only one consumer use case ever called the processor (MMCA.Common/CHANGELOG.md:17). UPGRADING gives the mechanical fix for an application that resolves the interface: declare it in the module's application layer, copy the implementation and its tests into that module's infrastructure layer, referenceSkiaSharpthere withExcludeAssets="native"and the native packages only from the host that processes images and from the processor's tests, and register it in the module (MMCA.Common/UPGRADING.md:46-54). - ADC owns it. The interface is at
MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/IImageProcessor.cs:11; the implementation is atMMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Infrastructure/Services/Users/SkiaSharpImageProcessor.cs:16, keepingMaxDecodedPixels(50,000,000,:27),MaxDecodedDimension(20,000,:35) and theTooLargeToDecodepredicate (:323-327). It is registered byAddModuleIdentityInfrastructure(MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Infrastructure/DependencyInjection.cs:22-24) and tested bySkiaSharpImageProcessorTests(MMCA.ADC/Tests/Modules/Identity/MMCA.ADC.Identity.Infrastructure.Tests/Services/Users/SkiaSharpImageProcessorTests.cs:14). The infrastructure project referencesSkiaSharpwithExcludeAssets="native"(MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Infrastructure/MMCA.ADC.Identity.Infrastructure.csproj:10), and the native packages sit only in the Identity host (MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/MMCA.ADC.Identity.Service.csproj:28-29) and the processor's tests (MMCA.ADC/Tests/Modules/Identity/MMCA.ADC.Identity.Infrastructure.Tests/MMCA.ADC.Identity.Infrastructure.Tests.csproj:13-14). TheImage.Undecodablemessage, English and Spanish, lives in the Identity error resources (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.API/Resources/IdentityErrorResources.resx:22,IdentityErrorResources.es.resx:22). ImageContentSnifferstays. It is dependency-free and validates uploads in more than one consumer (MMCA.Common/CHANGELOG.md:17,MMCA.Common/UPGRADING.md:56), atMMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Storage/ImageContentSniffer.cs:9.- The anchors into
MMCA.Common.Infrastructure/Storage/ImageSharpImageProcessor.csinside the 2026-09-07, 2026-10-06 and 2026-10-21 revisions, and the ImageSharp audit posture recorded on 2026-10-21, are left as recorded; that file and those suppressions no longer exist in MMCA.Common.
Revision (2026-10-26)
Re-verified against current source. The storage abstraction, the three adapters and the keys they read, the avatar contract, the GCS delete posture and the durable blob deletion are unchanged; the MMCA.Common v1.261.0 release moved the anchors, and a new 1.261.0 section at the top of CHANGELOG and UPGRADING shifted every release cite below it. The Decision's GCS delete anchor and the Consequences CHANGELOG cite are re-pointed in place; the dated sections above keep their anchors.
- Anchors re-verified against current source:
- The GCS delete answers success for a 404 in the
GoogleApiExceptionfilter atMMCA.Common/Source/Hosting/MMCA.Common.Gcp/Storage/GcsFileStorageService.cs:94-99(DeleteAsyncat:87), so a missing bucket still reads as success. The service classes areGcsFileStorageService(:25),AzureBlobFileStorageService(MMCA.Common/Source/Hosting/MMCA.Common.Azure/Storage/AzureBlobFileStorageService.cs:20) andS3FileStorageService(MMCA.Common/Source/Hosting/MMCA.Common.Aws/Storage/S3FileStorageService.cs:23). AddS3FileStorageis atMMCA.Common/Source/Hosting/MMCA.Common.Aws/AwsServiceCollectionExtensions.cs:50, with itsBucketgate at:58.- The
aws-integrationjob is atMMCA.Common/.github/workflows/ci.yml:902(LocalStack) and thegcp-integrationjob at:942(fake-gcs-server and the Firestore emulator); neither is a required check. - The abstract options-carrying
UploadAsyncis atMMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Storage/IFileStorageService.cs:41; the interface (:15) andDeleteAsync(:47) are where the Decision cites them. FileStorage.NotConfiguredis raised by theNotConfigured()helper atMMCA.Common/Source/Core/MMCA.Common.Infrastructure/Storage/NullFileStorageService.cs:32-36(code at:34); the no-tripwire rationale is still atMMCA.Common/Source/Core/MMCA.Common.Infrastructure/Configuration/CloudAdapterTripwire.cs:21-26.- The erasure path schedules the blob delete inside the transaction at
MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/DeleteUser/DeleteUserHandler.cs:65-75(call at:74), throughScheduleAvatarBlobDeletionAsync(:80-90), and a failed schedule fails the erasure (:89). - Replace and remove schedule after
SaveChangesAsync(MMCA.Common/Source/Core/MMCA.Common.Application/UseCases/Crud/MutateEntityHandlerBase.cs:322) from theOnMutatedAsynchook (:325). - Release cites in
MMCA.Common/CHANGELOG.md: the S3 adapter entry at:116, the Gcp adapter and itsGcsBucketgate at:78-79,gcp-integrationnot required at:85, the v1.258.0 SkiaSharp swap and suppression removal at:55, the v1.259.0 removal (490 MB cost,ImageContentSnifferstays) at:49, and the v1.256.0 removal of theFileStoragestartup check at:101. InMMCA.Common/UPGRADING.md: the v1.259.0 section at:46,ImageContentSnifferunchanged at:67, and theImageSharpPackageIdsremoval at:78and:85.
- The GCS delete answers success for a 404 in the
Revision (2026-10-28)
Re-verified against current source. The storage abstraction, the three adapters and the keys they read, the avatar contract, the GCS delete posture and the durable blob deletion are unchanged; one adapter behavior the 2026-10-26 revision missed is added to the Decision, and the 1.262.0 to 1.265.1 sections at the top of CHANGELOG shifted every release cite below them.
- Transport failures are Results. MMCA.Common v1.261.0 (M261,
MMCA.Common/CHANGELOG.md:68) made the S3, Cloud Storage and Blob file stores answer a transport failure that never produced a service response (HttpRequestException,IOException, or a timeout the caller did not request) with theFileStorage.UploadFailed/FileStorage.DeleteFailedResult instead of letting the exception escape as a 500, while the caller's own cancellation still propagates. Each service carries the sameIsTransportFailurepredicate (MMCA.Common/Source/Hosting/MMCA.Common.Gcp/Storage/GcsFileStorageService.cs:124-126, upload and delete filters at:76and:108, codes at:72,:80,:104,:112;MMCA.Common/Source/Hosting/MMCA.Common.Azure/Storage/AzureBlobFileStorageService.cs:107-109;MMCA.Common/Source/Hosting/MMCA.Common.Aws/Storage/S3FileStorageService.cs:147-149). The 2026-10-26 Status sentence and revision lead, which say no behavior changed after v1.261.0, are left as recorded and are corrected by this item. - Anchors re-verified against current source:
- The GCS delete still answers success for a 404 in the
GoogleApiExceptionfilter atGcsFileStorageService.cs:94-99(DeleteAsyncat:87, class at:25), where the Decision cites it. - The erasure path schedules the blob delete inside the transaction at
MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/DeleteUser/DeleteUserHandler.cs:66-76(call at:75), throughScheduleAvatarBlobDeletionAsync(:81-91,ScheduleAsyncat:83-85), and a failed schedule fails the erasure (:90). - The
aws-integrationjob is atMMCA.Common/.github/workflows/ci.yml:934and thegcp-integrationjob at:974; each says it is not a required check (:945-946,:993). - Release cites in
MMCA.Common/CHANGELOG.md: the v1.259.0 removal at:92(heading:88; the Consequences cite is re-pointed in place), the v1.258.0 SkiaSharp swap at:98(heading:94), the Gcp adapter and itsGcsBucketgate at:121-122,gcp-integrationnot required at:128, the v1.256.0 removal of theFileStoragestartup check at:144-150, the S3 adapter entry at:159andaws-integrationat:164. TheMMCA.Common/UPGRADING.mdcites of 2026-10-26 (:46,:67,:78,:85) still hold.
- The GCS delete still answers success for a 404 in the
Revision (2026-11-23)
Re-verified against current source. The storage abstraction, the three adapters and the keys they read, the GCS delete posture, the transport-failure Results, the image processor's ownership and the durable blob deletion are unchanged; one avatar path the earlier revisions missed is added to the Decision, the Consequences audit-posture sentence is corrected, and the releases up to MMCA.Common v1.315.0 moved the anchors. The dated sections above keep their anchors.
- The orphaned new upload is a fourth delete path.
SetUserAvatarHandleruploads the new blob before the row is saved, so a save that fails or throws after the upload leaves a blob with no row pointing at it (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/SetUserAvatar/SetUserAvatarHandler.cs:71-89). The handler then schedulesDeleteAvatarBlobInternalCommandfor that new blob from a fresh DI scope withCancellationToken.None, so neither the failed request context nor a cancelled request token blocks the cleanup, and a failed or throwing schedule is logged without replacing the original outcome (:180-200).OnMutatedAsyncclears the candidate once the row points at the new blob (:148). Replace (:156-165) and remove (.../Users/UseCases/RemoveUserAvatar/RemoveUserAvatarHandler.cs:75, logged at:80) are unchanged. The 2026-10-01 statement "Every path that retires an avatar" is left as recorded and is completed by this item. - The framework audit list is not empty.
MMCA.Common/Directory.Build.props:85-86carries twoNuGetAuditSuppressentries (GHSA-846f-f764-76mx and GHSA-2fmv-rv2c-59x7), both System.Security.Cryptography.Pkcs advisories that are net11.0 false positives "rather than an accepted risk" (:71), and the header says they are the only entries (:68-69). None concerns an image library, so the point the Consequences make (image decoding is not a framework dependency) holds; the sentence now says what the list holds instead of calling it empty. The 2026-10-25 "reads none" statement is left as recorded. - Anchors re-verified against current source:
AddAzureBlobFileStorageis atMMCA.Common/Source/Hosting/MMCA.Common.Azure/AzureServiceCollectionExtensions.cs:44, with theContainerNamegate at:52-55, the absoluteServiceUriorConnectionStringgate at:58-62, andDefaultAzureCredentialat:67inside theTryAddSingletonat:64-70.AddS3FileStorageis atMMCA.Common/Source/Hosting/MMCA.Common.Aws/AwsServiceCollectionExtensions.cs:51, with itsBucketgate at:59(re-pointed in the Decision).AddGoogleCloudStorageis atMMCA.Common/Source/Hosting/MMCA.Common.Gcp/GcpServiceCollectionExtensions.cs:49, itsGcsBucketgate at:57, Application Default Credentials with no HMAC keys at:38-39, the no-op rule at:39-41and the IAM needs at:43-45(these five re-pointed in the Decision). The pre-registeredStorageClientis at:41-43and the optional keys at:35-37.IImageProcessoris registered withTryAddSingleton<IImageProcessor, SkiaSharpImageProcessor>()atMMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Infrastructure/DependencyInjection.cs:25.SkiaSharp,SkiaSharp.NativeAssets.Linux.NoDependenciesandSkiaSharp.NativeAssets.Win32are pinned atMMCA.ADC/Directory.Packages.props:88-90. The Identity host references the native packages atMMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/MMCA.ADC.Identity.Service.csproj:27-28; the tests csproj (:13-14) and the Infrastructure csprojExcludeAssets="native"(:10) are unchanged.- The erasure path schedules the blob delete inside the transaction through
ScheduleAvatarBlobDeletionAsync(MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/DeleteUser/DeleteUserHandler.cs:87, called at:81,ScheduleAsyncat:90), and a failed schedule fails the erasure (:96). - The
attempts_exhausteddead-letter is atMMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/InternalCommands/Processing/InternalCommandProcessor.cs:515(theMaxAttemptscheck at:513). - The no-tripwire rationale is at
MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Configuration/CloudAdapterTripwire.cs:24-28. - The
aws-integrationjob is atMMCA.Common/.github/workflows/ci.yml:1197and thegcp-integrationjob at:1257; each says it is not a required check (:1208,:1276). - Release cites: the v1.259.0 removal is at
MMCA.Common/CHANGELOG.md:1029(heading:1025; the Consequences cite is re-pointed in place) and the v1.258.0 SkiaSharp swap at:1035(heading:1031). InMMCA.Common/UPGRADING.mdthe v1.259.0 section is at:824(ImageContentSnifferunchanged at:845) and the v1.258.0 section at:848(ImageSharpPackageIdsat:856and:863); the 2026-10-28 statement that the 2026-10-26 UPGRADING cites still hold no longer does.