Rust

Prerequisites

Command-line

Run the following command line by setting your parameters.
1
cdefense scan --lang=rust --api-key=<YOUR_API_KEY> \
2
--path=/path/to/your-project --project-name="Sample App"
Copied!

Github Actions Example

1
name: Rust CI Scan
2
​
3
on:
4
push:
5
branches: [ master ]
6
pull_request:
7
branches: [ master ]
8
repository_dispatch:
9
​
10
env:
11
CARGO_TERM_COLOR: always
12
​
13
jobs:
14
build:
15
​
16
runs-on: ubuntu-latest
17
​
18
steps:
19
- uses: actions/[email protected]
20
- name: Build
21
run: cargo build --verbose
22
- name: Cloud Defense Scan
23
run: |
24
curl https://raw.githubusercontent.com/CloudDefenseAI/cd/master/latest/cd-latest-linux-x64.tar.gz > /tmp/cd-latest-linux-x64.tar.gz
25
tar -C /tmp -xzf /tmp/cd-latest-linux-x64.tar.gz
26
chmod +x /tmp/cdefense
27
/tmp/cdefense scan --lang=rust --project-name=vulnerable-rust-github-action --api-key=<YOUR_API_KEY>
28
- name: Run tests
29
run: cargo test --verbose
Copied!
Last modified 1mo ago