Skip to content

feat: secure auth material storage (RFC 0016)#160

Merged
rmanibus merged 1 commit into
mainfrom
feat/secure-auth-storage-rfc0016
Mar 19, 2026
Merged

feat: secure auth material storage (RFC 0016)#160
rmanibus merged 1 commit into
mainfrom
feat/secure-auth-storage-rfc0016

Conversation

@rmanibus
Copy link
Copy Markdown
Contributor

This PR completes the implementation of RFC 0016, providing secure storage for OAuth tokens and credentials.

Key changes:

  • Added encrypted fallback for config-token:// scheme when native keychains are unavailable.
  • Key derivation for fallback encryption uses MachineID and local salt.
  • Updated CLI wizards to default to secure token references.
  • Fixed context propagation in secret backends.
  • Resolved Windows-specific test failures related to file permissions.

@rmanibus rmanibus added the enhancement New feature or request label Mar 18, 2026
Comment thread cmd/cloudstic/cmd_auth.go Fixed
@rmanibus rmanibus force-pushed the feat/secure-auth-storage-rfc0016 branch from 356e0b7 to b2e7fa6 Compare March 18, 2026 21:11
Comment thread e2e/sftp.go Fixed
@rmanibus rmanibus force-pushed the feat/secure-auth-storage-rfc0016 branch 3 times, most recently from e6e6d22 to 9f0e65f Compare March 19, 2026 13:04
@rmanibus rmanibus requested a review from Copilot March 19, 2026 13:04
@rmanibus rmanibus force-pushed the feat/secure-auth-storage-rfc0016 branch from 9f0e65f to c2c2427 Compare March 19, 2026 13:06
Copy link
Copy Markdown

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

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.Resolver plus new file:// and encrypted config-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 login description 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.

Comment thread internal/engine/profiles.go
Comment thread internal/secretref/secretref.go Outdated
Comment thread internal/paths/paths.go
Comment thread cmd/cloudstic/cmd_auth.go Outdated
Comment thread cmd/cloudstic/cmd_auth.go
Comment thread cmd/cloudstic/cmd_profile.go Outdated
Comment thread cmd/cloudstic/cmd_auth.go Outdated
Comment thread pkg/source/onedrive.go Outdated
Comment thread internal/secretref/file_backend.go Outdated
Comment thread internal/secretref/file_backend.go Outdated
@rmanibus rmanibus force-pushed the feat/secure-auth-storage-rfc0016 branch 2 times, most recently from ed7e1a8 to 7888bca Compare March 19, 2026 13:40
- 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
@rmanibus rmanibus force-pushed the feat/secure-auth-storage-rfc0016 branch from 7888bca to 03ac734 Compare March 19, 2026 13:43
@rmanibus rmanibus merged commit 84a783d into main Mar 19, 2026
11 of 12 checks passed
@rmanibus rmanibus deleted the feat/secure-auth-storage-rfc0016 branch March 19, 2026 14:02
@rmanibus rmanibus linked an issue Mar 19, 2026 that may be closed by this pull request
@rmanibus rmanibus added this to the v1.14.0 milestone Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC 0016: Epic / Tracking issue for secure auth material storage

3 participants