I convinced my organization to give Julia a try. I am now responsible for setting up a process to review and approve code libraries prior to inclusion to a local software repository.
I am to perform vulnerability scanning for code libraries to identify and restrict exposure to high risk code using static code analysis.
I am not sure how to even start with that. Are there any resources I can look, any packages that can do that?
That’s going to be a massive undertaking! But in general I believe that it would be nice to have some support for security reviews from the community for packages. This is how I did it lately with a given package (roughly and less structured):
I combined all the source code (/src) into a single file using the mytree function (see below).
I used OpenWebUI, primarily with the o4-mini model or gpt-4.1 if the
context-window or quality needed it.
I submitted the entire source code (/src) (including supporting
source codes or other code like manual_documentation.md
when necessary) as the initial prompts.
I asked the LLM to identify potential security vulnerabilities, then
iterated through a structured review loop (roughly):
a. Is this actually a security issue? Can you provide justification
or evidence? (optional)
b. Propose a fix or solution.
c. Generate relevant tests.
d. Write accompanying documentation.
Thr loop should not be run only once per issue. If you repeat it, the LLM is likely to find more or refine the solution…
You will learn a ton while doing the review. If you want to make a security review without LLM, you will need a big team. Of course, depending on the company you work in, it’s possible.
Thanks for this! I’ve been looking into semgrep, which can automate the scanning. However, I am not a computer engineer, I’m just a user of Julia, so I’m a bit lost. I believe I will need some rule files for semgrep to compare against the package code. JuliaHub has a white paper on secure Julia coding. Perhaps it would be sufficient to translate those guidelines into rules that semgrep can use.
Static analysis in Julia is generally relatively underdeveloped, and the most visible efforts have gone into performance rather than security. For example, JET.jl and Cthulhu.jl dive into the compiler’s type inference, and AllocCheck.jl hunts for heap allocations in the LLVM IR. Semgrep does have Experimental support (below Beta and Generally Available) for Julia, maybe you can start there and contribute.
There are typically two key parts to such a security review; static analysis is one such part. The other is known vulnerability advisory tracking (like CVEs).
We’re actively working on supporting both of these at JuliaHub. In addition to the public whitepaper and open source rules, we have some additional rules we’re developing. You can reach out to us for more details.
And I’ve been pushing on advisory tracking over the past month. More to come here, but we’ll be leaning on an open source advisory format that Trivy will be able to ingest. That tool can already build complete SBOMs in standard formats for Julia projects.
The other important thing is to read all the open issues and PR’s of the packages you are directly or indirectly using, if a package has a major bug and is widely used there is a fair chance there is already an open issue or PR addressing it. This is also a good way to see if a package you are using is maintained or not (many widely used packages are not maintained).