Skip to content

feat: detect blob version and reject v2 offline password unlock - #23

Merged
moonD4rk merged 1 commit into
mainfrom
feat/detect-blob-version-v2
Jul 11, 2026
Merged

moonD4rk merged 1 commit into
mainfrom
feat/detect-blob-version-v2

Conversation

@moonD4rk

Copy link
Copy Markdown
Owner

macOS 26.4+ re-keys the login keychain to v2 (0x200), which can't be decrypted offline from the password alone.

macOS 26.4+ re-keys the login keychain to v2 (0x200), which can't be decrypted offline from the password. WithPassword and PasswordHash now return ErrUnsupportedBlobVersion; WithKey still decrypts v2.
Copilot AI review requested due to automatic review settings July 11, 2026 12:45
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.41%. Comparing base (ab7665e) to head (080db01).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
+ Coverage   75.81%   76.41%   +0.59%     
==========================================
  Files           6        6              
  Lines         769      780      +11     
==========================================
+ Hits          583      596      +13     
+ Misses        112      111       -1     
+ Partials       74       73       -1     
Flag Coverage Δ
unittests 76.41% <100.00%> (+0.59%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
keychainbreaker.go 77.65% <100.00%> (+0.31%) ⬆️
parse.go 81.94% <100.00%> (+0.25%) ⬆️
unlock.go 63.57% <100.00%> (+2.54%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab7665e...080db01. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@moonD4rk
moonD4rk merged commit 60dd1df into main Jul 11, 2026
6 checks passed
@moonD4rk
moonD4rk deleted the feat/detect-blob-version-v2 branch July 11, 2026 12:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates keychain unlocking behavior to detect the DBBlob version and to explicitly reject offline password-based unlock / hash export for macOS 26.4+ “v2” (0x200) login keychains, while keeping the WithKey path functional.

Changes:

  • Parse and retain magic and blobVersion from the DBBlob, and log them during Open.
  • Make WithPassword (master-key derivation) and PasswordHash() return ErrUnsupportedBlobVersion when blobVersion != 0x100.
  • Add tests covering the version gate behavior and document the v2 recovery workflow in the README; CLI dump now treats ErrUnsupportedBlobVersion as a metadata-only fallback case.

Reviewed changes

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

Show a summary per file
File Description
unlock.go Rejects password-based master-key derivation when dbBlob.blobVersion is not v1.
unlock_test.go Adds unit/integration tests for v2 rejection, v1 allowance, and metadata-only fallback via TryUnlock.
parse.go Adds DBBlob version constants and parses magic + blobVersion from the DBBlob header.
parse_test.go Extends DBBlob parsing test coverage for magic and blobVersion.
keychainbreaker.go Logs parsed DBBlob magic/blobVersion; gates PasswordHash() to v1 only.
keychainbreaker_test.go Adds regression test asserting PasswordHash() rejects v2.
errors.go Introduces ErrUnsupportedBlobVersion for v2 offline password unlock/hash export cases.
doc.go Documents that WithPassword is v1-only and returns ErrUnsupportedBlobVersion on v2.
cmd/keychainbreaker/cmd/root.go Allows CLI dump to treat ErrUnsupportedBlobVersion like wrong-password for metadata-only export.
README.md Documents v2 behavior and adds a recovery method to capture/replay the master key via WithKey.
.golangci.yml Enables goconst and excludes it for _test.go files.

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

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.

2 participants