Read only bootstrap #1367
Replies: 1 comment 2 replies
-
Flux defaults to doing everything in private. If you pass The default behavior in Flux v2 is bootstrap creates a private repo and uses the GITHUB_TOKEN to generate a deploy key, then discards the GITHUB_TOKEN. I believe what you've encountered is a side-effect of a bugfix related to "what happens if the repo already exists" In something like Flux 0.12, the git driver changed to a more full-featured one, and we were able to reconcile the repository state with what values are passed into bootstrap. So suddenly, with this So that reconcile feature got disabled, and Flux will no longer flip the private/public state of your repo if it already exists at bootstrap time. But any other behavior from I suspect you're seeing the effect of using We should probably warn users that they're implicitly passing |
Beta Was this translation helpful? Give feedback.
-
Problem
My git repo is public and doesn't require a deploy key or personal access token for anyone to clone. Neither should Flux. For security reasons, I would like to be able to bootstrap flux without granting the flux CLI write permission to my repository.
Running
flux bootstrap github
requires a read/write personal access token or it fails withGITHUB_TOKEN environment variable not found
. Flux seems to default to using SSH and creating a deploy key even though HTTPS is available without the need for a key. I attempted usingflux bootstrap git
with a HTTPS URL as a workaround but it made the same assumption:I might be able to achieve equivalent functionality to bootstrap with
flux install && flux create source ... && flux reconcile ...
, but I'm unsure of exactly which commands to run and I like the convenience of the single command.Additionally, flux requires write access to the repository so it can commit the flux manifests to the repo. This step seems optional since these manifests could be easily saved and committed out of band. Or not committed at all since the
flux
CLI reconciles those manifests.Solution
I propose if someone is using
flux bootstrap git
with a HTTPS URL, then the source be set to use the same HTTPS URL. It is surprising to configure it one way and it produce a different source. If someone is usingflux bootstrap github
a--transport
flag be added to specify the transport type with values ssh, http or https. An auto transport type could also be considered that detected if the repository is public and accessible via https first before falling back to ssh and requiring a deploy key.For committing the flux manifests, a
--commit-manifests
flag can be added with a default of true to disable this feature. Alternatively, a--manifests=commit|file|stdout|none
flag be added that controls whether to commit them (default), written to files (flux-system/gotk-*
), or output them to stdout so they can be piped to another command.The combination of these features will allow a read only bootstrap and reduce Flux's potential attack surface.
Beta Was this translation helpful? Give feedback.
All reactions