Skip to content

fix(iam): restore long-DN LDAP login while preserving revision errors - #250

Merged
Vonng merged 4 commits into
pgsty:mainfrom
910patin:fix/ldap-long-dn
Oct 23, 2026
Merged

Vonng merged 4 commits into
pgsty:mainfrom
910patin:fix/ldap-long-dn

Conversation

@910patin

@910patin 910patin commented Oct 19, 2026 •

Copy link
Copy Markdown

Contribution Licensing (no CLA, inbound=outbound, DCO required)

This pull request contributes to PGSTY SILO (pgsty/silo). Code contributions
are accepted under AGPL-3.0-or-later, the same license as the server.
This project does not use a CLA or require a separate Apache-2.0 license grant.
By submitting this pull request I represent that I have the right to contribute
the code changes under this repository's
GNU Affero General Public License v3.0 or later
and retain copyright in my original work. Existing copyright and license
notices remain intact; separately licensed material keeps its applicable terms.
Every commit must carry a DCO Signed-off-by trailer
(git commit -s) certifying the
Developer Certificate of Origin — see
CONTRIBUTING.md.

Problem and resulting behavior

LDAP users whose normalized DN exceeds a filesystem component limit can fail to log in after the parent IAM revision check introduced in RELEASE.2026-09-16. DN normalization expands non-ASCII bytes into ASCII escapes. A 271-byte DN can pass the current path precheck but fail with ENAMETOOLONG once config/iam/users/ exists; a 384-byte DN fails the precheck itself. Both reach the IAM reader as a length error.

The reader now treats that error as an absent record only when all three conditions hold:

  • The error is errFileNameTooLong or ObjectNameInvalid.
  • The complete object key passes the existing object-name validation.
  • At least one path component is ASCII and exceeds 255 bytes, including any .json suffix.

This restores group-authorized LDAP login, STS credentials and service-account access for the affected DNs. Short names, total-path limits and real storage errors continue to propagate.

The ASCII restriction is necessary: on macOS, a Unicode filename can exceed 255 UTF-8 bytes and still exist. A drive relocation can then cause a total-path read error. The added regression test writes a real parent revocation, moves the drive, proves that the record is still present through a relative read, and requires the parent check to retain the read error. Both ASCII and Unicode variants fail against the original broad classifier; the Unicode variant also fails with a byte-only guard.

Scope and compatibility

Production changes are confined to the shared object-IAM read entry point (25 added lines). There is no Go module-version, data-format, API, configuration or migration change. A separate one-line Go minimum bump to 1.27.3 is included because CI found the pre-existing crypto/x509 issue GO-2026-6809 in the remote baseline's Go 1.27.2. No other pending dependency updates are included. The etcd backend, successful reads and writes retain their behavior.

Long-DN direct policy mappings and parent revocation records remain unwritable on the object backend, and those writes still return errors. Grant access through a group with a short DN. This fix does not change global checkPathLength behavior or implement a long-key storage format.

Validation

Maintainer validation with Go 1.27.3 on macOS/arm64:

  • 271-byte normalized DN: both IAM-parent directory states return STS HTTP 200; S3 and service-account access succeed.
  • 384-byte normalized DN: LDAP integration suite passes all eight server/backend configurations.
  • IAM revision, revocation, permissions, concurrency, LDAP security, non-normalized Base DN, and import/export checks pass with disposable LDAP and etcd services.
  • Regression boundaries cover 255/256 bytes, policy suffixes, escaped DNs, stored Unicode records, deep paths, wrapped errors and genuine storage failures.
  • make verifiers and make build pass. typos is unavailable and skipped by the repository script.
  • OpenID and external authorization-policy-plugin cases require services not supplied by this local fixture and are explicitly skipped. Full make test, race, production AD/XFS and distributed deployment acceptance are not claimed by these local results.

Focused reproduction:

go test -mod=readonly ./cmd \
  -run '^(TestIAMConfigNameTooLong|TestLoadIAMRevision(NameTooLong|FilesystemNameTooLong|DeepPath)|TestIAMRevocationLifecycle)$' \
  -count=1 -v

The etcd variant requires SILO_TEST_IAM_REVOCATION_ETCD; LDAP integration uses _MINIO_LDAP_TEST_SERVER and _MINIO_ETCD_TEST_SERVER. CI results are reported by the checks attached to the final PR head.

Contributor credit

Original report, reproduction and implementation: @910patin (GL). The original commit 9faeb7a1147435aa7ebc02bb997837ddfbdd2a81, author identity and DCO sign-off are retained. Maintainer follow-up narrows the classification and adds the stored-revocation counterexamples. The changelog also credits @910patin and links this PR.

Checklist

  • Every commit carries a matching DCO sign-off.
  • Tests cover the login regression and fail-closed revocation boundary.
  • Local make verifiers and make build pass with Go 1.27.3.
  • Compatibility and remaining long-key write limitations are documented.
  • Original contribution and authorship are preserved.

910patin and others added 3 commits October 19, 2026 18:49
Since RELEASE.2026-09-16T00-00-00Z, LDAP users whose normalized DN is
longer than 255 bytes cannot log in. NormDN hex-escapes every non-ASCII
byte (go-ldap DN.String()), so one Cyrillic letter takes six characters.
IAM looks up records named after the DN: the parent revision check added
with cmd/iam-revision.go reads config/iam/users/<DN>/identity.json, and
PolicyDBGet reads config/iam/policydb/sts-users/<DN>.json when the
mapping is not cached.

A drive rejects such an element in one of two ways. checkPathLength
refuses more than 255 counted characters, but outside Windows it never
counts a backslash, so an escaped DN usually passes it. The filesystem
then fails with ENAMETOOLONG once the parent directory exists.
toObjectErr reports both as ObjectNameInvalid, and the callers treat
only errConfigNotFound as "no record". As a result,
AssumeRoleWithLDAPIdentity, access-key creation and STS loading fail.

Such a record cannot have been stored. When the object layer's own name
validation (checkBucketAndObjectNames) accepts the path,
ObjectNameInvalid can only mean a length rejection, so report it as
errConfigNotFound. Invalid names and storage errors are returned
unchanged, and saving such a record still fails. The etcd store has no
such limit and is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: GL <[email protected]>
Only classify a valid IAM key as absent when a length error accompanies an ASCII path component longer than 255 bytes. Normalized LDAP DNs satisfy this condition, while total-path errors and Unicode names can refer to existing revocation records.

Cover component boundaries, wrapped and storage errors, and real revocation records moved beneath a deep Darwin drive path.

Signed-off-by: Feng Ruohang <[email protected]>
@Vonng Vonng changed the title iam: LDAP login fails for users with long non-ASCII DNs (ObjectNameInvalid on IAM record lookup) fix(iam): restore long-DN LDAP login while preserving revision errors Oct 23, 2026
The PR CI found GO-2026-6809 in the remote main baseline using Go 1.27.2. Require the patched toolchain already used for local acceptance; keep module versions and the separate dependency refresh unchanged.

Signed-off-by: Feng Ruohang <[email protected]>
@Vonng
Vonng merged commit d43adc0 into pgsty:main Oct 23, 2026
11 checks passed
Vonng added a commit that referenced this pull request Oct 24, 2026
Retain the merged upstream LDAP fix and original contributor history. Keep the existing Go/dependency refresh and published-release documentation; combine the changelog credit without repeating the Go 1.27.3 note.

Signed-off-by: Feng Ruohang <[email protected]>
@Vonng Vonng added the bug Something isn't working label Oct 26, 2026
@Vonng Vonng added this to the 20261026 milestone Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants