Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix: let AWS-standard endpoints win and sign with RegionName - #92

Merged
Blind-Striker merged 65 commits into
release/3.1from
fix/endpoint-precedence
Nov 30, 2026
Merged

Blind-Striker merged 65 commits into
release/3.1from
fix/endpoint-precedence

Conversation

@Blind-Striker

@Blind-Striker Blind-Striker commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Ready for the lead's review. CI is green at 1199a5a. Linux and Windows gates are green at fd162be; the three later commits are the lead's pre-merge requests below. Merge is the lead's decision.

Windows (net472, tr-TR, .NET Framework 4.8.1) at fd162be: build.ps1 --target tests exit 0; 2,067 results, 2,065 passed, 0 failed, 2 skipped (the known net472 rows that need an empty environment variable, which .NET Framework cannot hold). The new net472 rows passed: LibraryAssetTraceTests, the region-probe rows (constructor argument, both region orders), the throwing trace listener, both warn-once failsafe rows and all 51 read-order rows. The comparer passed 14/14 on net472.

Summary

When the AWS SDK resolves an endpoint from AWS_ENDPOINT_URL_<SERVICE>, AWS_ENDPOINT_URL or a profile endpoint_url, LocalStack.Client uses that endpoint directly. Requests sign with the configured RegionName when it is set. This addresses #27 and lets S3 presigned URLs name the emulator when an explicit endpoint is in use (#50). Default proxy mode still produces presigned URLs with the AWS host.

LocalStack:Config:UseServiceUrl replaces the useServiceUrl argument. IoT Data Plane, IoT Jobs Data Plane and MediaStore Data get the emulator service URL automatically when no AWS-standard endpoint is set.

Head and base

Changed since the last review

These changes are on top of cd82d6c, the revision covered by the previous draft.

  • Windows profile-region leak. The AWS SDK caches the AWS_CONFIG_FILE path once per process. The tests now select temporary profiles through AWSConfigs.AWSProfilesLocation. The Integration fixture also seeds the SDK's profile defaults with temporary files at startup. See 61b09bd, c14a5fd and fd162be.
  • Region-rejection check. The check now calls Validate() on a fresh configuration of the same type. The old check mutated UseAccelerateEndpoint on the live S3 configuration. The S3 constructor then threw when given an accelerate URL. If a suitable fresh configuration is unavailable, the check assumes the client accepts a region. The SDK constructor still validates the live configuration. The probe caches answers by configuration type and region without keeping collectible types alive. See 54eed76, 544c9b4, bf537d7 and fd162be.
  • Invalid SetClientRegion calls. The owner chose option (i), preserving the 3.0.0 exception shape for each framework and configuration path. The public reference documents this known limit. See 81ee57e and fd162be.
  • net472 tracing. The net472 asset had lost TRACE in 3.0.0. The build now checks for TRACE before compilation. LibraryAssetTraceTests checks the warning call in the assembly loaded by the test. See f0b441c, 91815a9 and fd162be.
  • S3 failsafe. The handler disarms before sending its one-time warning. A failing trace listener can no longer interrupt the SDK request. One narrowly scoped CA1031 suppression covers the trace write. Its justification names the owner's requirement that the warning never escape as an exception. See 6d63077 and fd162be.
  • Read-order contract tests. After the Aspire incident, new offline tests reproduced how an early ServiceURL read can lose a configured endpoint. They verify that the endpoint survives construction on each library creation path. See 571ca14 and c58b956.
  • Public behavior table. The reference compares 3.0.x with 3.1 and points to the tests for each row. See 347c605 and fd162be. Endpoint behavior reference
  • Endpoint test isolation. The test scope clears and restores FIPS, dual-stack and every AWS_ENDPOINT_URL* variable. See c14a5fd and fd162be.
  • Windows comparer. The comparer now handles row IDs without digits on .NET Framework. See d9d06fa.

Pre-merge requests from the lead's line-by-line review (on top of fd162be):

  • Signing region on a region change. For a client with an explicit endpoint, SetClientRegion now takes the normalized signing region from the SDK: it sets RegionEndpoint on a fresh configuration of the same type and reads the name back, the same source creation uses. A configuration that needs constructor arguments keeps the earlier normalization, which does not handle embedded markers such as bedrock-fips-ca-central-1. Tests check that creation and SetClientRegion agree for fips-us-east-1, us-gov-west-1-fips, bedrock-fips-ca-central-1 and a normal region, on both creation paths and in both modes. See 27d8517 and 1199a5a.
  • B1 row now says that region-rejecting clients clear RegionEndpoint (see B13). See 245c6e2.
  • Known limit. The S3 bucket-region handler changes the request object and restores it afterwards, so one request object used by two concurrent calls races. The SDK's request objects are not thread-safe either. See 245c6e2.

Endpoint precedence

With UseLocalStack=true, the first applicable rule wins for each client:

  1. A non-empty AWS-standard endpoint resolved by the SDK wins. The SDK checks the service-specific environment variable, the global environment variable, the profile's service endpoint and the profile's global endpoint in that order. AWS_IGNORE_CONFIGURED_ENDPOINT_URLS disables those sources.
  2. If LocalStack:Config:UseServiceUrl=true, the client uses the configured emulator service URL directly.
  3. A client whose configuration rejects RegionEndpoint also gets the emulator service URL directly. If the SDK resolved a standard endpoint in step 1, the client keeps that endpoint and clears RegionEndpoint.
  4. The default is proxy mode. The client keeps RegionEndpoint and reaches the emulator through the proxy.

An empty resolved endpoint falls back to the selected mode. A blank RegionName requires UseServiceUrl=true and leaves signing to the SDK. A non-blank RegionName is set before the SDK reads the endpoint. Region names that are invalid host labels fail at creation. Explicit endpoints use the normalized signing region when RegionName is set. They turn off FIPS, dual-stack and host-prefix injection. S3 keeps path-style addressing. The session supplies credentials. With UseLocalStack=false, Extensions uses the AWS client factory.

Breaking changes

The bool useServiceUrl argument was removed from the four CreateClientByImplementation and CreateClientByInterface overloads on ISession and Session. It was also removed from AddAwsService, TryAddAwsService, AddAWSServiceLocalStack and TryAddAWSServiceLocalStack, each with and without AWSOptions.

  • Binary compatibility. Calls compiled against the old signatures need to be recompiled against 3.1.
  • Source compatibility. Update callers that pass useServiceUrl, mock setups and custom ISession implementations. Visual Basic callers can use AddAWSServiceLocalStack to select the LocalStack registration explicitly.
  • Configuration. ConfigOptions.UseServiceUrl defaults to false and applies to the whole session or service collection. To move one service, set AWS_ENDPOINT_URL_<SERVICE> for that service.

Migrating useServiceUrl: true

// 3.0
services.AddAwsService<IAmazonS3>(ServiceLifetime.Singleton, useServiceUrl: true);
var s3 = session.CreateClientByInterface<IAmazonS3>(useServiceUrl: true);

// 3.1
services.AddAwsService<IAmazonS3>(ServiceLifetime.Singleton);
var s3 = session.CreateClientByInterface<IAmazonS3>();
{ "LocalStack": { "UseLocalStack": true, "Config": { "UseServiceUrl": true } } }

The environment variable form is LocalStack__Config__UseServiceUrl=true. For standalone setup, use ConfigOptions.

var session = SessionStandalone.Init()
    .WithSessionOptions(new SessionOptions())
    .WithConfigurationOptions(new ConfigOptions("localhost.localstack.cloud", useSsl: false, useLegacyPorts: false, edgePort: 4566, useServiceUrl: true))
    .Create();

Behavior changes and known limits

The public reference carries the full 3.0.x to 3.1 comparison. For a region-rejecting client with an AWS-standard endpoint, use B13 for the RegionEndpoint result. Endpoint behavior reference

  • SetClientRegion preserves an explicit ServiceURL and changes AuthenticationRegion. Assigning Config.RegionEndpoint directly clears ServiceURL and can send later requests to the regional AWS host.
  • With an explicit endpoint, the S3 handler uses the library region for PutBucket when the request leaves the bucket region unset. DeleteBucket signs with the library region.
  • With a user-supplied LocationConstraint, the SDK can send two constraints when an ambient region is set. Use BucketRegionName to supply the region.
  • Several RDS, Neptune and DocumentDB operations that presign across regions can throw NullReferenceException before sending in service-URL mode. The README lists the affected operations and workarounds. README known issues
  • For an HTTP-only emulator, set GetPreSignedUrlRequest.Protocol to HTTP. The SDK defaults to HTTPS. README endpoint precedence
  • An invalid region passed to SetClientRegion can surface AmazonClientException directly or inside TargetInvocationException. The net472 and netstandard2.0 assets throw it directly. On net10.0 and net11.0, the runtime configuration type and reflection-fallback setting determine the shape. Exception shape for an invalid region change
Behavior table at fd162be (copy of the public reference)
Id Input 3.0.x 3.1 Rule Pinned by
B1 Global AWS_ENDPOINT_URL or profile endpoint_url names B ServiceURL names B, proxy sends to A, SDK chooses signing region Direct to B, keeps RegionEndpoint, signs RegionName; S3 presigned URLs also name B and sign that region An AWS-standard endpoint wins Functional P1 and P4; SessionEndpointPrecedenceTests
B2 Only an S3-specific variable or profile endpoint names B S3 behaves as in B1, other services use A Only S3 uses B; other clients keep proxy A in default mode Service-specific settings apply per client Functional P2; EndpointPrecedenceTests; AwsStandardEndpointContractTests
B3 Global AWS-standard endpoint names A, with a different ambient region Proxy and ServiceURL both name A; SDK chooses signing region Direct to A, signs RegionName Identical endpoint configuration keeps the destination Functional P12 and identical dual-configuration scenarios
B4 Service-URL mode, nothing AWS-standard ServiceURL is the emulator, plus a proxy to it; signs with the ambient region or us-east-1 ServiceURL is the emulator, no proxy; AuthenticationRegion and signing are RegionName, presigned URLs too; host-prefix injection off Explicit endpoints never get a proxy and sign for RegionName Differential B4; SessionEndpointPrecedenceTests
B4/blank-region B4 with RegionName set to blank As B4 No signing region is set, so the SDK's own fallback signs, as in 3.0; only the proxy and host-prefix flag change A blank RegionName, accepted only in service-URL mode, leaves signing to the SDK Differential B4/blank-region
B4/use-ssl B4 with UseSsl on As B4, over https As B4, over https Pending owner decision (KL-15) Differential B4/use-ssl (pending)
B5 Service-URL mode with an AWS-standard endpoint naming B Explicit service URL and proxy both name A; RegionEndpoint is null Direct to B, keeps RegionEndpoint for clients that accept it, signs RegionName The AWS-standard endpoint takes precedence over the setting SessionEndpointPrecedenceTests; CatalogEndpointPrecedenceTests; EndpointReadOrderContractTests
B6 An explicit endpoint with FIPS or dual-stack enabled SDK endpoint rules reject the requests Both flags are off for the explicit endpoint Explicit endpoints use the configured host Functional P11 (FIPS and dual-stack); SessionEndpointPrecedenceTests
B7 Global variable names B, service-specific S3 variable is empty S3 fails endpoint resolution; SNS behaves as in B1 S3 uses A through the selected mode; SNS uses B and signs RegionName An empty service-specific value takes precedence over the global value and falls back to the configured endpoint Functional P7; AwsStandardEndpointContractTests
B8 Global variable or selected profile endpoint is empty SDK endpoint resolution rejects the empty value Uses A through the selected mode, signing RegionName An empty resolved endpoint falls back to the configured endpoint Functional P6; SessionEndpointPrecedenceTests; AwsStandardEndpointContractTests
B9 Service-URL mode with blank RegionName and an AWS-standard endpoint or an injected preset Uses A with null RegionEndpoint; SDK chooses signing region A standard endpoint naming B wins; an injected preset is discarded and A is used. SDK chooses signing region A blank region retains SDK signing fallback SessionEndpointPrecedenceTests; EndpointReadOrderContractTests
B10 Blank RegionName, proxy mode Throws MisconfiguredClientException Throws MisconfiguredClientException; the message names ConfigOptions.UseServiceUrl Proxy mode needs a region Differential B10
B11 Service-URL mode, RegionName that is not a host label (bad_region) Accepted; signed us-east-1 Throws AmazonClientException at creation RegionName is the signing region in every mode, so it must be valid Differential B11
B11/auto-detected Auto-detected client, invalid RegionName Throws the same exception at creation Throws the SDK's hostname-component AmazonClientException at creation As B11 Differential B11/auto-detected
B11/unknown-valid-region Service-URL mode, unknown but valid RegionName (my-region) Accepted; signed us-east-1 Accepted; signs my-region As B11 Differential B11/unknown-valid-region
IR-2 Proxy mode, invalid RegionName Throws the SDK's hostname-component AmazonClientException at creation Unchanged Unchanged Differential IR-2
B12 Auto-detected client, setting off Throws at creation (needed useServiceUrl: true) Created in service-URL mode, no proxy, signs RegionName A client that rejects a region gets the service URL automatically Differential B12; CatalogEndpointPrecedenceTests
B13 A client from B12 with an AWS-standard endpoint naming B Default mode throws; service-URL mode uses A Direct to B, null RegionEndpoint, signs RegionName A configuration that rejects a region still honors a standard endpoint CatalogEndpointPrecedenceTests; SessionEndpointPrecedenceTests
B14 Proxy mode, nothing set Proxy to the emulator, RegionEndpoint is RegionName, presigned host s3.<region>.amazonaws.com Unchanged Proxy mode stays the default Differential B14 (every 3.0.0 catalog service and creation path)
B15 B1 with AWS_IGNORE_CONFIGURED_ENDPOINT_URLS=true Default mode uses proxy A and RegionEndpoint Unchanged Respect the SDK ignore switch Functional P5; AwsStandardEndpointContractTests; SessionEndpointPrecedenceTests
B16 Default mode with FIPS or dual-stack enabled Keeps the SDK flags Unchanged Proxy mode leaves the flags as configured SessionEndpointPrecedenceTests
B17 An explicit endpoint with credentials in an AWS profile Uses session credentials Unchanged The session supplies the client's credentials SessionEndpointPrecedenceTests
B18 An injected ISessionReflection presets ServiceURL Discarded Discarded The library's precedence decides, not a preset Differential B18; SessionEndpointPrecedenceTests
B19 UseLocalStack: false AWS's own client factory Unchanged The library does nothing Differential B19
B20 A leftover LocalStack:Config:UseLegacyPorts key Per-service legacy ports; a value such as yes fails binding Unchanged for now Legacy ports are still supported Differential B20 (pending: legacy-port removal changes this row)
B24 The service catalog rows (CLI name, AwsService member and value) 3.0.0 catalog Unchanged for the 3.0.0 services The catalog is the supported-service list Differential B24 (pending: the catalog refresh adds rows)
B25 CLI names of ElasticSearch and EventBridge As in 3.0.0 Unchanged for now As B24 Differential B25 (pending: the catalog refresh renames them)
B26 ISessionReflection.SetClientRegion on a service-URL client ServiceURL cleared; the proxy carried the request to the emulator, signed for the new region ServiceURL kept; the request goes to the emulator directly and signs for the new region (AuthenticationRegion) A region change keeps an explicit endpoint, in every explicit mode Differential B26; SetClientRegionTests; functional SNS region scenario
B26/auto-detected SetClientRegion on an auto-detected client Not creatable ServiceURL kept, emulator, new signing region As B26 Differential B26/auto-detected; SetClientRegionTests
B26a Direct Config.RegionEndpoint assignment on a client with a standard endpoint The SDK clears ServiceURL; the proxy still sends to the emulator The SDK clears ServiceURL; the client targets the regional AWS host Use SetClientRegion to keep an explicit endpoint. See KL-1 for service-URL and auto-detected clients SetClientRegionTests
B27 S3 PutBucket without a bucket region, service-URL mode, RegionName eu-central-1, no ambient region No location constraint; signed us-east-1 Location constraint and signing eu-central-1 (us-east-1 gives no constraint, eu-west-1 gives EU) With an explicit endpoint, S3 bucket requests use RegionName, as in proxy mode Differential B27; S3BucketRegionTests; functional S3 scenarios
B28 S3 DeleteBucket, explicit endpoint, ambient AWS_REGION set Signed with the ambient region Signs RegionName The ambient region never signs S3BucketRegionTests
B28/no-ambient-region B28 without an ambient region Signed us-east-1 Signs RegionName As B28 Differential B28/no-ambient-region
B29 RDS CopyDBSnapshot with SourceRegion and no PreSignedUrl, service-URL mode NullReferenceException in the SDK before sending Unchanged: the SDK's presign step reads the RegionEndpoint a service URL clears; the README lists the nine affected RDS, Neptune and DocumentDB operations and the workarounds Known limit Differential B29; RdsFamilyPresignLimitTests
KL-1 User code assigns Config.RegionEndpoint directly on a service-URL client The SDK cleared ServiceURL; the proxy still carried the request to the emulator, signed for the new region The SDK clears ServiceURL; with no proxy the request names the regional AWS host and leaves the emulator; it still signs the creation region Known limit: use SetClientRegion, or set RegionName before creation Differential KL-1; SetClientRegionTests
KL-1/auto-detected The same assignment on an auto-detected client Not creatable Targets the regional AWS data-plane host, no proxy As KL-1 Differential KL-1/auto-detected; SetClientRegionTests
KL-15 Proxy mode with UseSsl on https target through the http proxy Unchanged Under research; this row may change Differential KL-15 (pending)
unlisted Usage no row above describes: SetClientRegion and a direct RegionEndpoint assignment on a proxy-mode client Proxy kept; new RegionEndpoint Unchanged Must not change Differential unlisted

Differential test result

The comparer runs the same scenarios against the published 3.0.0 packages and the 3.1 source with the same AWS SDK versions. It clears ambient AWS settings and captures requests before they are sent. A pass verifies the observed differences against expected-differences.json. The offline and functional tests cover AWS-standard environment and profile endpoint inputs.

The 6ebe6e3 summary covered 2,065 scenarios per harness across 24 rows, with zero failing rows. It predates the later test-only and probe changes. The comparer also passed at 91815a9 on Linux and on Windows net472.

Five pending rows pin current behavior. B4/use-ssl and KL-15 cover the open proxy-mode HTTPS decision. B20 tracks legacy ports. B24 and B25 track catalog updates. Endpoint behavior reference

Differential summary table (Cake run at 6ebe6e3, net10.0)
Row Scenarios Result What the scenarios show Intended difference (3.0 → 3.1) Pending
B4 725 pass UseServiceUrl setting, nothing AWS-standard (3.0: useServiceUrl: true): ServiceURL stays the emulator; 3.1 drops the proxy, sets AuthenticationRegion and signs RegionName, also for the presigned URL. config.authenticationRegion: <none> → eu-central-1
config.disableHostPrefixInjection: false → true
config.proxy: http://localhost.localstack.cloud:4566/ → <none>
presign.signingRegion: us-east-1 → eu-central-1
request.signingRegion: us-east-1 → eu-central-1
B4/blank-region 15 pass B4 with a blank RegionName: no signing region is set, so both sign with the SDK fallback; only the proxy and host-prefix flag change. config.disableHostPrefixInjection: false → true
config.proxy: http://localhost.localstack.cloud:4566/ → <none>
B4/use-ssl 10 pass B4 with UseSsl=true. config.authenticationRegion: <none> → eu-central-1
config.disableHostPrefixInjection: false → true
config.proxy: http://localhost.localstack.cloud:4566/ → <none>
request.signingRegion: us-east-1 → eu-central-1
KL-15: proxy-mode HTTPS is under research (owner hold, 2026-11-30); the service-URL rows here may change with it.
B10 15 pass Blank RegionName with the setting off: both throw MisconfiguredClientException. The table says unchanged; the message now names ConfigOptions.UseServiceUrl instead of the removed parameter. creation: LocalStack.Client.Exceptions.MisconfiguredClientException: RegionName must be set if useSe… → LocalStack.Client.Exceptions.MisconfiguredClientException: RegionName must be set unless C…
B11 15 pass Explicit endpoint (setting) with a RegionName that is not a host label: 3.0 accepted it and signed us-east-1; 3.1 throws AmazonClientException at creation (IR-1). creation: ok → Amazon.Runtime.AmazonClientException: The specified 'bad_region' region is not a valid hos…
observed only by 3.0: config.authenticationRegion, config.disableHostPrefixInjection, config.forcePathStyle, config.proxy, config.regionEndpoint, config.serviceUrl, config.useDualstackEndpoint, config.useFipsEndpoint, config.useHttp, request.accessKeyId, request.host, request.outcome, request.path, request.port, request.scheme, request.signingRegion, request.signingService
B11/auto-detected 15 pass Auto-detected data-plane client with an invalid RegionName: both throw the SDK's hostname-component AmazonClientException at creation. unchanged
B11/unknown-valid-region 10 pass Explicit endpoint (setting) with an unknown but valid RegionName: 3.1 accepts and signs it (IR-1). config.authenticationRegion: <none> → my-region
config.disableHostPrefixInjection: false → true
config.proxy: http://localhost.localstack.cloud:4566/ → <none>
request.signingRegion: us-east-1 → my-region
B12 15 pass IoT Data Plane, IoT Jobs Data Plane and MediaStore Data with the setting off: 3.0 throws at creation; 3.1 auto-detects service-URL mode, no proxy, signs RegionName (AD-1). creation: System.Reflection.TargetInvocationException > Amazon.Runtime.AmazonClientException: The Re… → ok
observed only by 3.1: config.authenticationRegion, config.disableHostPrefixInjection, config.proxy, config.regionEndpoint, config.serviceUrl, config.useDualstackEndpoint, config.useFipsEndpoint, config.useHttp, request.accessKeyId, request.host, request.outcome, request.path, request.port, request.scheme, request.signingRegion, request.signingService
B14 710 pass Default proxy mode, nothing set: proxy to the emulator, RegionEndpoint RegionName, presigned host s3..amazonaws.com, AuthenticationRegion null. Every 3.0.0 catalog service except the three data-plane clients, every creation path; also S3 path style, PutBucket (constraint eu-central-1), DeleteBucket, presign and an RDS cross-region copy. unchanged
B18 2 pass ServiceURL preset by an injected ISessionReflection: discarded in both (EP-4). unchanged
B19 271 pass UseLocalStack=false: AWS's own factory, for every 3.0.0 catalog service, with the setting off and on. unchanged
B20 4 pass A leftover LocalStack:Config:UseLegacyPorts key (true, "yes"): legacy ports still exist, so 3.1 behaves as 3.0 (per-service port; "yes" fails binding). Pending: this pins today's behavior, not the table's 3.1 column. unchanged T6: legacy port removal makes 3.1 ignore the key and use the edge port; T6 adds the config.proxy port and creation deltas here.
B24 131 pass The 3.0.0 catalog rows (CliName, AwsService member and value) for every service ID except the two in B25. Pending: this pins today's rows, not the table's 3.1 column. unchanged Catalog PR D: adds Lifecycle and about 50 rows; rows for service IDs outside the 3.0.0 catalog are not compared here.
B25 2 pass CliName of ElasticSearch and EventBridge. Pending: this pins today's names, not the table's 3.1 column. unchanged Catalog PR D (C3): CliName becomes es / events; add the metadata.cliName deltas then.
B26 15 pass SetClientRegion after creation on a setting-mode client (D1 (b′)): 3.1 keeps ServiceURL, so the request still targets the emulator, with no proxy, and AuthenticationRegion and signing follow the new region; 3.0 cleared ServiceURL and reached the emulator only through the proxy. config.authenticationRegion: <none> → eu-west-1
config.disableHostPrefixInjection: false → true
config.proxy: http://localhost.localstack.cloud:4566/ → <none>
config.regionEndpoint: eu-west-1 → <none>
config.serviceUrl: <none> → http://localhost.localstack.cloud:4566/
request.host: s3.eu-west-1.amazonaws.com → localhost.localstack.cloud
request.host: sns.eu-west-1.amazonaws.com → localhost.localstack.cloud
request.host: sqs.eu-west-1.amazonaws.com → localhost.localstack.cloud
request.port: 80 → 4566
B26/auto-detected 15 pass SetClientRegion on an auto-detected data-plane client: 3.0 could not create it; 3.1 keeps ServiceURL, targets the emulator and signs the new region. creation: System.Reflection.TargetInvocationException > Amazon.Runtime.AmazonClientException: The Re… → ok
observed only by 3.1: action, config.authenticationRegion, config.disableHostPrefixInjection, config.proxy, config.regionEndpoint, config.serviceUrl, config.useDualstackEndpoint, config.useFipsEndpoint, config.useHttp, request.accessKeyId, request.host, request.outcome, request.path, request.port, request.scheme, request.signingRegion, request.signingService
B27 5 pass S3 PutBucket without a bucket region in setting mode, RegionName eu-central-1, no ambient region (D2 (A)): 3.1 sends the library region as the location constraint and signs it; 3.0 sent none and signed us-east-1. config.authenticationRegion: <none> → eu-central-1
config.disableHostPrefixInjection: false → true
config.proxy: http://localhost.localstack.cloud:4566/ → <none>
request.locationConstraint: <none> → eu-central-1
request.signingRegion: us-east-1 → eu-central-1
B28/no-ambient-region 5 pass S3 DeleteBucket in setting mode without an ambient region (the table's B28 needs one; the harness scrubs AWS_*): 3.1 signs RegionName, the bucket-scoped signing D2 (A) decides; 3.0 signed us-east-1. config.authenticationRegion: <none> → eu-central-1
config.disableHostPrefixInjection: false → true
config.proxy: http://localhost.localstack.cloud:4566/ → <none>
request.signingRegion: us-east-1 → eu-central-1
B29 5 pass RDS CopyDBSnapshot with SourceRegion and no PreSignedUrl in service-URL mode: both versions throw NullReferenceException before sending, which measures the table's 3.0 column (written as an inference). Known limit KL-6 (O-7 decided (a): no handler). Only the B4 configuration deltas differ. config.authenticationRegion: <none> → eu-central-1
config.disableHostPrefixInjection: false → true
config.proxy: http://localhost.localstack.cloud:4566/ → <none>
IR-2 10 pass Proxy mode with an invalid RegionName: both throw the SDK's hostname-component AmazonClientException at creation (3.0 behavior kept). unchanged
KL-1 15 pass User code assigns Config.RegionEndpoint directly after creation on a setting-mode client: the SDK setter clears ServiceURL in both; 3.0 kept reaching the emulator through the proxy, 3.1 has no proxy, so the request names the regional AWS host and would leave the emulator (the capture stopped it before any I/O); it still signs the creation region. config.authenticationRegion: <none> → eu-central-1
config.disableHostPrefixInjection: false → true
config.proxy: http://localhost.localstack.cloud:4566/ → <none>
request.signingRegion: eu-west-1 → eu-central-1
KL-1/auto-detected 15 pass The same direct assignment on an auto-detected data-plane client: 3.0 could not create it; 3.1 targets the regional AWS data-plane host with no proxy (captured before any I/O). creation: System.Reflection.TargetInvocationException > Amazon.Runtime.AmazonClientException: The Re… → ok
observed only by 3.1: action, config.authenticationRegion, config.disableHostPrefixInjection, config.proxy, config.regionEndpoint, config.serviceUrl, config.useDualstackEndpoint, config.useFipsEndpoint, config.useHttp, request.accessKeyId, request.host, request.outcome, request.path, request.port, request.scheme, request.signingRegion, request.signingService
KL-15 10 pass Default proxy mode with UseSsl=true: identical configuration and request in both (https target through the http proxy). unchanged KL-15: a real fix for proxy-mode HTTPS is under research; this row may become a behavior change.
unlisted 30 pass Scenarios no behavior-table row describes, which must not change: SetClientRegion and a direct RegionEndpoint assignment on a proxy-mode client. unchanged

Gates run

CI at 1199a5a: Build & Test on Linux, Windows and macOS, Native AOT on Ubuntu and Windows, and Dependency Review all passed. The pre-merge commits also passed 1,474 fast tests with zero IPv4 or IPv6 connects, Native AOT 36/36 per target, the net472 builds, package validation with 48/24 suppressions and check-source.

Linux at fd162be

Gate Result
Traced fast suites 5,760 passed across four variants with the default environment, a synthetic profile config, FIPS enabled, and a synthetic DynamoDB endpoint. Zero IPv4 or IPv6 connects.
Native AOT 36/36 on net10.0 and 36/36 on net11.0 against LocalStack 4.14.0. Zero IL or AOT diagnostics.
Docker S3 and SNS 90/90 on net10.0 across LocalStack 4.14.0, LocalStack 2026.11.1 and Floci 2.5.0.
Package validation Both packages passed against 3.0.0. Validation used 48 suppressions for Client and 24 for Extensions.
check-source Zero findings.

Windows at fd162be (tr-TR, .NET Framework 4.8.1)

build.ps1 --target tests exited 0. Of 2,067 results, 2,065 passed and 0 failed. The two skips are the known net472 empty-environment-variable rows. All 51 read-order rows, the region-probe rows, the throwing-listener row and LibraryAssetTraceTests passed on net472.

Windows at 91815a9

build.ps1 exited 0. Of 2,054 tests, 2,052 passed. The two skips were the known net472 rows for empty environment variables.

Earlier SDK floor check at d9d06fa

Client tests passed 178/178 per modern target with Core 4.0.102.6. Extensions tests passed 63/63 per modern target with Core 4.0.102.11, Setup 4.0.102.4 and S3 4.0.104.4. This floor check covered the Client and Extensions suites.

Independent reviews

Older rounds use their equivalent ranges on the rebased branch.

Round Model Range Verdict
First implementation GLM 5.4 6df0fff..cc00f3e Needs fixes.
First fixes Grok 4.7 cc00f3e..4bb6766 All nine findings addressed. Wording follow-ups remained.
Wording fixes Grok 4.7 4bb6766..89afc4c Clean with deferred minors.
SDK endpoint contract Grok 4.7 89afc4c..b810e72 Needs fixes for profile isolation and two minor findings.
Test egress guard GLM 5.4 9c780c6..2f5b4ef Needs fixes for redirects, proxy validation and documentation.
Test egress guard fixes DeepSeek V4 Pro 2f5b4ef..82f4dab Clean.
Explicit-region changes, S3 handler and RDS limit Grok 4.7 82f4dab..ad75159 Ready with three minor findings.
Differential test Grok 4.7 28c33f5..aa814c7 Needs fixes for request capture and pending expectations.
Differential test fixes Grok 4.7 aa814c7..6ebe6e3 Clean.
Cleanup and rebase Grok 4.7 ad75159..28c33f5 Rebase verified. One S3 opt-out finding remained.
S3 opt-out fix Grok 4.7 6ebe6e3..cd82d6c Clean.
Service-URL setting and automatic detection Grok 4.7 b810e72..9c780c6 Needs fixes for profile isolation and the live-configuration probe.
Windows and endpoint fixes Grok 4.7 cd82d6c..81ee57e Review interrupted.
Windows, endpoint and TRACE fixes DeepSeek V4 Pro cd82d6c..f0b441c Review interrupted.
Read-order contract and TRACE changelog DeepSeek V4 Pro f0b441c..91815a9 Ready with minor follow-ups.
Windows, endpoint and read-order fixes GPT-6.2 Astra cd82d6c..c58b956 Open findings.
Final hardening fixes GPT-6.2 Astra c58b956..fd162be Six findings addressed. Remaining findings were resolved or deferred as described below.

Known follow-ups (non-blocking)

  • The test fixture can still inherit a developer's profile paths if non-test code initializes the AWS SDK's profile paths before the fixture starts.
  • The build-time TRACE guard does not accept space-separated DefineConstants.
  • The IL scan in LibraryAssetTraceTests can mistake an operand byte for a call instruction and report a false positive.
  • The public B1 row overstates RegionEndpoint retention for region-rejecting clients. B13 correctly states that those clients keep the standard endpoint and clear RegionEndpoint. Endpoint behavior reference

Open owner decision

KL-15 covers UseSsl=true in default proxy mode. The owner decision remains open. The KL-15 and B4/use-ssl comparison rows stay pending.

Issue comment drafts

Updated closing comments for #27 and #50 exist in draft form. Both are unposted.

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

Scorecard details
PackageVersionScoreDetails
nuget/System.Text.Json >= 0 UnknownUnknown
nuget/xunit.v3 >= 0 UnknownUnknown
nuget/AWSSDK.Extensions.NETCore.Setup >= 0 UnknownUnknown
nuget/AWSSDK.S3 >= 0 UnknownUnknown
nuget/AWSSDK.SimpleNotificationService >= 0 UnknownUnknown
nuget/Microsoft.Extensions.Configuration >= 0 UnknownUnknown
nuget/Microsoft.Extensions.Configuration.EnvironmentVariables >= 0 UnknownUnknown
nuget/Microsoft.Extensions.DependencyInjection >= 0 UnknownUnknown
nuget/Microsoft.Extensions.Configuration >= 0 UnknownUnknown
nuget/Microsoft.Extensions.DependencyInjection >= 0 UnknownUnknown
nuget/LocalStack.Client >= 0 UnknownUnknown
nuget/LocalStack.Client.Extensions >= 0 UnknownUnknown

Scanned Files

  • tests/LocalStack.Client.Compatibility.Tests/LocalStack.Client.Compatibility.Tests.csproj
  • tests/LocalStack.Client.EndpointPrecedenceProbe/LocalStack.Client.EndpointPrecedenceProbe.csproj
  • tests/LocalStack.Client.Integration.Tests/LocalStack.Client.Integration.Tests.csproj
  • tests/compat/LocalStack.Client.Compat.Harness.V30/LocalStack.Client.Compat.Harness.V30.csproj

@Blind-Striker

Copy link
Copy Markdown
Member Author

Status, head 9271046. The PR stays a draft until the owner confirms the endpoint rule and behavior changes 6 and 7.

  • Re-review of 3932d85..bbc81f7 by Grok 4.7 xhigh (GLM 5.4 is at its usage limit): all 9 items addressed.

    • The reviewer independently re-ran the mutant that clears RegionEndpoint for useServiceUrl plus an AWS-standard endpoint. It now fails 2/2.
    • It also confirmed, at aws-sdk-net 4.1.5.0, that the RegionEndpoint setter normalizes fips names (ClientConfig.cs:290-301). This is why R13 is observable.
    • It confirmed that CloneConfig copies the proxy but not ServiceURL (AmazonServiceClient.cs:631-650).
  • Fix round 2, 9271046. Wording only, so the docs match the code:

    • blank-region qualifiers in the ADR opening line and in the CHANGELOG presign scope;
    • the empty-endpoint fallback in the ADR consequence;
    • README "non-blank RegionName".

    Grok's re-review found all 5 addressed. Its only remaining point is a Minor wording point in the private ApplyEndpoint summary, deferred to the final 3.1 review.

  • Windows (local, SDK 11.0.100) at bbc81f7: all green.

    • Client net472 139 (all 12 new rows ran), net10.0 145, net11.0 145.
    • Integration 274 on each TFM.
    • Extensions 63/63. Generators 66.
  • Linux at 9271046: Client 145/145 on net10.0. The full matrix was green at bbc81f7, and 9271046 changes only Markdown and one comment.

The guard now turns off the transport's automatic redirects, so a 307 from
an emulator comes back through the pipeline instead of being followed below
the guard. It also decides the proxy allowance from the proxy the SDK
transport uses (GetWebProxy, no custom HttpClientFactory), and allows it only
when it is a registered emulator. ProxyHost alone, AWSConfigs.ProxyConfig, an
unregistered loopback proxy and a custom factory no longer open it.

The dual-configuration probe installs the guard too. New offline tests pin the
redirect, each proxy bypass, the registered-emulator allowance and the
blocked-message client name.
quality-gates names both probes, the transport-proxy rule, the redirect
switch and the presign check's one owner. The region-change limit now covers
every explicit endpoint, renders as its own README paragraph, and the
changelog lists the guard.
With UseServiceUrl on, an RDS, Neptune or DocumentDB operation with SourceRegion set and PreSignedUrl null throws NullReferenceException in the SDK's PreSignedUrlRequestHandler, which reads the RegionEndpoint the ServiceURL setter cleared. The tests pin that offline for one operation per service, pin the AWS-standard endpoint control that presigns for the emulator, and keep the nine affected operations in step with the SDK.
README Known issues lists the nine operations and the workarounds: AWS_ENDPOINT_URL_RDS, _NEPTUNE or _DOCDB, default proxy mode, or a caller-set PreSignedUrl. client-runtime says why service-URL mode hits it.
LocalStack.Client.Compatibility.Tests runs both harnesses with every AWS_*
variable removed by name, empty AWS profile files, AWS_EC2_METADATA_DISABLED
and both telemetry opt-outs, then diffs them scenario by scenario.
expected-differences.json lists the intended field deltas per row of the
3.1 behavior table. An unlisted difference fails and names the scenario,
row and field; a listed delta that does not happen fails too. The run
writes a per-row Markdown summary and both observation files next to the
TRX file.

The expectations describe 18c71b2. Rows that D1, D2, T6 and the catalog
PRs will change carry a pendingTask note; the UseSsl=true rows carry
pendingResearch (KL-15).
Cake's tests target already discovers the project and checks its result
file. On the floating canary track (AwsSetupTrack=latest) a failure of the
differential test is now a warning, because there a difference comes from
the AWS SDK, not from the library. The workflows are unchanged: every leg
already calls the tests target, so Windows also runs net472.
…rences

quality-gates.md gains the test layer, its environment and what a failure
means. testing-style.md says how to record an intended 3.0 to 3.1
difference: a pull request that changes behavior updates its row's deltas
in the same pull request. CHANGELOG lists the test under Build, tests and CI.
A request that completed, or reached the egress guard, instead of stopping at
the capture handler was recorded as an ordinary outcome, so a capture failure
both harnesses shared compared equal and passed. The harness now reports each
such scenario and exits 4. The guard behind the capture blocks every request,
loopback included, and names the target and proxy. A client-side SDK
exception before the request is built (B29) stays a comparable observation.

Also:
- read the PutBucket body from the request's content stream, where the SDK
  keeps it; the location constraint was always recorded as none before;
- add a direct Config.RegionEndpoint assignment (KL-1) in proxy, setting and
  auto-detected mode;
- reject a scenario group service ID that is not in the scenario file's
  catalog, instead of comparing "no client" with "no client".
…ending rows

After the rebase onto D1 (b') and D2 (A), B26, B26/auto-detected, B27 and
B28/no-ambient-region carry the decided 3.1 behavior and no pending marker:
SetClientRegion keeps ServiceURL and signs the new region, PutBucket sends
the library region, DeleteBucket signs it. KL-1 and KL-1/auto-detected pin
that a direct RegionEndpoint assignment leaves the emulator. B29 records
O-7's decision (a), a known limit.

Pending rows (B20, B24, B25 and the two KL-15 rows) pin today's behavior.
Every run now lists them in the test output and in the summary, whose header
says a pass certifies the table except those rows. A guard test requires a
"<task>: <reason>" marker and a summary on every row, and reading the file
rejects an unknown row property. The empty AWS profile files are deleted when
each harness exits.
…s out

quality-gates.md: pending rows pin today's behavior and are listed in every
run; a harness fails on a request that gets past its capture; catalog-wide
scenarios compare configuration and endpoint, not signing; rows driven by
AWS_* or profile settings, including B26a, are out of scope. testing-style.md
gains the pendingTask format and who removes it.
The body cannot show the BucketRegion opt-out, because the marshaller prefers BucketRegion over BucketRegionName. A spy on the members seam now asserts that the handler writes no BucketRegionName for each of the five opt-outs (BucketRegion, BucketRegionName, UseClientRegion = false, Location, LocationConstraint), after a control request proves the spy sees writes. A second theory asserts that the members this TFM ships report each opt-out: UnsafeAccessor on net10+, reflection on net472.
@Blind-Striker
Blind-Striker force-pushed the fix/endpoint-precedence branch from 7078090 to cd82d6c Compare November 29, 2026 23:26
The SDK's SharedCredentialsFile reads AWS_CONFIG_FILE and AWS_SHARED_CREDENTIALS_FILE once per process, and a set AWS_CONFIG_FILE then makes every later read use that first path. When anything touched profiles before the first scope, RegionTestEnvironment's temporary files were ignored and the user's own default-profile region reached every plain-SDK S3 expectation; that is the Windows failure, reproduced on Linux with a region in a temporary HOME. The scope now selects its files through AWSConfigs.AWSProfilesLocation with AWS_CONFIG_FILE cleared, and also skips AWSConfigs.AWSRegion and the Windows SDK credential store, restoring all three. New tests pin the scope and a temporary default-profile region that reaches the plain SDK but not the library.
RowKeyComparer split a key with String.Remove(startIndex), which .NET Framework rejects at the string length, so the digit-less key 'unlisted' threw in the net472 differential fixture. It now uses Substring, and unit rows cover the natural order and keys without digits.
With PutBucketConfiguration.LocationConstraint set and an ambient region other than us-east-1, the AWS SDK adds the ambient region too, so the request carries two LocationConstraint elements; measured offline, identical for plain SDK and library clients. The README's known issues name it and the workaround. The S3 Control Outposts host pattern is not documented: in AWSSDK.S3Control 4.1.1 those helpers are not on the request path.
docs/reference/endpoint-behavior.md lists each endpoint, signing and region behavior with its 3.0.x and 3.1 columns, the rule and the tests that pin it, keyed by the row ids expected-differences.json uses. testing-style, quality-gates, the differential harness's comments, scenarios.json and the documentation ownership table point at it; source and test comments and row summaries name its rows instead of private decision ids.
SessionEndpointPrecedenceTests, CatalogEndpointPrecedenceTests and EndpointPrecedenceTests read a temporary profile's sibling config file, which a set AWS_CONFIG_FILE replaces; with it pointed at an empty file, 14 Client and 4 Integration rows failed. They now clear every variable that moves an endpoint or region, restore each without reading it out, turn instance metadata off, and run in a non-parallel collection. Both suites pass with AWS_CONFIG_FILE pointed at an empty file and at a profile with a region.
The detector called Validate() on the live client configuration, which is not
read-only: AmazonS3Config.Validate() switches on UseAccelerateEndpoint for an
accelerate service URL, so with AWS_ENDPOINT_URL_S3 naming s3-accelerate the
S3 constructor's own Validate() then threw "S3 accelerate is not compatible
with Path style requests"; the plain SDK validates once and creates the
client. The question now goes to a fresh instance of the same configuration
type with only RegionEndpoint set, created from the generated registry, the
static factory or, on the reflection paths, its parameterless constructor,
never through the injected ISessionReflection, and the answer is kept per
type. Both the standard-endpoint branch and automatic detection use it.
… sources

A reflection test pins the internal ConfigOptions.ApplyConfiguration that an Extensions 3.0 binary binds to: internal, void, (string, bool?, bool?, int?) with the 3.0 names and null defaults. The invalid-host-label row now also throws with a profile endpoint and for a client that rejects RegionEndpoint, in both modes and on both creation paths.
ADR 0005 and client-runtime say the library asks a fresh configuration of the same type whether it rejects RegionEndpoint, never the live one, and why; the cost bullet follows the per-type answer. Changelog item 7 says the invalid-RegionName throw comes from setting RegionEndpoint first in every mode, and that in 3.0.x only useServiceUrl: true accepted any value.
The JIT-fallback test counted one configuration construction per client creation; the side-effect-free region check now constructs one more per configuration type. The test states that, and a second round of creations shows the answer is kept per type. client-runtime notes the extra construction.
…change

SetClientRegion with a name that is not a host label throws the SDK's
AmazonClientException. Since 3.0.0 the generated net10+ path wraps it in a
TargetInvocationException while the reflection path on net472, netstandard2.0
and the net10+ fallback lets it through. The explicit-endpoint branch always
wrapped, which gave net472 and netstandard2.0 a second shape; it now throws
the shape of the framework's RegionEndpoint path. The invalid-name test
asserts the inner AmazonClientException on every framework, a new test pins
the per-framework shape in every mode, and the endpoint behavior reference
records the difference as a known limit.
LocalStack.Client.csproj assigned DefineConstants=NET472 for the .NET
Framework target. The SDK appends NETFRAMEWORK, NET472 and the _OR_GREATER
symbols after the project body, so the assignment's only effect was dropping
TRACE, which compiled out Trace.TraceWarning: on net472 the S3 bucket-region
handler's failsafe could never signal. The line is gone; the compile now gets
TRACE;RELEASE;NETFRAMEWORK;NET472 and the rest. The 3.0.0 assets made no Trace
or Debug call, so no shipped behavior changes, and the public API is the same.

LibraryAssetTraceTests reads every built LocalStack.Client asset's metadata,
including net472 on any build machine, and fails if one has no
Trace.TraceWarning call; it failed with the old assignment.
…ation path

EndpointReadOrderContractTests pins the AWS SDK contract "read order and
endpoint preservation" with plain SDK S3 rows: (A) no early read and (E) a
read after the constructor keep an AWS-standard endpoint, (B) a ServiceURL read
before the constructor on a fresh configuration with no explicit region still
loses it to the constructor's region probe, (C) setting RegionEndpoint first
and (D) an explicit ServiceURL keep it, and the blank-region order
(ServiceURL = null, then the read) keeps it. Session.ApplyEndpoint relies on C
and the blank-region order.

Library rows assert the endpoint each client resolves for a request, with the
setting off and on, a set and a blank RegionName, from AWS_ENDPOINT_URL and from
a profile endpoint_url: the static factory, both CreateClientByInterface and
CreateClientByImplementation overloads, AddAwsService, a private client only the
reflection fallback builds, and a data-plane client. A ServiceURL read moved
before RegionEndpoint in ApplyEndpoint fails all 40 library rows.
A Fixed section in Unreleased: from 3.0.0 on the net472 asset was compiled without TRACE, so Trace calls were removed from it; 3.0.0 made none, so it had no visible effect until the S3 bucket-region warning. LibraryAssetTraceTests guards every asset.
…ntract layer

Integration.Tests used ConfigurationBuilder and AddInMemoryCollection only through a transitive Microsoft.Extensions.Configuration 3.1.32 from Extensions' Binder floor; it now references the package directly, resolving the central 11.0.0 on both the pinned and the latest track. quality-gates' AWS SDK endpoint contract row describes EndpointReadOrderContractTests, what row B and a library row pin and what a failure means, and the changelog lists the tests.
@Blind-Striker
Blind-Striker marked this pull request as ready for review November 30, 2026 07:32
@Blind-Striker
Blind-Striker merged commit 345412e into release/3.1 Nov 30, 2026
7 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