Skip to content

Commit d1bd97b

Browse files
authored
RUST-1205 Cherry-pick SSDLC updates to 3.0.x (#1143)
1 parent 00d95c3 commit d1bd97b

File tree

9 files changed

+108
-17
lines changed

9 files changed

+108
-17
lines changed

.evergreen/check-semgrep.sh

100644100755
Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,29 @@
22

33
set -o errexit
44

5-
source ./.evergreen/env.sh
6-
7-
. ${DRIVERS_TOOLS}/.evergreen/find-python3.sh
8-
PYTHON=$(find_python3)
5+
if [ -t 0 ] ; then
6+
# Interactive shell
7+
PYTHON3=${PYTHON3:-"python3"}
8+
else
9+
# Evergreen run (probably)
10+
source ./.evergreen/env.sh
11+
source ${DRIVERS_TOOLS}/.evergreen/find-python3.sh
12+
PYTHON3=$(find_python3)
13+
fi
914

1015
if [[ -f "semgrep/bin/activate" ]]; then
11-
echo 'using existing virtualenv'
16+
echo 'Using existing virtualenv...'
1217
. semgrep/bin/activate
1318
else
14-
echo 'Creating new virtualenv'
15-
${PYTHON} -m venv semgrep
16-
echo 'Activating new virtualenv'
19+
echo 'Creating new virtualenv...'
20+
${PYTHON3} -m venv semgrep
21+
echo 'Activating new virtualenv...'
1722
. semgrep/bin/activate
23+
echo 'Installing semgrep...'
1824
python3 -m pip install semgrep
1925
fi
2026

27+
# Show human-readable output
28+
semgrep --config p/rust --error
2129
# Generate a SARIF report
22-
semgrep --config p/rust --sarif > mongo-rust-driver.json.sarif
23-
# And human-readable output
24-
semgrep --config p/rust --error
30+
semgrep --config p/rust --quiet --sarif -o sarif.json
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o xtrace
5+
6+
REPORT_FILE=".evergreen/${CRATE_VERSION}-ssdlc-compliance-report.md"
7+
SED_REPLACE="s/RELEASE_VERSION/${CRATE_VERSION}/g"
8+
9+
sed ${SED_REPLACE} .evergreen/ssdlc-compliance-report-template.md > ${REPORT_FILE}

.evergreen/release-build-vars.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ CRATE_VERSION=$(cargo metadata --format-version=1 --no-deps | jq --raw-output '.
1313
rm secrets-export.sh
1414

1515
PAPERTRAIL_PRODUCT="rust-driver"
16+
TEST_PREFIX=""
1617
if [[ "${DRY_RUN:-}" == "yes" ]]; then
1718
PAPERTRAIL_PRODUCT="rust-driver-testing"
19+
TEST_PREFIX="testing-"
1820
fi
1921

2022
cat <<EOT >release-expansion.yml
@@ -27,4 +29,7 @@ ARTIFACTORY_USERNAME: "${ARTIFACTORY_USERNAME}"
2729
ARTIFACTORY_PASSWORD: "${ARTIFACTORY_PASSWORD}"
2830
GARASIGN_USERNAME: "${GARASIGN_USERNAME}"
2931
GARASIGN_PASSWORD: "${GARASIGN_PASSWORD}"
32+
S3_UPLOAD_AWS_KEY: "${S3_UPLOAD_AWS_KEY}"
33+
S3_UPLOAD_AWS_SECRET: "${S3_UPLOAD_AWS_SECRET}"
34+
TEST_PREFIX: "${TEST_PREFIX}"
3035
EOT

.evergreen/releases.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#
3030
# Make sure to remove the changes from 1 and 2 before merging!
3131

32-
3332
exec_timeout_secs: 3600
3433

3534
functions:
@@ -158,8 +157,42 @@ functions:
158157
args:
159158
- .evergreen/release-sign.sh
160159

160+
# Note for debugging: the links generated by Evergreen for these files will
161+
# return a "permission denied" error; this is expected and a consequence of
162+
# s3 configuration. The files can be viewed/downloaded by replacing the host
163+
# portion of the URL with `downloads.mongodb.org`.
161164
"save signature":
162-
command: s3.push
165+
- command: s3.put
166+
params:
167+
aws_key: ${S3_UPLOAD_AWS_KEY}
168+
aws_secret: ${S3_UPLOAD_AWS_SECRET}
169+
local_files_include_filter:
170+
- src/mongodb-${CRATE_VERSION}.sig
171+
- src/mongodb-internal-macros-${CRATE_VERSION}.sig
172+
remote_file: rust-driver/${TEST_PREFIX}
173+
bucket: cdn-origin-rust-driver
174+
permissions: private
175+
content_type: text/plain
176+
display_name: signature-
177+
178+
"create and upload SSDLC compliance report":
179+
- command: subprocess.exec
180+
params:
181+
working_dir: "src"
182+
include_expansions_in_env:
183+
- CRATE_VERSION
184+
binary: bash
185+
args:
186+
- .evergreen/create-ssdlc-compliance-report.sh
187+
- command: s3.put
188+
params:
189+
aws_key: ${S3_UPLOAD_AWS_KEY}
190+
aws_secret: ${S3_UPLOAD_AWS_SECRET}
191+
local_file: src/.evergreen/${CRATE_VERSION}-ssdlc-compliance-report.md
192+
remote_file: rust-driver/${TEST_PREFIX}${CRATE_VERSION}-ssdlc-compliance-report.md
193+
bucket: cdn-origin-rust-driver
194+
permissions: private
195+
content_type: text/markdown
163196

164197
tasks:
165198
- name: "publish-release"
@@ -172,6 +205,7 @@ tasks:
172205
- func: "publish papertrail"
173206
- func: "sign release"
174207
- func: "save signature"
208+
- func: "create and upload SSDLC compliance report"
175209

176210
axes:
177211
- id: "os"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# MongoDB Rust Driver SSDLC Compliance Report
2+
3+
### Release Version: RELEASE_VERSION
4+
5+
**Release Creator**
6+
The creator of this release can be determined by visiting
7+
https://github.com/mongodb/mongo-rust-driver/releases/tag/vRELEASE_VERSION.
8+
9+
**Process Document**
10+
Not available. <!-- TODO RUST-1918 Link to "How We Develop Software" document -->
11+
12+
**Tool used to track third party vulnerabilities**
13+
N/A; the Rust driver does not bundle third-party dependencies
14+
15+
**Third-Party Dependency Information**
16+
N/A; the Rust driver does not bundle third-party dependencies
17+
18+
**Static Analysis Findings**
19+
To request a copy of the static analysis report, please contact
20+
the MongoDB Rust driver team.
21+
22+
**Signature Information**
23+
The release signature for this version can be found by visiting
24+
https://downloads.mongodb.org/rust-driver/mongodb-RELEASE_VERSION.sig.
25+
26+
**Security Testing Report**
27+
See [Driver Security Testing Summary](https://docs.google.com/document/d/1y2K_RY4GZVXpQvv4JH_35mSzFRTawNJ3mibpvSBU8H0/edit?usp=sharing)
28+
(internal). Available as needed from the MongoDB Rust driver team.
29+
30+
**Security Assessment Report**
31+
N/A; non-goal for client libraries
32+
33+
**Known Vulnerabilities**
34+
None

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ Cargo.lock
1212
# we install cargo and rustup in the project directory on Evergreen.
1313
.cargo
1414
.rustup
15-
mongocryptd.pid
15+
mongocryptd.pid
16+
semgrep/
17+
sarif.json

.semgrepignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
benchmarks/
2-
src/test/
2+
src/test/
3+
etc/

src/client/auth/scram.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ impl ScramVersion {
317317
let normalized_password = match self {
318318
ScramVersion::Sha1 => {
319319
// nosemgrep: insecure-hashes
320-
let mut md5 = Md5::new();
320+
let mut md5 = Md5::new(); // mongodb rating: No Fix Needed
321321
md5.update(format!("{}:mongo:{}", username, password));
322322
Cow::Owned(hex::encode(md5.finalize()))
323323
}

src/runtime/tls_rustls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn make_rustls_config(cfg: TlsOptions) -> Result<rustls::ClientConfig> {
143143

144144
if let Some(true) = cfg.allow_invalid_certificates {
145145
// nosemgrep: rustls-dangerous
146-
config
146+
config // mongodb rating: No Fix Needed
147147
.dangerous()
148148
.set_certificate_verifier(Arc::new(NoCertVerifier {}));
149149
}

0 commit comments

Comments
 (0)