Closed OJFord closed 3 years ago
Hi @OJFord, thanks for using Summon, and thanks for submitting this request!
Currently, when Summon returns a filepath, it behaves idempotently. So, if we run a request with !file
multiple times, we don't have to worry about secrets being stored long-term on disk, or files being overwritten. I think that's my main concern with being able to specify a filepath, in that it would break idempotency.
I have two questions:
As with many Summon feature requests, we try to be sure that security is at the forefront of the product, and your alternative does seem like a better way to accomplish this request without making Summon itself potentially causing security vulnerabilities.
@OJFord,
Thank you for proposing this feature. I think this is feature would be useful enough to consider, if we can resolve the concerns that @BradleyBoutcher brings up.
Thinking through @BradleyBoutcher 's questions, and to keep the conversation going... I think we could potentially be okay from a security/idempotency perspective:
!file=<path>
variable specs,
manual deletion of the files would need to be done if/when desired.cc: @andytinkham
Just another thought, maybe we could explicitly document that running concurrent instances of Summon that use the same fixed-path file is not inherently supported, and delete the fixed-path files when Summon exits as it does for temp files.
The latter path seems like a better case of failing safe. My initial reaction is that I'd prefer to see us clean up and document parallel execution is not supported rather than leave secrets lying around.
Hi @OJFord, Your alternative seems to be a good approach and does work in my testing.
Can you expand on the comment in "Additional context" of what issues you are seeing?
With my testing
summon [...] sh -c 'ln -sf $FOO foo.example.com && ls -l foo.example.com && cat foo.example.com && rm foo.example.com
seems to work as expected.
@rpothier I didn't mean my comment in 'Additional context' as a caveat to the 'alternative I had considered' - it was just context for why supplying an environment variable to the target process (e.g. ssh
) isn't always sufficient (resp. because it won't interpolate them).
Is your feature request related to a problem? Please describe
I would like to be able to specify in my ~/.ssh/config something like:
and have
summon
populate the contents of.identities/foo.example.com
(fromgopass
in my case).Describe the solution you would like
I'm imagining something like:
Describe alternatives you have considered
I suppose:
Additional context
.ssh/config files allow only certain environment variables and only for certain options, so
IdentityFile $FOO
wouldn't work, it would expect a file named literally'$FOO'
.