Skip to content

Commit 6526618

Browse files
authored
Merge pull request #218 from rust-secure-code/doc-updates
README and documentation updates for nightly
2 parents 1a453d3 + 9bec003 commit 6526618

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ cargo audit bin target/release/your-project
2121

2222
`cargo auditable` works with any Cargo command. All arguments are passed to `cargo` as-is.
2323

24+
### On nightly Rust
25+
26+
On nightly we can take advantage of Cargo's [native SBOM precursor](https://doc.rust-lang.org/cargo/reference/unstable.html#sbom) to record dependencies more accurately:
27+
28+
```bash
29+
CARGO_BUILD_SBOM=true cargo +nightly auditable build -Z sbom --release
30+
```
31+
32+
Due to [a bug in Cargo](https://github.com/rust-lang/cargo/issues/15695) you may have to `touch src/*` or `cargo clean` first if you also used `cargo auditable` without `-Z sbom` in the same project.
33+
34+
### Through other tools
35+
36+
If you're not calling `cargo` directly and cannot change how it's invoked, you can use `cargo auditable` as a drop-in replacement for `cargo`. See [here](REPLACING_CARGO.md) for details.
37+
2438
## Adoption
2539

2640
Microsoft uses `cargo auditable` internally and maintains the [data extraction library for Go](https://github.com/microsoft/go-rustaudit).
@@ -104,4 +118,6 @@ Do not rely on SBOMs when dealing with supply chain attacks!
104118

105119
### What is blocking uplifting this into Cargo?
106120

107-
The [RFC for this functionality in Cargo itself](https://github.com/rust-lang/rfcs/pull/2801) has been [postponed](https://github.com/rust-lang/rfcs/pull/2801#issuecomment-2122880841) by the Cargo team until the [more foundational SBOM RFC](https://github.com/rust-lang/rfcs/pull/3553) is implemented. That RFC has now been implemented and is available via an [unstable feature](https://doc.rust-lang.org/cargo/reference/unstable.html#sbom). cargo-auditable integrates with this: if you enable that feature and build with cargo auditable, e.g with `CARGO_BUILD_SBOM=true cargo auditable -Z sbom build` and a nightly Rust toolchain, then cargo auditable will use the SBOM precursor files generated by cargo.
121+
The [RFC for this functionality in Cargo itself](https://github.com/rust-lang/rfcs/pull/2801) has been [postponed](https://github.com/rust-lang/rfcs/pull/2801#issuecomment-2122880841) by the Cargo team until the [more foundational SBOM RFC](https://github.com/rust-lang/rfcs/pull/3553).
122+
123+
That RFC has now been implemented and is available via an [unstable feature](https://doc.rust-lang.org/cargo/reference/unstable.html#sbom). This opens the door to submitting an RFC for this functionality into `cargo` itself once again.

REPLACING_CARGO.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
**Note:** This document describes Unix-like systems, but similar approaches can be applied to Windows as well. Pull requests adding recipes for Windows are welcome.
44

5-
The recommended way is to use a shell alias:
5+
To use `cargo auditable` in place of `cargo` only when you call it yourself from the sell, use a shell alias:
66
```bash
77
alias cargo="cargo auditable"
88
```
99
When entered into the shell, it will only persist for the duration of the session. To make the change permanent, add it to your shell's configuration file (`.bashrc` for bash, `.zshrc` for zsh, `.config/fish/config.fish` for fish).
1010

11-
## When `alias` is not an option
11+
## When called through other commands
1212

13-
In some cases using shell aliases is not an option, e.g. in certain restricted build environments. In this case you can use a different approach:
13+
When calling other programs such as `cmake` or `maturin`, the shell alias usually isn't honored. In this case you can use a different approach:
1414

1515
1. Run `which cargo` to locate the Cargo binary
1616
2. Copy the snippet provided below and replace '/path/to/cargo' with the path you got at step 1

0 commit comments

Comments
 (0)