Repository navigation
Add a test pinning the OS keyring secret size cap behind #7707 - #7727
Open
janniklasrose wants to merge 1 commit into
Open
janniklasrose wants to merge 1 commit into
janniklasrose wants to merge 1 commit into
Conversation
`databricks auth login` fails on macOS with `store token: data passed to Set was too big` when the U2M access token is ~3250 bytes (#7707). zalando/go-keyring v0.2.8 caps the base64-encoded `security -i add-generic-password` line at 4096 bytes on macOS and the credential blob at 2560 bytes on Windows, and the CLI stores the whole token envelope in one keyring item, so the access token alone exceeds both caps. The test calls the real backend with a token of that size and asserts ErrSetDataTooBig. The size check runs before the keyring is contacted, so it is deterministic on CI runners with a locked keychain. It pins the current behavior so a fix has to flip it on purpose. Co-authored-by: Isaac <no-reply@databricks.com>
Collaborator
✅ Integration test reportCommit: afcd304
Top 18 slowest tests (at least 2 minutes):
|
This branch has not been deployed
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.
Changes
Add a unit test, built on macOS and Windows only, that stores a token with a 3250-byte access token through the real
zalando/go-keyringbackend and assertskeyring.ErrSetDataTooBig. The size check in go-keyring runs before the keyring is contacted, so the test is deterministic on CI runners whose keychain is locked and never writes to the developer's keychain.The test pins the current behavior; a fix for the issue below has to flip it on purpose.
Why
#7707 reports
databricks auth loginfailing on macOS withstore token: data passed to Set was too bigfor workspaces whose U2M access tokens are about 3250 bytes. This reproduces the report on themacos-latestCI cell, since the limit cannot be exercised on Linux:add-generic-password -U -s <service> -a <account> -w <secret>intosecurity -i, rejecting the write when that line exceeds 4096 bytes (keyring_darwin.go). Upstreammasterstill has the same check.oauth2.Token(access token, refresh token, expiry) into one keyring item. A 3250-byte access token yields a ~3350-byte JSON envelope and a ~4540-byte command, so it is rejected even with no refresh token. The cap is reached at roughly a 2830-byte access token for a 10-character profile name.ProbeKeyringwrites a tiny token and succeeds, so the login path commits to the keyring and only the finalPutfails, which is why the error surfaces asstore token: ...instead of the plaintext fallback.Verified manually on macOS (outside CI): piping a 4538-byte
add-generic-passwordline intosecurity -istores a password truncated to 4038 bytes and reportsunknown commandfor the remaining bytes, so the tool reads at most 4095 bytes per line and go-keyring's check prevents a silently truncated token. The same 4480-byte secret passed as a command-line argument is stored in full, so the keychain item itself has no such limit; only thesecurity -ipath go-keyring uses does.No changelog fragment: test-only change.
Tests
GOOS=darwinandGOOS=windowsgo vetandgolangci-lintpass locally forlibs/auth/storage; the real assertion runs on the macOS and Windows CI cells of this PR.go test ./libs/auth/storage/still passes (the new file is excluded there).This pull request and its description were written by Isaac.