Skip to content

Add a test pinning the OS keyring secret size cap behind #7707 - #7727

Open
janniklasrose wants to merge 1 commit into
mainfrom
janniklasrose/keyring-size-limit-repro
Open

janniklasrose wants to merge 1 commit into
mainfrom
janniklasrose/keyring-size-limit-repro

Conversation

@janniklasrose

@janniklasrose janniklasrose commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

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-keyring backend and asserts keyring.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 login failing on macOS with store token: data passed to Set was too big for workspaces whose U2M access tokens are about 3250 bytes. This reproduces the report on the macos-latest CI cell, since the limit cannot be exercised on Linux:

  • go-keyring v0.2.8 base64-encodes the secret and pipes add-generic-password -U -s <service> -a <account> -w <secret> into security -i, rejecting the write when that line exceeds 4096 bytes (keyring_darwin.go). Upstream master still has the same check.
  • The CLI marshals the whole 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.
  • ProbeKeyring writes a tiny token and succeeds, so the login path commits to the keyring and only the final Put fails, which is why the error surfaces as store token: ... instead of the plaintext fallback.
  • The same applies on Windows with a lower cap: go-keyring rejects credential blobs over 2560 bytes, so the test also runs there.

Verified manually on macOS (outside CI): piping a 4538-byte add-generic-password line into security -i stores a password truncated to 4038 bytes and reports unknown command for 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 the security -i path go-keyring uses does.

No changelog fragment: test-only change.

Tests

  • GOOS=darwin and GOOS=windows go vet and golangci-lint pass locally for libs/auth/storage; the real assertion runs on the macOS and Windows CI cells of this PR.
  • Linux go test ./libs/auth/storage/ still passes (the new file is excluded there).

This pull request and its description were written by Isaac.

`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>
@github-actions github-actions Bot added auth test-only-fix PRs that update failing of flaky tests without changing CLI code. labels Nov 17, 2026
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: afcd304

Run: 44126086084

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 270 15 15:39
💚​ aws-windows-latest-4core-16gb 1 272 13 8:27
💚​ azure linux-2core-8gb 1 269 15 10:48
💚​ azure-windows-latest-4core-16gb 1 271 13 8:03
💚​ gcp linux-2core-8gb 1 270 15 11:21
💚​ gcp-windows-latest-4core-16gb 1 272 13 8:03
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 18 slowest tests (at least 2 minutes):
duration env testname
4:32 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
3:51 aws linux-2core-8gb TestSyncNestedFolderDoesntFailOnNonEmptyDirectory
3:50 aws-windows-latest-4core-16gb TestAccept
3:46 gcp-windows-latest-4core-16gb TestAccept
3:33 aws linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
3:32 azure-windows-latest-4core-16gb TestAccept
3:05 aws linux-2core-8gb TestImportDirWithOverwriteFlag
3:01 aws-windows-latest-4core-16gb TestImportDirDoesNotOverwrite
2:59 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
2:45 azure-windows-latest-4core-16gb TestImportDirDoesNotOverwrite
2:33 azure linux-2core-8gb TestFilerWorkspaceFilesExtensionsStat
2:31 gcp linux-2core-8gb TestFilerWorkspaceFilesExtensionsRead
2:25 aws linux-2core-8gb TestFilerRecursiveDelete/workspace_files
2:17 azure-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
2:12 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
2:08 aws-windows-latest-4core-16gb TestSyncIncrementalSyncPythonNotebookToFile
2:05 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsDelete
2:00 aws-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsStat

@janniklasrose
janniklasrose marked this pull request as ready for review November 17, 2026 17:29
@janniklasrose
janniklasrose requested review from a team as code owners November 17, 2026 17:29

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth test-only-fix PRs that update failing of flaky tests without changing CLI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants