Skip to content

feat(store): encrypted filestore#29

Merged
Benehiko merged 25 commits intomainfrom
filestore
Sep 19, 2025
Merged

feat(store): encrypted filestore#29
Benehiko merged 25 commits intomainfrom
filestore

Conversation

@Benehiko
Copy link
Member

@Benehiko Benehiko commented Jun 23, 2025

This commit introduces an encrypted filestore backed by the os.Root type,
which enforces a flat storage structure confined to a specific directory.
Each secret is stored per encryption function in its own file, alongside a
public metadata file in JSON format. Filenames are base64-encoded secret
IDs to avoid issues with forward slashes ("/") and other special characters.

All secret files are encrypted with the filippo.io/age library, which
supports multiple encryption and decryption methods, including hardware
keys, SSH keys, and custom plugins. The store cannot follow symlinks
outside the directory specified by os.Root, ensuring stronger isolation.

@Benehiko Benehiko force-pushed the filestore branch 5 times, most recently from 9a5d6d9 to 7fc6e7f Compare September 2, 2025 08:22
@Benehiko Benehiko requested a review from Copilot September 2, 2025 08:23

This comment was marked as outdated.

@Benehiko Benehiko requested review from joe0BAB and wmluke September 2, 2025 08:37
@Benehiko Benehiko marked this pull request as ready for review September 2, 2025 08:38
@Benehiko Benehiko requested a review from Copilot September 2, 2025 08:38
@Benehiko Benehiko changed the title Filestore feat(store): encrypted filestore Sep 2, 2025

This comment was marked as outdated.

This comment was marked as outdated.

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

This pull request implements an encrypted filestore for storing secrets on disk using filippo.io/age encryption. The implementation creates a new file-based storage backend that encrypts secret contents while keeping metadata unencrypted.

  • Adds encrypted filestore package with encryption/decryption using filippo.io/age library
  • Refactors Factory type to be shared across store implementations
  • Updates Go version requirement to 1.25

Reviewed Changes

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

Show a summary per file
File Description
store/store.go Adds shared Factory type definition for secret instantiation
store/keychain/keychain.go Updates to use shared Factory type from store package
store/go.mod Updates Go version to 1.25 and adds filippo.io/age dependency
store/filestore/filestore.go New encrypted filestore implementation with core functionality
store/filestore/filestore_test.go Comprehensive test suite for filestore operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
//
// If any step fails, the directory is removed to prevent partial or
// inconsistent state. An error is returned in such cases.
func Persist(id store.ID, root *os.Root, metadata map[string]string, secrets []EncryptedSecret) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

non-blocking (eg for follow up PR): some small test that verifies the combination of Persist/Restore works

(I know we implicitly cover this on the next layer above / in store_test.go, it's still helpful eg when troubleshooting/debugging to easily spot what works independently and what not)

Copy link
Collaborator

@joe0BAB joe0BAB left a comment

Choose a reason for hiding this comment

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

LGTM! (the missing unlock calls should be fixed before merging though)

(was already fixed, just didn't see as I was logged out..)

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
@Benehiko Benehiko requested a review from Copilot September 19, 2025 07:23
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

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


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
@Benehiko Benehiko merged commit d474f94 into main Sep 19, 2025
20 checks passed
@Benehiko Benehiko deleted the filestore branch September 19, 2025 07:32
@Benehiko Benehiko mentioned this pull request Sep 19, 2025
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