containernetworking / cni

Container Network Interface - networking for Linux containers
https://cni.dev
Apache License 2.0
5.58k stars 1.08k forks source link

Are you sure you want to pass every env on plugin invocation? #1102

Open dionysius opened 5 months ago

dionysius commented 5 months ago

https://github.com/containernetworking/cni/blob/d5c71ad528129e306538f7ba5b796337c1898d81/pkg/invoke/args.go#L57

While debugging an issue I had with our custom CNI plugin I just found out that libcni forwards every env variable of the program calling CNI.

While I could manage the programs env this leads me to the question whether this feature is really a good idea. Shouldn't libcni invoke plugins only with known CNI env variables?

In my case it was an env LOG_TARGET=stdout which made our custom CNI plugin to output debugging info to stdout and thus break the json output.