Repository navigation
fix(iam): decide unstorable IAM record names before asking the drives - #274
Merged
Merged
Conversation
Vonng
force-pushed
the
fix/iam-long-record-names
branch
2 times, most recently
from
November 3, 2026 00:26
dab4c5f to
cb0d31b
Compare
Signed-off-by: Denis Babchuk <babchukdenis@icloud.com>
Vonng
force-pushed
the
fix/iam-long-record-names
branch
from
November 3, 2026 00:38
cb0d31b to
dcad2ae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution Licensing (no CLA, inbound=outbound, DCO required)
This pull request contributes to PGSTY SILO (
pgsty/silo). Code contributionsare 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-bytrailer(
git commit -s) certifying theDeveloper Certificate of Origin — see
CONTRIBUTING.md.
Description
Fixes #271.
9faeb7a recognizes an IAM record name that no drive can store by the error it produces. That works on a single drive. On an erasure set every drive fails with its own raw ENAMETOOLONG path error, the errors never agree, and the object layer reports a quorum failure, which
iamConfigNameTooLongrightly does not accept. LDAP logins of users with a long normalized DN then fail with 500, and attaching a policy to such a DN returns 503.This change applies the same name criterion before the drives are asked, so both topologies behave alike.
One commit:
fix(iam): decide unstorable IAM record names before asking the drives
iamConfigNameUnstorable(objPath)(cmd/iam-object-store.go) holds the name part ofiamConfigNameTooLong, unchanged: a valid key (checkBucketAndObjectNames) with an ASCII element over 255 bytes.iamConfigNameTooLong(objPath, err)keeps its contract: a length error for such a key.loadIAMConfigBytesWithMetadatareturnserrConfigNotFoundfor such a key without reading. Before, it read first and mapped the error afterwards, which covered only the single-drive case.saveIAMConfigreturnsObjectNameInvalid{Bucket: .minio.sys, Object: <key>}for such a key without writing: what a single drive reports today, and whatiamConfigNameTooLongand the existing tests expect from a failed save. On an erasure set this turns a 503 into a 400.TestIAMLongNameRecordsOnErasureSet(cmd/iam-long-dn_test.go), run on a single drive and on an erasure set of 16 drives in LDAP mode, with the parent directories present: for a Cyrillic DN of 305 bytes once normalized, the parent revision read andPolicyDBGetfind nothing and return the group policy; attach, detach (a tombstone write) and saving a revocation fail as name-too-long; the lookups still work afterwards.Deletes are not changed: deleting such a key already returns nil on both topologies.
Motivation and Context
In a directory with non-Latin DNs (for example Cyrillic Active Directory), a user whose escaped DN exceeds 255 bytes cannot log in on any erasure set as soon as one user-level policy mapping exists. The existing tests use a single-drive fixture, so they pass. Details and an LDAP script are in the issue.
How to test this PR?
On main, with this test file (
git checkout <this branch> -- cmd/iam-long-dn_test.go), the single-drive case passes and the erasure-set case fails on every step (lines shortened):Run locally on Go 1.27.3 (darwin/arm64), on main
0cfca29cb:make verifiers(golangci-lint: 0 issues),make buildgo test ./cmd -count=1 -run '^(TestIAMConfigNameTooLong|TestLoadIAMRevision.*)$':okgo test ./cmd -count=1 -run '^Test(IAM|STS|.*LDAP|.*Policy|.*Revision|.*Revoc).*':okquay.io/minio/openldap:_MINIO_LDAP_TEST_SERVER=localhost:13391 go test ./cmd -count=1 -run '^Test.*LDAP.*$':okI did not run the whole
./cmdsuite.Manual check with the script from the issue (OpenLDAP, one server with 4 drives): after a user-level mapping exists, the long-DN login goes from 500 to 200, and attaching a policy to the DN from 503 to 400.
Compatibility impact
No API, configuration, storage metadata, metric, route or dependency changes.
ObjectNameInvalid(400XMinioInvalidObjectNameon the admin API) instead of a quorum error (500/503).iamConfigNameTooLongalready accepted, an ASCII element over 255 bytes in an otherwise valid key. Unicode names and long total paths still go to the drives, as before.Types of changes
Checklist:
git commit -s) per the DCOcommit-idorPR #here): partly; completes 9faeb7a for erasure setsmake verifierspassesmake buildpasspgsty/silo.pgsty.com, if needed (not needed)