Page MenuHomePhabricator

[services] Update AWS Rust SDK
ClosedPublic

Authored by bartek on Jul 25 2024, 12:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 27, 1:37 PM
Unknown Object (File)
Sat, Oct 26, 6:13 AM
Unknown Object (File)
Thu, Oct 24, 5:07 AM
Unknown Object (File)
Wed, Oct 23, 6:31 AM
Unknown Object (File)
Wed, Oct 23, 3:14 AM
Unknown Object (File)
Mon, Oct 21, 5:18 AM
Unknown Object (File)
Sun, Oct 20, 1:35 AM
Unknown Object (File)
Fri, Oct 18, 4:44 PM
Subscribers

Details

Summary

Updated AWS SDK for Rust. Most notable changes:

  • All builders now return Result - they fail only on programmer error - when required items are not set, so used expect()
  • Needed to upgrade siwe crate to resolve dependency conflict

Other changes described in inline comments

Depends on D12878

Test Plan
  • Cargo build for the whole workspace
  • CI, including Commtest
  • Manual testing locally for Identity and Blob

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Jul 25 2024, 12:46 AM
bartek added inline comments.
Cargo.toml
87–88 ↗(On Diff #42759)
  • Needed to update siwe to resolve dependency version conflict with AWS crates
  • Needed to add time which should be re-exported from siwe but it's not. It's required to specify time format in SIWE message/signature verification.
services/backup/src/database/mod.rs
345 ↗(On Diff #42759)

We could use unwrap() as well, errors here are rather obvious when looking at the docs (or even source code)

services/blob/src/service.rs
120–123 ↗(On Diff #42759)

content_length() now returns Option<i64> instead of Result<u64-convertible, SomeError>.

Should I create a follow-up to check all places where we do as u64 conversions?

services/identity/src/database.rs
613–614 ↗(On Diff #42759)

response.items() now always returns a string slice instead of Option<Vec>.
It uses unwrap_or_default() under the hood.

613–614 ↗(On Diff #42759)

Should've given the opposite name

services/identity/src/ddb_utils.rs
269 ↗(On Diff #42759)

item is now AttributeMap, it was Option<_> previously

services/identity/src/siwe.rs
39–46 ↗(On Diff #42759)
  • verify() is now async.
  • first arg (signature) is now &[u8] so no longer need to try_into().
  • last three args are now moved to VerificationOpts
  • timestamp unfortunately requires time::OffsetDateTime instead of chrono::Utc
shared/comm-lib/src/database.rs
565 ↗(On Diff #42759)

keys is now Vec<AttributeMap> directly, no longer wrapped in Option<_>

varun added inline comments.
services/blob/src/service.rs
120–123 ↗(On Diff #42759)

how about something like this to avoid overflow?

and yeah a follow-up task would be great, thanks!

services/identity/src/database.rs
613–614 ↗(On Diff #42759)

prefer "available" to "free"

services/identity/src/siwe.rs
39–46 ↗(On Diff #42759)

looked into why this became async -- it's to support smart contract wallets

https://linear.app/comm/issue/ENG-4363/update-login-wallet-user-rpc-to-verify-signed-message-validity

this is on our roadmap, so were always going to have to increase the version of the siwe crate

This revision is now accepted and ready to land.Jul 25 2024, 12:55 PM
services/blob/src/service.rs
120–123 ↗(On Diff #42759)

Good idea. By the way I checked other places with as u64 and they look safe. It's usually a usize -> u64 conversion.

services/identity/src/siwe.rs
39–46 ↗(On Diff #42759)

Good to know that

This revision was landed with ongoing or failed builds.Jul 26 2024, 2:48 AM
This revision was automatically updated to reflect the committed changes.