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

Add backwards compatible changes to ParsePath for extra behaviors #154

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sgmiller
Copy link
Contributor

go-kms-wrapping wants to use ParsePath to supply sensitive values from out
of band means. But there are three differences that could cause the
inability to supply a value exactly as stored in a file or ENV var with the
existing mechanism or debug misconfigured uses.

  1. Trims all values at the moment, and leading/trailing spaces
    could be significant.
  2. Silently provides "" for an env var that's missing, making it
    difficult to debug mistaken env var names or unset env vars.
  3. (unlikely, but possible), it's not possible to actually supply a value
    that has one of the URL prefixes.

This PR adds an options pattern to solve #1 and #2 by being able to disable
trimming and enable error on missing env var. The status quo is unchanged.

Adds a "string://" url scheme that returns everything following that prefix
untouched, so you can write a value that contains a URL prefix supported by
ParsePath. This does have the limitation of not supporting leading/trailing
spaces in the value after string://, as that's invalid in the URL schema.

@sgmiller sgmiller requested a review from jefferai as a code owner January 13, 2025 21:03
@sgmiller sgmiller requested a review from a team January 14, 2025 19:01
Copy link
Contributor

@stevendpclark stevendpclark left a comment

Choose a reason for hiding this comment

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

👍

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