feat: secure auth material storage (RFC 0016)#160
Merged
Conversation
356e0b7 to
b2e7fa6
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
e6e6d22 to
9f0e65f
Compare
9f0e65f to
c2c2427
Compare
There was a problem hiding this comment.
Pull request overview
This PR implements RFC 0016 by extending the existing internal/secretref system to support mutable binary auth blobs (OAuth tokens / credential JSON) and updating Google Drive + OneDrive sources and CLI flows to use reference-based secure storage.
Changes:
- Added blob load/save/delete support to
secretref.Resolverplus newfile://and encryptedconfig-token://blob backends. - Refactored Google Drive and OneDrive token persistence to support ref-based storage and to persist refresh tokens via a persistent token source wrapper.
- Updated profile/auth schema, CLI commands, and documentation to prefer secure token references.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| rfcs/0016-secure-auth-material-storage.md | Marks RFC as implemented and updates design to unified secretref + blob storage approach. |
| pkg/source/onedrive.go | Adds resolver + tokenRef support and persists refreshed tokens via persistentTokenSource. |
| pkg/source/oauth_persistent.go | New helper token source wrapper that saves refreshed tokens. |
| pkg/source/gdrive.go | Adds resolver + token/creds ref support and persists refreshed tokens via persistentTokenSource. |
| internal/secretref/secretref.go | Introduces blob interfaces and resolver routing; extends default resolver schemes. |
| internal/secretref/keychain_backend_test.go | Updates keychain tests to use byte-based lookup and adds blob round-trip test. |
| internal/secretref/keychain_backend_stub.go | Updates non-macOS stubs to blob-oriented keychain functions. |
| internal/secretref/keychain_backend_darwin_test.go | Updates darwin keychain tests for blob lookup/store functions. |
| internal/secretref/keychain_backend_darwin.go | Implements blob lookup/store and delete for macOS keychain. |
| internal/secretref/keychain_backend.go | Refactors keychain backend to support blobs + delete and keep string Resolve/Store compatibility. |
| internal/secretref/file_backend_test.go | Adds tests for file:// and config-token:// blob round-trips. |
| internal/secretref/file_backend.go | Adds FileBackend and encrypted ConfigTokenBackend with key derivation + atomic writes. |
| internal/paths/paths.go | Adds MachineID() and SaveAtomic() helper for atomic file writes. |
| internal/engine/profiles.go | Adds new YAML fields for *_ref and validates ref syntax in profiles/auth entries. |
| docs/user-guide.md | Documents secret references for auth tokens and adds scheme overview + examples. |
| docs/encryption.md | Documents config-token:// managed token encryption design + scheme list updates. |
| cmd/cloudstic/config_tables.go | Updates auth show / profile show output to display token storage refs and new fields. |
| cmd/cloudstic/cmd_profile.go | Updates interactive wizard to default token storage to config-token://.... |
| cmd/cloudstic/cmd_backup.go | Adds CLI flags for *_ref fields and wires a default secret resolver into source init. |
| cmd/cloudstic/cmd_auth_test.go | Updates tests for non-interactive runs and adds wizard test for default token ref. |
| cmd/cloudstic/cmd_auth.go | Adds *_ref flags, adjusts auth login flow to use ref-enabled source init, and updates defaults. |
| .github/dependabot.yml | Adds Dependabot configuration for Go modules and GitHub Actions. |
Comments suppressed due to low confidence (1)
docs/user-guide.md:678
- The
auth logindescription still says it saves the token in the configured "token file", but tokens can now be stored via refs (keychain://, config-token://, etc.). Update this wording to "token storage" (or similar) to match the new behavior.
#### auth login
Trigger OAuth login for an auth entry and save token in its configured token
file.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ed7e1a8 to
7888bca
Compare
- Extend secretref with BlobBackend and atomic SaveBlob - Add file:// and config-token:// (app-managed) backends - Update KeychainBackend to support binary blobs - Refactor GDrive and OneDrive sources to persist refreshed tokens via references - Update profile schema and CLI (auth/backup) to support auth material refs - Add .github/dependabot.yml for Go and Actions updates
7888bca to
03ac734
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.
This PR completes the implementation of RFC 0016, providing secure storage for OAuth tokens and credentials.
Key changes:
config-token://scheme when native keychains are unavailable.