-
Notifications
You must be signed in to change notification settings - Fork 539
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 env variables to include existing environment variables, then override #246
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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 wonder if this is really expected behaviour? Obviously this fixes the bug (we should also add a test for it)
This running locally on a developer's laptop might make sense but do we really want to pass the servers env to commands?
Just a question I can see this leading some security issue later down the line.... Where by this library is exposing env.
I am trying to understand the fix. From what I understand, the environment variables are being read from |
@michaelgeorgeattard #243 (comment) So it is passing your existing env variables from your current shell/process to the command in addition to the ones defined in the kubeconfig. It is merging the current |
@drubin this is yet another undocumented part of Kubeconfig handling... When we look at the original go code for this, this is what they are doing. The override is here: And the loading in of the shell's environment variables is here: So whether this is secure or not, this is the current (and expected) behavior. I'm actually not sure there's a security problem, since these aren't sent to the server, they're only used to invoke the shell executable that returns the security token. |
It's trivial and lgtm but would prefer if we had a test but feel free to Merge if adding a test is too difficult. |
Also thanks for the awesome detailed reply and I fully agree we should stick expected behaviour. |
@drubin test added. took more work than it should have, but the next one will be easier :) |
@brendanburns your linting is off again, but thanks so much for adding a test! The tests pass so /lgtm but you need to fix the linting but if that's the only change I am fine with merging once the linter passes. Maybe we should add husky as a pre-push check to include the tests and linting? it seems like this happens often. |
@drubin this is what I get for working on an airplane via 'vi' I'd be happy to see a pre-push check :) Oh, and I fixed the lint issues :) |
/lgtm Sorry about the back and forth will try setup pre commit hooks soon |
Fixes #243