TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Why is Cursor IDE accessing all my env vars?

15 点作者 iyn3 个月前
Recently I tried playing with https:&#x2F;&#x2F;www.cursor.com&#x2F; but got spooked by the LuLu alert (https:&#x2F;&#x2F;objective-see.org&#x2F;products&#x2F;lulu.html) when launching the app, where the process args included &quot;JSON.stringify(process.env)&quot; part, see screenshot here: https:&#x2F;&#x2F;imgur.com&#x2F;a&#x2F;DmDuGTz<p>Is this... normal? I don&#x27;t understand why they might want to serialize&#x2F;access all of my env vars. Does anyone have a suggestion for that behaviour? I&#x27;m probably missing some reasonable explanation, happy to learn more.<p>I&#x27;ve been running a lot of stuff in VMs lately anyway, but don&#x27;t want to end up having to spin up a VM for the core app like a code editor. How do you all deal with untrusted (but not really malware-level untrusted) software?

7 条评论

jimsmart3 个月前
&gt; Is this... normal? I don&#x27;t understand why they might want to serialize&#x2F;access all of my env vars. Does anyone have a suggestion for that behaviour?<p>All processes get a copy of all environment variables [edit for clarity: all environment variables, from the global environment].<p>Unless one goes out of one&#x27;s way to prevent this from happening.<p>&gt; the process args included &quot;JSON.stringify(process.env)&quot; part<p>And this app choses to receive the env vars in a JSON format. NBD really, in light of the above points.<p>Environment variables are not secret at all. Quite the opposite: because all processes get a copy of them. They&#x27;re just variables that are associated with- &#x2F; stored in- the environment, instead of e.g. in code itself. They absolutely should not be considered to be secure in any way.<p>Managing secrets is always tricky. Even a naive attempt at trying to avoid using env vars generally leaks stuff in some way - shell command history will record secrets passed-in at launch time, plus any running process (with sufficient permissions) can get a list of running processes, and can see the command line used to invoke a process.<p>And once one gets past the naive solutions, it usually adds some friction somewhere along the line. There&#x27;s no easy, transparent, way to do things, as far as I am aware. They all have some cost.<p>There are quite a few articles on the web about stuff this topic as a whole. I don&#x27;t think anything particularly new will come from HN users here, it&#x27;ll mostly be repeating the same already known&#x2F;discussed stuff. As I myself am doing here, really.<p>You might find it helpful to consider something like Hashicorp&#x27;s Vault, or similar, for proper management of secrets.
评论 #43136897 未加载
评论 #43133420 未加载
seanhunter3 个月前
Environment variables exist to share information with processes spawned in that environment. If you don’t want the process to know something, you could look into using something like “env” to spawn the process with a reduced environment, but in general it’s good hygiene not to have anything in the environment that you wouldn’t feel comfortable with a process reading.
评论 #43132609 未加载
tsunitsuni3 个月前
It seems like the command is from this line of the VSCode source (Cursor is a fork of VSCode): <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;vscode&#x2F;blob&#x2F;f8b29f8da2c9bfda02924243e02a5da864581aa0&#x2F;src&#x2F;vs&#x2F;platform&#x2F;shell&#x2F;node&#x2F;shellEnv.ts#L144C4-L144C108">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;vscode&#x2F;blob&#x2F;f8b29f8da2c9bfda029...</a><p>GitHub Copilot thinks it does this to capture shell-specific environment variables (like those set up in .zshrc) that you wouldn&#x27;t necessarily get unless you open the app from a shell yourself. Given it&#x27;s been like this for at least 4 years, I don&#x27;t think it&#x27;s necessarily anything nefarious, and it&#x27;s likely unchanged in Cursor.
评论 #43134548 未加载
评论 #43134725 未加载
marshughes3 个月前
The serialization of environment variables when Cursor starts might be for configuring its running environment, like determining plugin loading or server connections, or for diagnostic and debugging purposes to help locate issues. However, this has risks as environment variables may contain sensitive info such as API keys, and could be leaked if the software has vulnerabilities. To handle such software, check the official documentation or community forums for the reason of accessing env vars, use tools to monitor its usage of the vars, and download from official channels. So, what do you think will be the biggest obstacle when implementing these actions?
viraptor3 个月前
There&#x27;s not nearly enough context for what that code is doing to say whether this is a typical usage or not. The environment is there to be used. It&#x27;s a bit weird that it&#x27;s stringified, not again - not enough information.
评论 #43133096 未加载
iyn3 个月前
Clickable link to the screenshot: <a href="https:&#x2F;&#x2F;i.imgur.com&#x2F;47UeNAw.png" rel="nofollow">https:&#x2F;&#x2F;i.imgur.com&#x2F;47UeNAw.png</a>
ratg133 个月前
Use an IP restricted key vault.<p>If you’re just trusting everything to .env, someone will hack you eventually.