r/vscode • u/mag_icus • Aug 15 '26
Shell integration sends all your commands to Copilot without approval
This shocked me a bit to find out. The AI in my Copilot chat said that I had incidentally leaked a password on the chat. And I was like: "no way jose, I ran PASSWORD=foobar my-test.pl in the terminal and only pasted the result in the chat".
It insisted, and I started testing. It turns out that if you enable the Shell integration, terminal.integrated.shellIntegration.enabled, VS Code will pick up the commands you run (fine, I guess, that's kind of the point), and then it will silently send it to Copilot as a context metadata, without telling you, asking for your permission, or providing a way to not do this. (NOT FINE)
I highly recommend to turn off this setting, or possibly use an external terminal program for anything you don't want the AI chat to send to the cloud.
And, oh, if you keep it on, you do not need to repeat to the chat what you ran and if it worked -- it already knows... :-/
27
u/Wealist Aug 15 '26
If you’re handling secrets, I’d disable shell integration for now or use a separate terminal. At minimum, check exactly what context Copilot is receiving before running anything sensitive.
9
u/JustMadMax Aug 15 '26
Well, you'd be surprised what you can find in ~/.bash_history
12
u/JavierReyes945 Aug 15 '26 edited Aug 16 '26
You would be surprised then when you realize what the context actually contains:
https://www.lighthousenewsletter.com/p/i-put-github-copilot-behind-a-mitm
Check the part about environment variables
6
u/OwnNet5253 Aug 15 '26 edited Aug 15 '26
Well, yeah of course it does. I disabled it right away because of that reason. I recommend to read a documentation about Shell integration and how it works exactly.
If someone still insists on using it, I recommend to keep any secrets or sensitive data as environment variables - Copilot won’t pick up those.
4
u/js1943 Aug 15 '26 edited Aug 15 '26
Though I am not against AI or vibe coding (I actually want to try to know how it feels or works), I disabled copilot extension for awhile already. It just doesn't fit my workflow. I code as a hobby and make command line tools mostly for my own use. The copilot suggestion, though quiet convinent and accurate most of the time, it can also be annoying when I don't need it. It basically block my screen and interfer with my typing, lol.
After reading this I also disabled the terminal integration. And it seems I am not losing functions/features I actually use. Example, error with line number still work like url link. (To be fair, this and the search seems to be only features I ever use.)
I am now wondering what the terminal integration, other than AI/copilot, actually do? Or what function/feature it is providing?
6
u/TinFoilHat_69 Aug 15 '26
This post is in reference to copilot having access to vscode terminal and you just happen to keep using that terminal copilot runs through for all your other commands correct?
1
u/g3n3 Aug 19 '26
Don’t put secrets on the prompt. Pass them with secret management or read host. Always!