Skip to content

Conversation

@Sans-Atout
Copy link

Hi, everyone,

A few months ago, I had to produce a guide on how to develop securely in Rust.
This guide was a great help and one of my main sources.
So I thought I'd propose a few rules and a few changes that I think are relevant after my research.

I apologise in advance for any mistakes I may have made.
I've tried using grammar checkers but I'm not sure I've corrected them all.

Here is a summary of the changes I am proposing :

  1. Use of a private registry [9838274]
  2. Supply chain security [a67bbce]
  3. Improve unsafe block's checking ((False positives seem to have disappeared since the issue Forbid unsafe code #10 was written) [47c3727]
  4. Improving best practice in error handling [e8be56f]
  5. Good practice for writing tests [02e20a8]
  6. Added the fact that you can now force lints in Cargo.toml [8c7b07f]

I hope these changes will be useful and I'd be more than happy to discuss them.

`+` Best practice in the use of an internal registry
`+` Best practice for using several registry in a project
`+` Publishing a project in an internal registry
`+` Setting up a default registry for a developer

`+` Adding french and english version
`+` Bests practices added for supply chain security

`+` Adding french and english version
`+` Add a tool for checking the use of `unsafe` blocks in a program's supply chain
`+` Adding french and english version

`^` Translation error corrected in one of the links
`+` Test to comply with RFC1236
`+` Error API recommendation

`+` French and english version
`^` Updating SUMMARY.md
`^` Updating 01_introduction.md

`+` Best practice in testing added
`.` Correct grammar error in french

`+` Second method added for blocking `unsafe` blocks
Copy link
Contributor

@polazarus polazarus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work. I think there is still work to be done here to polish the wording and some thinking about finding the right compromise.

In particular, private registry are not just a security device...

`^` Moving few word from british english to american english to improve overall consistency of the guide

`^` Moving TODO in 01_introduction.md due to an oversight in initial PR
`^` Changing from TEST-INTERNE to TEST-UNIT to comply with rust book

`-` Removing second-person pronouns in 02_devenv.md
`^` Replacing an example of code that could be considered duplicated

`^` Correction of the formatting of the three cargo-geiger output types/levels
`^` Adding explanation for check TEST-CFG
`-` Check LANG-ERRDO may be considered obsolete (cargo issues a warning if the try macro is used)
@Sans-Atout
Copy link
Author

Hello,
First of all, many thanks for taking the time to review my PR and for your pertinent comments.

Regarding the comments on registries, I prefer to give a global answer here rather than in each comment. I completely understand your point of view, but I don't agree with it. In my view, having a private registry can help protect a company's IP but also make an attack on the supply chain more complex.

Although cargo-deny is a very good tool (and I think we need to add some recommendations on how to use it), it doesn't fully fulfil the role of a private registry. Indeed, since crates.io allows the deletion of crates, the use of a private registry can protect a company while the situation is resolved.

However, I agree that this is not a general thing but more recommendations to be adopted in the event that a high level of security is required.
Maybe it would be relevant for me to remove these recommendations from my PR while I open an issue in this repo? This would allow for more opinion/debate on the issue.

@Sans-Atout Sans-Atout requested a review from polazarus March 1, 2025 09:31
Copy link
Contributor

@hg-anssi hg-anssi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Sans-Atout for your important contribution. I left you comments.

`^` Change of the `LIBS-AUDIT-UNSAFE` recommendation to take into account the recommendations of @hg-anssi
`^` Change of the `TEST-UNIT` recommendation to take into account the recommendations of @hg-anssi

`-` Deletion of the section explaining what ignored tests are
`-` Deletion of recommendation LANG-ERR-FLAT

`^` Modification for English and French versions
`-` Deletion of recommendations on the use of an internal registery
`-` Deletion of `cargo-vet` tool recommendations
`+` Explanation added to TEST-TRAIT recommendation

`^` Modification for English and French versions
@Sans-Atout
Copy link
Author

Many thanks for your pertinent comments @hg-anssi. I've taken the liberty of closing the various comments that I feel have been completely resolved by the changes I've made. I think some of them are still open to debate, so I'll let you close them if you're happy with the changes I've made.

Regarding the parts deleted in commit 0bdd824, I'm going to open two issues by the end of the week so that we can discuss them in more depth. Indeed:

  1. Regarding cargo-vet, I don't really know all the ins and outs of the points raised in your comment and adding a recommendation on this tool needs to be more carefully considered.
  2. For the point on internal registries, I remain convinced that my recommendations are necessary. However, these are designed for organisations with a very strong need for security (similar to the level 2 recommendations in the CIS guides). Your recommendations are nonetheless very interesting and I think that a more global reflection is needed before adding anything into the guide.

@Sans-Atout Sans-Atout requested a review from hg-anssi June 23, 2025 21:03
`-` Deletion of `cargo-supply-chain` tool recommendations
`-` Deletion of `cargo-geiher` tool recommendations
`^` Modification of the style of certain recommendations
`+` Reinsertion of TODO deleted in the initial RP
@Sans-Atout
Copy link
Author

Good evening everyone,
I've finally created the different exits, which are

I've also taken the liberty of creating issue #77 in order to group together subjects related to the supply chain. Please let me know if there are too many or if any of the issues need to be modified, deleted, added or merged.

@Sans-Atout Sans-Atout requested a review from hg-anssi June 30, 2025 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants