Skip to content

Commit e038423

Browse files
author
Bennett Hardwick
authored
Merge pull request #21 from cipherstash/chore/update-vendor-deps
Update vendored deps
2 parents cc4e796 + 7ad52cf commit e038423

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3576
-2746
lines changed

Cargo.lock

Lines changed: 95 additions & 406 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,8 @@ edition = "2021"
1616
# and it will keep the alphabetic ordering for you.
1717

1818
[dependencies]
19-
aws-sdk-dynamodb = "0.29.0"
20-
lambda_http = "0.8.1"
21-
lambda_runtime = "0.8.1"
22-
aws-config = "0.56.0"
19+
aws-sdk-dynamodb = "1.3.0"
2320
tokio = { version = "1", features = ["full"] }
24-
tracing = { version = "0.1", features = ["log"] }
25-
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
26-
hmac = "0.12.1"
27-
sha2 = "0.10.7"
28-
aes = "0.8.3"
2921
hex = { version = "0.4.3", features = [ "serde" ] }
3022
cryptonamo-derive = { path = "cryptonamo-derive" }
3123

@@ -34,14 +26,14 @@ cipherstash-client = { path = "./vendor/cipherstash-client/", features = [ "toki
3426
# cipherstash-client = { git = "ssh://git@github.com/cipherstash/cipherstash-suite.git", branch = "feat/compound-spike", package = "cipherstash-client", features = [ "tokio" ] }
3527

3628
async-trait = "0.1.73"
37-
serde_with = "3.3.0"
3829
log = "0.4.20"
39-
env_logger = "0.10.0"
4030
itertools = "0.11.0"
4131
thiserror = "1.0.50"
42-
tokio-stream = "0.1.14"
43-
paste = "1.0.14"
4432

4533
[dev-dependencies]
4634
serial_test = "2.0.0"
4735
trybuild = "1.0.85"
36+
tracing = { version = "0.1", features = ["log"] }
37+
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
38+
aws-config = { version = "1.0.1", features = [ "behavior-version-latest" ] }
39+
env_logger = "0.10.0"

cryptonamo-derive/Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cryptonamo-derive/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@ proc-macro2 = "1.0.66"
1313
quote = "1.0.33"
1414
syn = {version = "2.0.31", features = [ "parsing" ]}
1515
itertools = "0.11.0"
16-
17-
#cipherstash-client = { git = "ssh://git@github.com/cipherstash/cipherstash-suite.git", package = "cipherstash-client", features = [ "tokio" ] }
18-
cipherstash-client = { path = "../vendor/cipherstash-client/", features = [ "tokio" ] }
1916
indexmap = "2.1.0"

cryptonamo-derive/src/decryptable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(crate) fn derive_decryptable(input: DeriveInput) -> Result<TokenStream, syn:
2020
let attr_ident = format_ident!("{attr}");
2121

2222
quote! {
23-
#attr_ident: unsealed.from_protected(#attr)?.try_into()?
23+
#attr_ident: unsealed.from_protected(#attr)?.to_owned().try_into()?
2424
}
2525
})
2626
.chain(plaintext_attributes.iter().map(|attr| {

cryptonamo-derive/src/settings/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ impl SettingsBuilder {
352352
let partition_key = partition_key.ok_or_else(|| {
353353
syn::Error::new(
354354
proc_macro2::Span::call_site(),
355-
"Missing required attribute: #[cryptonamo(partition_key = \"...\")]",
355+
"Missing required attribute: #[partition_key]",
356356
)
357357
})?;
358358

src/encrypted_table/mod.rs

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use cipherstash_client::{
2222
encryption::{Encryption, EncryptionError},
2323
vitur::{errors::LoadConfigError, DatasetConfigWithIndexRootKey, Vitur},
2424
};
25-
use itertools::Itertools;
2625
use log::info;
2726
use std::collections::HashSet;
2827
use thiserror::Error;
@@ -39,6 +38,8 @@ pub struct EncryptedTable {
3938
pub enum PutError {
4039
#[error("AwsError: {0}")]
4140
Aws(String),
41+
#[error("AwsBuildError: {0}")]
42+
AwsBuildError(#[from] aws_sdk_dynamodb::error::BuildError),
4243
#[error("Write Conversion Error: {0}")]
4344
WriteConversion(#[from] WriteConversionError),
4445
#[error("SealError: {0}")]
@@ -65,6 +66,8 @@ pub enum GetError {
6566
pub enum DeleteError {
6667
#[error("Encryption Error: {0}")]
6768
Encryption(#[from] EncryptionError),
69+
#[error("AwsBuildError: {0}")]
70+
AwsBuildError(#[from] aws_sdk_dynamodb::error::BuildError),
6871
#[error("AwsError: {0}")]
6972
Aws(String),
7073
}
@@ -166,29 +169,32 @@ impl EncryptedTable {
166169
) -> Result<(), DeleteError> {
167170
let PrimaryKeyParts { pk, sk } = self.get_primary_key_parts::<E>(k)?;
168171

169-
let sk_to_delete = all_index_keys::<E>(&sk)
172+
let transact_items = all_index_keys::<E>(&sk)
170173
.into_iter()
171-
.map(|x| hmac("sk", &x, Some(pk.as_str()), &self.cipher))
174+
.map(|x| Ok::<_, DeleteError>(hmac("sk", &x, Some(pk.as_str()), &self.cipher)?))
172175
.chain([Ok(sk)])
176+
.map(|sk| {
177+
sk.and_then(|sk| {
178+
Ok::<_, DeleteError>(
179+
TransactWriteItem::builder()
180+
.delete(
181+
Delete::builder()
182+
.table_name(&self.table_name)
183+
.key("pk", AttributeValue::S(pk.clone()))
184+
.key("sk", AttributeValue::S(sk))
185+
.build()?,
186+
)
187+
.build(),
188+
)
189+
})
190+
})
173191
.collect::<Result<Vec<_>, _>>()?;
174192

175-
let transact_items = sk_to_delete.into_iter().map(|sk| {
176-
TransactWriteItem::builder()
177-
.delete(
178-
Delete::builder()
179-
.table_name(&self.table_name)
180-
.key("pk", AttributeValue::S(pk.clone()))
181-
.key("sk", AttributeValue::S(sk))
182-
.build(),
183-
)
184-
.build()
185-
});
186-
187193
// Dynamo has a limit of 100 items per transaction
188194
for items in transact_items.chunks(100).into_iter() {
189195
self.db
190196
.transact_write_items()
191-
.set_transact_items(Some(items.collect()))
197+
.set_transact_items(Some(items.to_vec()))
192198
.send()
193199
.await
194200
.map_err(|e| DeleteError::Aws(format!("{e:?}")))?;
@@ -219,7 +225,7 @@ impl EncryptedTable {
219225
Put::builder()
220226
.table_name(&self.table_name)
221227
.set_item(Some(entry.try_into()?))
222-
.build(),
228+
.build()?,
223229
)
224230
.build(),
225231
);
@@ -239,7 +245,7 @@ impl EncryptedTable {
239245
.table_name(&self.table_name)
240246
.key("pk", AttributeValue::S(pk.clone()))
241247
.key("sk", AttributeValue::S(index_sk))
242-
.build(),
248+
.build()?,
243249
)
244250
.build(),
245251
);

src/encrypted_table/table_entry.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ impl_simple_conversions! {
217217
String => String,
218218
Bytes => Vec<u8>,
219219
StringVec => Vec<String>,
220-
ByteVec => Vec<Vec<u8>>
220+
ByteVec => Vec<Vec<u8>>,
221+
Bool => bool
221222
}
222223

223224
impl From<TableAttribute> for AttributeValue {

tests/common.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,43 @@ pub async fn create_table(client: &Client, table_name: &str) {
1616
AttributeDefinition::builder()
1717
.attribute_name("pk")
1818
.attribute_type(ScalarAttributeType::S)
19-
.build(),
19+
.build()
20+
.expect("Failed to build attribute definition"),
2021
)
2122
.attribute_definitions(
2223
AttributeDefinition::builder()
2324
.attribute_name("sk")
2425
.attribute_type(ScalarAttributeType::S)
25-
.build(),
26+
.build()
27+
.expect("Failed to build attribute definition"),
2628
)
2729
.attribute_definitions(
2830
AttributeDefinition::builder()
2931
.attribute_name("term")
3032
.attribute_type(ScalarAttributeType::S)
31-
.build(),
33+
.build()
34+
.expect("Failed to build attribute definition"),
3235
)
3336
.key_schema(
3437
KeySchemaElement::builder()
3538
.attribute_name("pk")
3639
.key_type(KeyType::Hash)
37-
.build(),
40+
.build()
41+
.expect("Failed to build key schema element"),
3842
)
3943
.key_schema(
4044
KeySchemaElement::builder()
4145
.attribute_name("sk")
4246
.key_type(KeyType::Range)
43-
.build(),
47+
.build()
48+
.expect("Failed to build key schema element"),
4449
)
4550
.provisioned_throughput(
4651
ProvisionedThroughput::builder()
4752
.read_capacity_units(5)
4853
.write_capacity_units(5)
49-
.build(),
54+
.build()
55+
.expect("Failed to build provisioned throughput"),
5056
)
5157
.global_secondary_indexes(
5258
GlobalSecondaryIndex::builder()
@@ -55,7 +61,8 @@ pub async fn create_table(client: &Client, table_name: &str) {
5561
KeySchemaElement::builder()
5662
.attribute_name("term")
5763
.key_type(KeyType::Hash)
58-
.build(),
64+
.build()
65+
.expect("Failed to build key schema element"),
5966
)
6067
.projection(
6168
Projection::builder()
@@ -66,9 +73,11 @@ pub async fn create_table(client: &Client, table_name: &str) {
6673
ProvisionedThroughput::builder()
6774
.read_capacity_units(5)
6875
.write_capacity_units(5)
69-
.build(),
76+
.build()
77+
.expect("Failed to build provisioned throughput"),
7078
)
71-
.build(),
79+
.build()
80+
.expect("Failed to build index"),
7281
)
7382
.send()
7483
.await

tests/compile_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ run_tests! {
3535

3636
pass => {
3737
"./ui/pass.rs",
38-
"./ui/pk-field-on-struct.rs"
38+
"./ui/pk-field-on-struct.rs",
39+
"./ui/various-fields.rs"
3940
}
4041
}

0 commit comments

Comments
 (0)