snaggen

joined 2 years ago
 

Abstract—New contributors are critical to open source projects. Without them, the project will eventually atrophy and become inactive, or its experienced contributors will bias the future directions the project takes. However, new contributors can also bring a greater risk of introducing vulnerable code. For projects that have a need for both secure implementations and a strong, diverse contributor community, this conflict is a pressing issue. One avenue being pursued that could facilitate this goal is rewriting components of C or C++ code in Rust— a language designed to apply to the same domains as C and C++, but with greater safety guarantees. Seeking to answer whether Rust can help keep new contributors from introducing vulnerabilities, and therefore ease the burden on maintainers, we examine the Oxidation project from Mozilla, which has replaced components of the Firefox web browser with equivalents written in Rust. We use the available data from these projects to derive parameters for a novel application of learning curves, which we use to estimate the proportion of commits that introduce vulnerabilities from new contributors in a manner that is directly comparable. We find that despite concerns about ease of use, first-time contributors to Rust projects are about 70 times less likely to introduce vulnerabilities than first-time contributors to C++ projects. We also found that the rate of new contributors increased overall after switching to Rust, implying that this decrease in vulnerabilities from new contributors does not result from a smaller pool of more skilled developers, and that Rust can in fact facilitate new contributors. In the process, we also qualitatively analyze the Rust vulnerabilities in these projects, and measure the efficacy of the common SZZ algorithm for identifying bug-inducing commits from their fixes.

 

Quite some exciting progress since the last progress report! There have been 180 commits since the last progress report.

As of today, rustc_codegen_cranelift is available on nightly! :tada: You can run rustup component add rustc-codegen-cranelift-preview --toolchain nightly to install it and then either CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift cargo +nightly build to use it for the current invocation or add

 

TL;DR

We want to improve the reliability and performance of crate downloads.

"Non-canonical downloads" (that use URLs containing hyphens or underscores where the crate published uses the opposite) are blocking these plans.

On 2023-11-20 support for "non-canonical downloads" will be disabled.

cargo users are unaffected.

[–] snaggen@programming.dev 8 points 2 years ago (2 children)

It might be interesting to watch the Jackie Chan episode of Every Frame is a Painting, for an analysis of the difference between Hollywood and Hong Kong. This will explain why Jackie Chan is so much better in his Hong Kong movies.

https://m.youtube.com/watch?v=Z1PCtIaM_GQ

[–] snaggen@programming.dev 2 points 2 years ago (1 children)

That is all dependent on the program, but the simplest scenario is by an API with two requests at the same time. But it may also be like if you scan for new files, and use inotify, then you may also have a scanning loop as a fallback. Then the scan and inotify may trigger at almost the same time, so if that then results in a db create or insert you can get in to this problem. So, there are multiple ways to get in to trouble, and life always find new ways 😀

[–] snaggen@programming.dev 4 points 2 years ago

You are free to see this as an ad, but as Rust is targeting safety critical programming in general, I find it interesting to follow certification efforts like this to make rust available for really safety critical use cases. Now, the Ferrocene project is contributing back, but that fact or the license does not really affect the relevance for this community.

[–] snaggen@programming.dev 12 points 2 years ago (7 children)

Well, of course you should stick to rustc if you don't need the certification. I get the impression you mix up thing and the purpose of a certified compiler.

Ferrous Systems is working on certifying a specific version of rustc, and hence make it possible to use rust for projects where such certification is required. And certification is required for things like programming medical equipment. If you are hooked in to life support, it is good if the compiler did the thing it was supposed to do.... a crash in such programs can be fatal in a very literal way.

Also, notice that they try to do this without forking and by contributing upstream.

[–] snaggen@programming.dev 2 points 2 years ago (2 children)

As I still run in to glibc version issues a little now and then (admittedly not very often, thankss to containers), I hope to see rust getting rid of libc one day. But I don't expect that in the near future, because as the author mentions, libc is very mature, so replacing it must be done with a lot of caution. But this really looks like a step in the right direction.

[–] snaggen@programming.dev 7 points 2 years ago (2 children)

I think this is was a great read, since it shows a few important things

  • Coming to rust from C is not trivial, you are required to learn a few new concepts (or not really new, but implicit in most languages, formalized in rust).
  • When coming from C and you understand the basic concepts, it is easier to learn rust than from many other languages, since you understand what is going on under the hood. Dangling pointers, and use after free aso, are known concepts. C/C++ programmers don't have to fear rust.
  • The rust book is a great source of information.
[–] snaggen@programming.dev 2 points 2 years ago

So, a loop it is....

[–] snaggen@programming.dev 4 points 2 years ago (5 children)

That will always be prune to race conditions, where you check if someting exists (then some other thread creates it) and then you try to create it. You should always try to create first, then if it fails due to it already existing, fetch it. That is a good general rule for anything from hashmaps to databases.

[–] snaggen@programming.dev 3 points 2 years ago (2 children)

I have never used sea-orm, but I wonder if .on_conflict could be used to simplify the code above?

[–] snaggen@programming.dev 14 points 2 years ago* (last edited 2 years ago) (3 children)

No ads disguised as search results. Actually, no ads at all. Great search results. Lenses.

Also, there is a solution for incognito mode. And ad supported, in practice means tracked by advertisers, and hence you are the product.

[–] snaggen@programming.dev 8 points 2 years ago

All these services turning into shit, are the services without a viable business model to begin with. What I find interesting is that it is obviously possible to become leading in a field, just by burning investors money.

[–] snaggen@programming.dev 8 points 2 years ago

The reason might be, that you must think a bit different from C++ so it might be a little bit tricky to do the switch. Thouigh, if you know C++ the ownership and stuff should be a bit easier to understand since you probably can figure out what is going on. The reason I learned Rust in the first place was because I had to use C libraries, and I knew rust had good support for that. But, unfortunately I cannot assist you with alternatives to rust, since I stopped looking after I learned rust. 😄

view more: ‹ prev next ›