-
Notifications
You must be signed in to change notification settings - Fork 48
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
Validate that SSM params have leading '/' #53
base: master
Are you sure you want to change the base?
Conversation
A value like 'ssm://foo/bar' will currently get picked up as a parameter named 'foo/bar', but then the lookup in AWS will fail. These changes add a simple validation that the path has a leading '/'.
if !strings.HasPrefix(*parameter, "/") { | ||
return fmt.Errorf("SSM parameters must have a leading '/' (ssm:///<path>): %s", envvar) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this respect nofail
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. I thought the intention behind nofail was to bypass aws lookups, not validation. We've already got some other checks like this:
Lines 183 to 187 in 4cbfae7
parameter, err := e.parameter(k, v) | |
if err != nil { | |
// TODO: Should this _also_ not error if nofail is passed? | |
return fmt.Errorf("determining name of parameter: %v", err) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the question is "what does nofail actually mean?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arg docs say "Don't fail if error retrieving parameter", which to me implies that this should fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subjective of course but I would interpret that to mean this shouldn't fail...
A value like 'ssm://foo/bar' will currently get picked up as a parameter named 'foo/bar', but then the lookup in AWS will fail. These changes add a simple validation that the path has a leading '/'.