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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Arbitrary code execution during compilation – rust

53 点作者 eleijonmarck大约 2 年前

13 条评论

alkonaut大约 2 年前
Afaik you don’t even need to use macros for this, can’t you just put a build.rs file in the crate and it will execute on build?<p>Almost all build&#x2F;project systems I know have this functionality simply because execution of arbitrary programs is too useful to go without. Any C# project (.csproj) for example can include a task that eats your homework.<p>It’s scary but I don’t see a solution like sandboxing being very easy to retrofit either.
评论 #35214131 未加载
评论 #35213947 未加载
评论 #35214499 未加载
评论 #35214111 未加载
评论 #35214339 未加载
jasonpeacock大约 2 年前
Nothing new to see here...<p>Any of these steps could do the same to your system, and it&#x27;s been the &quot;standard&quot; for 30+ years:<p><pre><code> .&#x2F;configure make sudo make install </code></pre> Or literally any other language&#x2F;package manager that supports build scripts.
评论 #35214188 未加载
Longlius大约 2 年前
I would expect any sufficiently powerful macro system would have to be this way.<p>Don&#x27;t most editors ask you whether or not you want to trust some code before opening it with full privileges anyway?
评论 #35213845 未加载
评论 #35217618 未加载
winstonewert大约 2 年前
So... if I&#x27;m using a third party crate, I&#x27;m already trusting it not to do bad things in my running application. Why is it such a big deal that it could do bad things during build time just before I run it? If I&#x27;m using a third party crate... I&#x27;ve got to trust it one way or the other. So what&#x27;s the big deal here?
评论 #35214015 未加载
评论 #35214307 未加载
proctrap大约 2 年前
Old, it&#x27;s not new that macro expansions, build files and build tooling can do that. (And if we sandboxed that, you still get infected release builds, check your deps..)<p>See NPM installations and &quot;please sponsor this project&quot; messages, which can also give you a virus.
revelio大约 2 年前
We must start systematically sandboxing developer tools. It&#x27;s scary how sensitive dev workspaces are, and how much random crap we run. After decades of training the world&#x27;s parents and grandparents not to download and run programs from untrusted sources we now routinely do it ourselves.
评论 #35213993 未加载
WilliamBerglund大约 2 年前
D does this &quot;the right way&quot;, which is to say free of side-effects.<p><a href="https:&#x2F;&#x2F;tour.dlang.org&#x2F;tour&#x2F;en&#x2F;gems&#x2F;compile-time-function-evaluation-ctfe" rel="nofollow">https:&#x2F;&#x2F;tour.dlang.org&#x2F;tour&#x2F;en&#x2F;gems&#x2F;compile-time-function-ev...</a><p><a href="https:&#x2F;&#x2F;wiki.dlang.org&#x2F;Compile-time_vs._compile-time" rel="nofollow">https:&#x2F;&#x2F;wiki.dlang.org&#x2F;Compile-time_vs._compile-time</a><p>You&#x27;re supposed to be able to trust the compiler, you can&#x27;t trust people. (<a href="https:&#x2F;&#x2F;forum.dlang.org&#x2F;post&#x2F;po2734$20mq$1@digitalmars.com" rel="nofollow">https:&#x2F;&#x2F;forum.dlang.org&#x2F;post&#x2F;po2734$20mq$1@digitalmars.com</a>)
评论 #35214503 未加载
WirelessGigabit大约 2 年前
I think this is actually a good case for development containers. That way you&#x27;re very explicit in what you expose in the container.<p>It could still read your AWS keys that you pass in through the ENV though and upload those to some server in China &#x2F; Russia.<p>Or it could delete all your source code, but that&#x27;s counter productive.
0atman大约 2 年前
This is a feature, not a bug: <a href="https:&#x2F;&#x2F;youtu.be&#x2F;MWRPYBoCEaY" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;MWRPYBoCEaY</a>
donatj大约 2 年前
Isn&#x27;t that one of the main selling points of Jai?
eleijonmarck大约 2 年前
POC to demonstrate how to delete files when cargo build runs
eleijonmarck大约 2 年前
I filed a issue on `rust-analyzer` and apparently it is by design - <a href="https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust-analyzer&#x2F;issues&#x2F;14375">https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust-analyzer&#x2F;issues&#x2F;14375</a>
评论 #35213855 未加载
throwaway67743大约 2 年前
Such a safe language, better than everything else so much so that what amounts to a linter does compiles
评论 #35214712 未加载