Skip to content

Upgrade to Porter secret protocol v2 - #2

Open
carolynvs wants to merge 1 commit into
dev-drprasad:masterfrom
carolynvs:secret-protocol-v2
Open

Upgrade to Porter secret protocol v2#2
carolynvs wants to merge 1 commit into
dev-drprasad:masterfrom
carolynvs:secret-protocol-v2

Conversation

@carolynvs

@carolynvs carolynvs commented May 23, 2022

Copy link
Copy Markdown

This updates the plugin to work with v2 of the secrets protocol, which adds support for context.Context and persisting secrets.

While I was making these changes, I was having a hard time getting the paths to work (with respect to the data key). I have created a new struct Secret that manages where data should be read from and written to.

  • If the secret value itself uses subpaths, the subpath is used to resolve the secret location. The final path segment is the secret key.

    For example, if the path_prefix is myorg/myapp, and the parameter set's secret value is set to v1/mysql/connstr, the secret path is myorg/data/myapp/v1/mysql and the plugin returns the secret's connstr.

  • When writing secrets, we apply the PorterSecret configuration value as a suffix to the secret path.

    For example, if the path prefix is myorg/myapp, and we are saving a key named v1/mysql/connstr, the secret path is myorg/data/myapp/v1/mysql/PORTER_SECRET. If PorterSecret is not configured, we default it to "porter".

This updates the plugin to work with v2 of the secrets protocol, which
adds support for context.Context and persisting secrets.

While I was making these changes, I was having a hard time getting the
paths to work (with respect to the data key). I have created a new
struct Secret that manages where data should be read from and written
to.

* If the secret value itself uses subpaths, the subpath is used to resolve the secret location. The final path segment is the secret key.

  For example, if the path_prefix is myorg/myapp, and the parameter set's secret value is set to v1/mysql/connstr, the secret path is myorg/data/myapp/v1/mysql and the plugin returns the secret's connstr.

* When writing secrets, we apply the PorterSecret configuration value as a suffix to the secret path.

  For example, if the path prefix is myorg/myapp, and we are saving a key named v1/mysql/connstr, the secret path is myorg/data/myapp/v1/mysql/PORTER_SECRET. If PorterSecret is not configured, we default it to "porter".

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
@carolynvs

Copy link
Copy Markdown
Author

Until this changed it merged, you can install my patch for the plugin with the following command:

porter plugin install hashicorp --version v0.1.0-porter.1 --url https://github.com/getporter/hashicorp-plugins/releases/download

I'm just using that fork temporarily so that people can install the plugin with the changes from this pull request.

@carolynvs
carolynvs marked this pull request as ready for review May 26, 2022 14:04
carolynvs added a commit to carolynvs/hashicorp-plugins that referenced this pull request Oct 17, 2022
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.

1 participant