You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
D bindings interpolate WIT documentation as executable D source #1789
I am the Co-Lead of the Cargo Team and was recently hired by the Rust Foundation to help triage AI discovered bugs. This bug was found with AI, namely scrutineer and fable. Except where specifically labeled this report was written by me. @alexcrichton asked me to file this one as an issue so that it doesn't get lost.
AI text:
Summary
Code injection in generated D bindings through WIT documentation. The D backend inserts WIT documentation directly into /++ ... +/ comments; a malicious WIT supplier can include +/ to terminate the comment, inject D declarations or compiler directives, and use /+ to balance the generated closing delimiter. The record formatter at crates/d/src/lib.rs:1746–1749 demonstrates the issue, with the same raw-documentation convention used for other generated documentation.
I've been contemplating just switching to /// single-line doc-comments anyway. Always shorter by two lines, doesn't look too bad. And not any more difficult to edit/maintain since it's all code-genned anyway.
Would solve this issue since /// is a one way trip.
Activity
alexcrichton commentedon Nov 13, 2026
cc @QuantumSegfault
QuantumSegfault commentedon Nov 13, 2026
Ah, that's a good point.
I've been contemplating just switching to
///single-line doc-comments anyway. Always shorter by two lines, doesn't look too bad. And not any more difficult to edit/maintain since it's all code-genned anyway.Would solve this issue since
///is a one way trip.I'll touch this up...probably tonight.