Skip to content

Conversation

emchristiansen
Copy link

Related to: #29

fix: preserve provider URI details in builder pattern

Previously, the builder pattern would convert provider URIs to Provider
instances and then only extract the provider name (e.g., "onepassword")
instead of preserving the full URI with vault/path information
(e.g., "onepassword://SecretSpecMetacortex").

This fix:

  • Adds a uri() method to the Provider trait that returns the full URI
  • Implements uri() for all providers following the SecretSpec URI spec:
    • OnePassword: "onepassword://[account@]vault" or "onepassword+token://vault"
    • Dotenv: "dotenv" or "dotenv:path" (single colon format)
    • Keyring: "keyring"
    • Env: "env"
    • LastPass: "lastpass" or "lastpass://folder"
  • Updates the builder to use provider.uri() instead of provider.name()
  • Updates Resolved struct to store the full URI instead of just the name

This ensures that vault names, paths, and other provider-specific
configuration are preserved when using the builder pattern, fixing
issues where secrets couldn't be found due to missing vault information.

@emchristiansen
Copy link
Author

This code was written with Claude Code.

@domenkozar
Copy link
Member

We should be using Into<String> and Into<Uri> here instead of methods.

Also, need to come with some tests per provider, Claude should be able to write those up.

@domenkozar
Copy link
Member

@emchristiansen ping

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