generated from ossf/project-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from nellshamrell/memory-safe-by-default-best-…
…practices adds initial content for Rust and Go
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Best Practices - Memory-Safe By Default Languages | ||
|
||
While Memory-Safe by default languages are, by definition, memory safe by default, there are ways that the can be used unsafely (or less safely). Here are best developer practices for using these languages. | ||
|
||
## Python | ||
|
||
TO DO | ||
|
||
## Rust | ||
|
||
* Use unsafe blocks sparingly and follow careful practices - see [The Rustonomicon](https://doc.rust-lang.org/nomicon/intro.html) | ||
* When using unsafe code in Rust, the safety boundary is the module boundary. When examining snippets of unsafe code in Rust, you generally need to assess the entire module in which the unsafe code appears. [Source](https://github.com/ossf/Memory-Safety/issues/15#issuecomment-1847939439) | ||
* Avoid using the [no_mangle](https://github.com/rust-lang/rust/issues/28179) attribute | ||
|
||
## Go | ||
|
||
* Using the [unsafe package](https://pkg.go.dev/unsafe#pkg-overview) is sometimes necessary when using C from Go. Be careful (TO DO: Add more about how to be careful) | ||
* Use the [Go data race detector](https://go.dev/doc/articles/race_detector) to check for data race conditions | ||
* Follow the [Security Best Practices for Go Developers](https://go.dev/doc/security/best-practices) | ||
|
||
## .NET | ||
|
||
TO DO | ||
|
||
## Java | ||
|
||
TO DO |