Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating behaviour of VaultsSecretsGet to align with requirements of secrets cat #805

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

aryanjassal
Copy link
Contributor

@aryanjassal aryanjassal commented Sep 13, 2024

Description

The current VaultsSecretsGet only gets a single secret from the vault, and returns it in the form of a UnaryHandler, meaning for large files, the RPC call will timeout. It also fetches only one file at a time, so behaviour like UNIX's cat command isn't possible.

This PR aims to fix that issue by switching over the RPC handler to a ServerHandler, supporting larger files. This PR also adds support for listing the contents of multiple files in order, like what cat does.

Issues Fixed

Tasks

  • 1. Switch UnaryHandler to StreamHandler
  • 2. Implement support for displaying contents of multiple files
  • 3. Implement support for listing multiple files across multiple vaults
  • 4. Update old test and add new tests

Final checklist

  • Domain specific tests
  • Full tests
  • Updated inline-comment documentation
  • Lint fixed
  • Squash and rebased
  • Sanity check the final build

@aryanjassal aryanjassal self-assigned this Sep 13, 2024
Copy link

linear bot commented Sep 13, 2024

@aryanjassal aryanjassal marked this pull request as draft September 13, 2024 09:45
@aryanjassal
Copy link
Contributor Author

I have implemented basic functionality for displaying file contents for multiple files, and updated the tests in tests/client/handlers/vaults.test.ts.

I still need to review the issue spec and all the code to ensure everything's ready for review.

@aryanjassal
Copy link
Contributor Author

aryanjassal commented Sep 13, 2024

MatrixAI/Polykey-CLI#243 (comment)

I'm going to go ahead with the assumption that we need to implement support for listing contents for files from multiple vaults concurrently, as that makes sense and retains consistency with UNIX commands and secrets rm.

I will wait for review of my approach from secrets rm, and if my implementation seems correct, I will implement that in secrets cat too.

@aryanjassal
Copy link
Contributor Author

aryanjassal commented Sep 17, 2024

The naming of secret commands has changed from what it was. The intention was to keep using the pattern of SecretsGet, SecretsPut, SecretsDel, but to better align with the new commands, these names have been changed to SecretsGet (I haven't changed this name yet), SecretsEdit, SecretsRemove.

We are kinda moving away from the pattern. This was hard to detect as this change was made one-at-a-time across multiple PRs. We might need to look into this and set a standard pattern to follow for ensuring consistency.

@aryanjassal aryanjassal marked this pull request as ready for review September 20, 2024 02:13
src/client/handlers/VaultsSecretsGet.ts Outdated Show resolved Hide resolved
src/client/types.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@tegefaulkes tegefaulkes left a comment

Choose a reason for hiding this comment

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

Small changes, just check your tests are only testing the specific condition we want.

src/client/handlers/VaultsSecretsRemove.ts Outdated Show resolved Hide resolved
tests/client/handlers/vaults.test.ts Outdated Show resolved Hide resolved
feat: concatenates secrets from multiple vaults

feat: updated RPC handlers taking multiple secret paths to use duplex streams

chore: updated tests

chore: updated metadata assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants