Skip to content

[P1] S3 and admin client caches reuse different identities and connection settings #50

Closed

Description

@Vonng

The S3 and admin factories can reuse a client created with a different credential identity or connection configuration. Cache equality currently means equality of one 32-bit FNV digest, without comparing the configurations that produced it.

Confirmed on main at 18ea0a1ae04f69c7ae7c8f8b11329109ae7dcf71 (Go 1.27.3, darwin/arm64). The affected implementation is also present in mcli 20261025. Suggested priority: P1, because the selected alias must determine which identity and connection settings a request uses.

The relevant code is getConfigHash and the S3 cache, S3 cache lookup, and NewAdminFactory.

Three independently confirmed weaknesses belong to this one cache-equivalence defect:

  1. Fields are concatenated without boundaries, so different credential tuples can produce identical input bytes.
  2. Different input bytes can collide in FNV-32. An independent deterministic test found a collision using different, equal-length access keys with every other field fixed; the S3 factory then returned the same underlying client. Fixing serialization alone is insufficient.
  3. Client-construction inputs are omitted. Constructor tests confirmed reuse across HTTP/HTTPS, S3v2/S3v4, bucket lookup settings, aliases with different STS endpoints, and distinct custom transports. The credential provider chain uses alias-specific configuration that is absent from the key.

A minimal reproduction of the configuration-isolation failure, requiring no network requests, can be added in package cmd:

func TestCacheSeparatesTransportScheme(t *testing.T) {
    a := Config{HostURL: "http://cache-test.invalid", Signature: "S3v4", Region: "us-east-1"}
    b := a
    b.HostURL = "https://cache-test.invalid"
    factory := newFactory()
    first, err := factory(&a)
    if err != nil { t.Fatal(err) }
    second, err := factory(&b)
    if err != nil { t.Fatal(err) }
    if first.(*S3Client).api == second.(*S3Client).api {
        t.Fatal("HTTP and HTTPS configurations reused one client")
    }
}

For the identity case, loopback request capture confirmed that a later configuration used the earlier configuration's signing identity, in both S3 and admin factory probes. A separate local SILO 20261018 test confirmed the resulting policy difference between running an alias alone and after another alias in the same process. Detailed credential fixtures and authorization traces are retained in private audit material; this issue contains no credentials or collision-generating payloads.

Impact boundary: the process already possesses the configurations involved. The server authorizes the identity actually sent. This is a client identity-isolation defect; the tests do not establish an unauthenticated server authorization bypass, credential recovery, or a general remote privilege escalation.

Use a cache key representing equivalent effective construction configuration, or verify complete equality after a hash lookup. Review both factories together. Include scheme, credentials/session/provider identity, resolved region, signing and lookup options, and transport-affecting settings as applicable. For configurations that cannot be safely compared, avoid sharing. Do not log secret-bearing keys. Merely adding separators or replacing FNV-32 with a larger bare digest does not address omitted construction inputs.

Regression acceptance:

  • Different credential tuples with identical concatenated bytes do not share either factory's client; requests use the intended identity.
  • Distinct inputs colliding under the old FNV-32 key remain isolated.
  • Scheme, signer, lookup, session token, resolved region, STS/provider configuration and meaningful custom-transport differences are covered where applicable.
  • Identical effective configurations still reuse safely, with concurrent creation tested under -race.
  • Keep private identity fixtures out of public logs and preserve existing redaction tests.

Activity

  1. added
    bug
    security
    on Oct 26, 2026
  2. added a commit that references this issue on Oct 26, 2026
    24eb117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions