fugue / credstash

A little utility for managing credentials in the cloud
Apache License 2.0
2.06k stars 214 forks source link

Padding is applied to all versions including manual ones #198

Open lobsterdore opened 6 years ago

lobsterdore commented 6 years ago

Apologies if this has been addressed elsewhere.

I am using text based versions that represent git tags plus CI job number, for example v1.0.0-1, which would be application version 1.0.0 build number 1; I found straight away that even when using the -v flag when putting a secret into a fresh Dynamo table all my versions are left padded, so the example given above ends up as 00000000000v1.0.0-1.

Digging through the docs and PRs related to the addition of padding I was under the impression that it is supposed to only apply to auto versioned variables, however digging into the code I can see that it is applied to all put operations - https://github.com/fugue/credstash/blob/master/credstash.py#L304

In fact it is applied twice to auto versioned variables as the version padding is applied in the putSecretAction function just before the call to putSecret - https://github.com/fugue/credstash/blob/master/credstash.py#L380

The result of all this is that I am forced to left pad my versions when performing get operations, so if I want to look up version v1.0.0-1 I have to pass the left padded version (00000000000v1.0.0-1); is this behaviour intentional? I can see there is some documentation in the README but it seems to imply that left padding applies to auto versioning only.