Skip to content

test: keychain storage limits#481

Merged
Benehiko merged 1 commit intomainfrom
keychain/store/tests
Mar 4, 2026
Merged

test: keychain storage limits#481
Benehiko merged 1 commit intomainfrom
keychain/store/tests

Conversation

@Benehiko
Copy link
Member

@Benehiko Benehiko commented Mar 4, 2026

Add additional tests for the keychain store - especially windows. This checks if we can store large blobs in the store.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds regression test coverage to ensure large secrets (e.g., JWT-sized credentials) can be stored and retrieved via the keychain store, including exercising Windows’ Credential Manager blob-size limit behavior.

Changes:

  • Add Windows-specific encode/decode roundtrip tests that exceed maxBlobSize and validate chunkBlob reassembly.
  • Add a cross-platform integration test that saves/gets a large JWT credential via the keychain store API.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
store/keychain/keychain_windows_test.go Adds UTF-16 encode/decode and oversized-blob chunking roundtrip tests on Windows.
store/keychain/keychain_test.go Adds an end-to-end save/get test for a large JWT-like credential to cover storage limits behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
@Benehiko Benehiko force-pushed the keychain/store/tests branch from 0a87cda to 9fa678c Compare March 4, 2026 11:14
Copy link

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Assessment: 🟢 APPROVE

This PR adds comprehensive test coverage for keychain storage limits, specifically testing large JWT credentials that exceed Windows' 2560-byte blob limit. The tests verify that credentials are properly chunked, stored, retrieved, and reassembled.

The new tests are well-structured and provide valuable coverage for edge cases. I found one minor opportunity to strengthen test validation in the third test case.

Findings

1 LOW severity issue


LOW — Missing chunk validation in third test

The test "roundtrip multiple large JWTs as separate credentials" calls chunkBlob at line 136 but doesn't verify the chunking behavior. Unlike the second test (which includes assert.Greater(t, len(chunks), 1)), this test skips chunk validation entirely and only verifies the final reassembled output.

Consider adding assertions to verify:

  • len(chunks) > 1 to confirm chunking occurred
  • Each chunk size is <= maxBlobSize to validate chunking correctness
  • Optional: expected chunk count based on the blob size

This would make the test more thorough and catch potential chunking bugs that might still allow correct reassembly.

} {
cred := &mocks.MockCredential{Username: tc.username, Password: tc.password}
blob, err := encodeSecret(cred)
require.NoError(t, err)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing chunk validation in third test

Unlike the second test at line 110 (which includes assert.Greater(t, len(chunks), 1)), this test doesn't verify the chunking behavior. Consider adding assertions to check:

  • len(chunks) > 1 to confirm chunking occurred
  • Each chunk is <= maxBlobSize to validate correctness
  • Optional: expected chunk count based on blob size

This would strengthen the test and catch potential chunking bugs.

@Benehiko Benehiko merged commit 60ebfbf into main Mar 4, 2026
27 of 28 checks passed
@Benehiko Benehiko deleted the keychain/store/tests branch March 4, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants