-
Notifications
You must be signed in to change notification settings - Fork 409
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 --env-prefix to encrypt-file command #697
Open
mlocati
wants to merge
2
commits into
travis-ci:master
Choose a base branch
from
mlocati:encrypt_file-custom-env-prefix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hello, there. Thanks for the PR.
I have a couple of questions:
--key
and--iv
flags do not?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'd need to know the names of the two variables in advance.
At the moment, what we have before
_key
and_iv
is really hard to be determined before running the command (their prefix is determined here).If we let users specify this
--env-prefix
option, theenv_prefix
variable will be set to the value of it, andwon't do anything (since
env_prefix
is already defined, it won't be assigned the value of what we have after the=
).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.
@BanzaiMan Is there something unclear with my answer?
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.
No, there isn't. I understand the intent now. One thing still a little uneasy is the name.
env_prefix
seems a little vague. Maybearg_prefix
,env_var_prefix
or something like that. Maybe a short flag name would help as well.Additionally, the help text should indicate how this would interact with
-K
/--key
and--iv
.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.
encrypted_
followed by a SHA-1 hash (for example:encrypted_abcdef012345_iv
/encrypted_abcdef012345_key
)encrypted_abcdef012345
.So, what about
enc_var_prefix
?Well, I think it'll be a rarely used argument, I don't know if it's worth reserving a short flag just for this tiny feature.
Well, there's no interaction with the value of the generated variables, just with their names.
And to me the current text is quite clear about that:
prefix of the names of the encryption key/IV environment variables (randomly generated otherwise)
Do you have a better alternative to it?
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.
enc_var_prefix
seems acceptable.By "interaction", I mean "what would happen if both
-K
and this new flag is given?" (as strange as it may sound). I believe this flag overrides--key
and--iv
, and that should be stated.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.
--key
(aka-K
) sets the value of the encryption key--iv
sets the value of the encryption IV--enc-var-prefix
sets the prefix of the names of the two above valuesExamples:
travis encrypt-file file.txt
generates two environment variables:
encrypted_abcdef012345_iv
with a value generated automaticallyencrypted_abcdef012345_key
with a value generated automaticallytravis encrypt-file --enc-var-prefix myprefix file.txt
generates two environment variables:
myprefix_iv
with a value generated automaticallymyprefix_key
with a value generated automaticallytravis encrypt-file --iv myiv --key mykey file.txt
generates two environment variables:
encrypted_abcdef012345_iv
with the "myiv" valueencrypted_abcdef012345_key
with the "mykey" valuetravis encrypt-file --enc-var-prefix myprefix --iv myiv --key mykey file.txt
generates two environment variables:
myprefix_iv
with the "myiv" valuemyprefix_key
with the "mykey" valueAs you can see, there's no interaction between
--key
/-K
/--iv
and--enc-var-prefix
.And that's quite clear to me from the description of the options:
--key
: encryption key to be used (randomly generated otherwise)--iv
: encryption IV to be used (randomly generated otherwise)--enc-var-prefix
: prefix of the names of the encryption key/IV environment variables (randomly generated otherwise)