-
Notifications
You must be signed in to change notification settings - Fork 789
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
Fix Watchtower interval (should be 1 hour) #56
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
@@ -424,7 +424,8 @@ function getInstallScript( | |||
const sanitizezedAccessToken = sanitizeDigitaloceanToken(accessToken); | |||
return '#!/bin/bash -eu\n' + | |||
`export DO_ACCESS_TOKEN=${sanitizezedAccessToken}\n` + | |||
(image ? `export SB_IMAGE=${image}\n` : '') + | |||
// Set watchtower to 30 second refresh rate when overriding image. | |||
(image ? `export SB_IMAGE=${image}\nexport WATCHTOWER_REFRESH_SECONDS=30\n` : '') + |
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.
Those variables need to be escaped, otherwise we are subjected to command injection.
Same below. (didn't we have a shellEscape
function here?)
We should at least add a TODO
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.
Are you worried about some case besides a user injecting commands into their own server creation?
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'll add a TODO, but this actually came up in the past and we didn't address it because we weren't convinced of the threat model (it seems like users who start the electron app via the command line could inject commands into their own script, but we haven't seen any way for an outside attacker to inject commands). In any case I agree it's a bit of a code smell
@@ -424,7 +424,8 @@ function getInstallScript( | |||
const sanitizezedAccessToken = sanitizeDigitaloceanToken(accessToken); | |||
return '#!/bin/bash -eu\n' + | |||
`export DO_ACCESS_TOKEN=${sanitizezedAccessToken}\n` + | |||
(image ? `export SB_IMAGE=${image}\n` : '') + | |||
// Set watchtower to 30 second refresh rate when overriding image. | |||
(image ? `export SB_IMAGE=${image}\nexport WATCHTOWER_REFRESH_SECONDS=30\n` : '') + |
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.
Please make the refresh seconds a parameter for getInstallScript
, rather than derived from another parameter
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.
Why?
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.
It's more explicit, so it's safer. Otherwise we might trigger the 30 seconds again by mistake
PTAL, I've added the TODO and am now passing in |
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.
Thanks!
Fix Watchtower interval (should be 1 hour). Tested: