Skip to content

Commit 071263d

Browse files
authored
Merge branch 'main' into rkapila/shared-cache-beacons
2 parents cda1fdf + 7b45929 commit 071263d

File tree

16 files changed

+157
-44
lines changed

16 files changed

+157
-44
lines changed

.github/dependabot.yml

+4
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ updates:
2020
directory: ".github/workflows"
2121
schedule:
2222
interval: "daily"
23+
- package-ecosystem: "cargo"
24+
directory: "DynamoDbEncryption/runtimes/rust"
25+
schedule:
26+
interval: "daily"

DynamoDbEncryption/runtimes/rust/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-db-esdk"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55
rust-version = "1.80.0"
66
keywords = ["cryptography", "security", "dynamodb", "encryption", "client-side"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
To publish a new version of the aws-db-esdk for version N.N.N
2+
3+
1. Acquire the appropriate permissions
4+
1. Ensure git checkout of main is fresh and clean
5+
1. ./start_release.sh N.N.N
6+
1. `cd ../../../releases/rust/db_esdk`
7+
1. Create a PR with all changed or added files
8+
1. Within the PR, make sure you also:
9+
1. Update the `CHANGELOG.md` in the root directory with the changes
10+
1. If this is a major version bump, update the `SUPPORT_POLICY.rst` for Rust
11+
1. Get the PR reviewed by a teammate
12+
1. Before merging the PR, publish the new version of the `aws-db-esdk` crate and test the published crate (documented in next steps)
13+
1. Run `cargo publish`
14+
1. `cd ../../../DynamoDbEncryption/runtimes/rust/` # i.e. return here
15+
1. ./test_published.sh N.N.N
16+
1. Ignore/stash the changes in `DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml` which adds the `aws-db-esdk`
17+
1. Merge the release PR

DynamoDbEncryption/runtimes/rust/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#![allow(warnings, unconditional_panic)]
55
#![allow(nonstandard_style)]
6+
#![allow(clippy::never_loop)]
7+
#![allow(clippy::absurd_extreme_comparisons)]
68

79
pub mod client;
810
pub mod conversions;
@@ -30,7 +32,7 @@ pub use crate::deps::aws_cryptography_materialProviders;
3032
pub use crate::deps::aws_cryptography_primitives;
3133

3234
pub(crate) mod implementation_from_dafny;
33-
pub(crate) use crate::implementation_from_dafny::r#_Wrappers_Compile;
35+
pub(crate) use crate::implementation_from_dafny::_Wrappers_Compile;
3436
pub(crate) use crate::implementation_from_dafny::software;
3537
pub(crate) use crate::implementation_from_dafny::AesKdfCtr;
3638
pub(crate) use crate::implementation_from_dafny::ConcurrentCall;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash -eu
2+
3+
# Check if exactly one argument is provided
4+
if [ "$#" -ne 1 ]; then
5+
echo 1>&2 "USAGE: start_release.sh N.N.N"
6+
exit 1
7+
fi
8+
9+
# Go to the directory of this script
10+
cd $( dirname ${BASH_SOURCE[0]} )
11+
12+
# Check if the provided argument matches the version pattern
13+
REGEX_VERSION='^\d+\.\d+\.\d+$'
14+
MATCHES=$(echo "$1" | egrep $REGEX_VERSION | wc -l)
15+
if [ $MATCHES -eq 0 ]; then
16+
echo 1>&2 "Version \"$1\" must be N.N.N"
17+
exit 1
18+
fi
19+
20+
# Update the version in Cargo.toml
21+
perl -pe "s/^version = .*$/version = \"$1\"/" < Cargo.toml > new_Cargo.toml
22+
mv new_Cargo.toml Cargo.toml
23+
24+
# Remove all files and directories in src except for specified files
25+
find src -depth 1 | egrep -v '(intercept.rs|lib.rs|software_externs.rs)' | xargs rm -rf
26+
27+
# Change to the parent directory and run make polymorph and transpile commands
28+
cd ../..
29+
make polymorph_rust transpile_rust test_rust
30+
31+
# Remove target directory
32+
cd runtimes/rust
33+
rm -rf target
34+
35+
# Remove existing release directory and copy current directory to releases
36+
rm -rf ../../../releases/rust/db_esdk
37+
cp -r . ../../../releases/rust/db_esdk
38+
39+
# Go to the release directory
40+
cd ../../../releases/rust/db_esdk
41+
42+
# Restore the dafny_runtime_rust directory that was previously tracked by Git but had been deleted
43+
git checkout dafny_runtime_rust
44+
45+
# Remove unnecessary files and directories
46+
rm -rf *~ copy_externs.sh start_release.sh test_published.sh test_examples *.pem RELEASE.md
47+
48+
# Create .gitignore file with specified entries
49+
echo Cargo.lock > .gitignore
50+
echo target >> .gitignore
51+
52+
# Run cargo test and example tests
53+
cargo test
54+
cargo run --example main
55+
56+
# Remove Cargo.lock and .pem files after testing the examples
57+
rm -f Cargo.lock *.pem
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*~
2+
*.pem
3+
src
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "aws-db-esdk-examples"
3+
edition = "2021"
4+
rust-version = "1.80.0"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
9+
aws-config = "1.5.10"
10+
aws-lc-rs = "1.11.1"
11+
aws-lc-sys = "0.23.1"
12+
aws-sdk-dynamodb = "1.54.0"
13+
aws-sdk-kms = "1.50.0"
14+
aws-smithy-runtime-api = {version = "1.7.3", features = ["client"] }
15+
aws-smithy-types = "1.2.9"
16+
chrono = "0.4.38"
17+
dafny-runtime = "0.1.1"
18+
dashmap = "6.1.0"
19+
pem = "3.0.4"
20+
tokio = {version = "1.41.1", features = ["full"] }
21+
uuid = { version = "1.11.0", features = ["v4"] }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash -eu
2+
3+
# Check if exactly one argument is provided
4+
if [ "$#" -ne 1 ]; then
5+
echo 1>&2 "USAGE: test_published.sh N.N.N"
6+
exit 1
7+
fi
8+
9+
# Go to the directory of this script
10+
cd $( dirname ${BASH_SOURCE[0]} )
11+
12+
# Check if the provided argument matches the version pattern
13+
REGEX_VERSION='^\d+\.\d+\.\d+$'
14+
echo "$1" | egrep -q $REGEX_VERSION
15+
if [ $? -ne 0 ]; then
16+
echo 1>&2 "Version \"$1\" must be N.N.N"
17+
exit 1
18+
fi
19+
20+
VERSION=$1
21+
22+
# Update examples in test_examples directory
23+
rm -rf test_examples/src
24+
cp -r examples test_examples/src/
25+
cd test_examples
26+
27+
# Add aws-db-esdk
28+
cargo add aws-db-esdk
29+
30+
# Check if the added version matches the provided version
31+
MATCH=$(fgrep "aws-db-esdk = \"$VERSION\"" Cargo.toml | wc -l)
32+
if [ $MATCH -eq "0" ]; then
33+
echo Version $VERSION of aws-db-esdk not the most recent
34+
egrep '^aws-db-esdk' Cargo.toml
35+
exit 1
36+
fi
37+
38+
# Run the cargo project
39+
cargo run

releases/rust/db_esdk/.gitignore~

-35
This file was deleted.

releases/rust/db_esdk/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-db-esdk"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55
rust-version = "1.80.0"
66
keywords = ["cryptography", "security", "dynamodb", "encryption", "client-side"]

releases/rust/db_esdk/src/aes_kdf_ctr.rs

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ pub mod AesKdfCtr {
1414
use dafny_runtime::Sequence;
1515
use std::rc::Rc;
1616

17-
#[allow(non_camel_case_types)]
18-
// pub struct _default {}
19-
2017
fn error(s: &str) -> Rc<DafnyError> {
2118
Rc::new(DafnyError::AwsCryptographicPrimitivesError {
2219
message:

releases/rust/db_esdk/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#![allow(warnings, unconditional_panic)]
55
#![allow(nonstandard_style)]
6+
#![allow(clippy::never_loop)]
7+
#![allow(clippy::absurd_extreme_comparisons)]
68

79
pub mod client;
810
pub mod conversions;
@@ -30,7 +32,7 @@ pub use crate::deps::aws_cryptography_materialProviders;
3032
pub use crate::deps::aws_cryptography_primitives;
3133

3234
pub(crate) mod implementation_from_dafny;
33-
pub(crate) use crate::implementation_from_dafny::r#_Wrappers_Compile;
35+
pub(crate) use crate::implementation_from_dafny::_Wrappers_Compile;
3436
pub(crate) use crate::implementation_from_dafny::software;
3537
pub(crate) use crate::implementation_from_dafny::AesKdfCtr;
3638
pub(crate) use crate::implementation_from_dafny::ConcurrentCall;

releases/rust/db_esdk/src/standard_library_conversions.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
14
pub fn ostring_to_dafny(
25
input: &Option<String>,
36
) -> ::std::rc::Rc<

releases/rust/db_esdk/src/standard_library_externs.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
14
// Annotation to ignore the case of this module
25
use crate::r#_Wrappers_Compile;
36
use crate::implementation_from_dafny::UTF8;

submodules/smithy-dafny

0 commit comments

Comments
 (0)