Skip to content

Commit

Permalink
chore: Updates for May 2021 (#1078)
Browse files Browse the repository at this point in the history
chore: Updates for May 2021
  • Loading branch information
jrconlin authored May 10, 2021
1 parent 322603a commit f25e4e0
Show file tree
Hide file tree
Showing 156 changed files with 18,164 additions and 116,836 deletions.
67 changes: 29 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ async-trait = "0.1.40"
base64 = "0.13"
bb8 = "0.4.1" # pin to 0.4 due to dependencies on Tokio
bytes = "1.0"
cadence = "0.24"
cadence = "0.25"
chrono = "0.4"
config = "0.10"
config = "0.11"
# Pin to 0.5 for now, to keep it under tokio 0.2 (issue977).
# Fix for #803 (deadpool#92) points to our fork for now
#deadpool = "0.5" # pin to 0.5
Expand All @@ -48,8 +48,8 @@ pyo3 = "0.13"
hawk = "3.2"
hex = "0.4.3"
hostname = "0.3.1"
hkdf = "0.10"
hmac = "0.10"
hkdf = "0.11"
hmac = "0.11"
jsonwebtoken = "7.2.0"
log = { version = "0.4", features = ["max_level_debug", "release_max_level_info"] }
mime = "0.3"
Expand Down Expand Up @@ -78,8 +78,8 @@ tokio = { version = "0.2.4", features = ["macros", "sync"] }
url = "2.1"
urlencoding = "1.1"
uuid = { version = "0.8.2", features = ["serde", "v4"] }
validator = "0.12"
validator_derive = "0.12"
validator = "0.13"
validator_derive = "0.13"
woothee = "0.11"

[features]
Expand Down
7 changes: 1 addition & 6 deletions src/db/spanner/support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,7 @@ fn merge_by_type(lhs: Value, rhs: &Value, field_type: &Type) -> Result<Value> {
| TypeCode::INT64
| TypeCode::STRING
| TypeCode::TIMESTAMP => merge_string(lhs, rhs),
TypeCode::ARRAY
| TypeCode::FLOAT64
| TypeCode::NUMERIC
| TypeCode::STRUCT
| TypeCode::TYPE_CODE_UNSPECIFIED
| TypeCode::BOOL => unsupported_merge(field_type),
_ => unsupported_merge(field_type),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/server/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fn create_hawk_header(method: &str, port: u16, path: &str) -> String {
};
let payload =
serde_json::to_string(&payload).expect("Could not get payload in create_hawk_header");
let mut signature = Hmac::<Sha256>::new_varkey(&SECRETS.signing_secret)
let mut signature = Hmac::<Sha256>::new_from_slice(&SECRETS.signing_secret)
.expect("Could not get signature in create_hawk_header");
signature.update(payload.as_bytes());
let signature = signature.finalize().into_bytes();
Expand Down
2 changes: 1 addition & 1 deletion src/web/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub fn hkdf_expand_32(info: &[u8], salt: Option<&[u8]>, key: &[u8]) -> ApiResult

/// Helper function for [HMAC](https://tools.ietf.org/html/rfc2104) verification.
fn verify_hmac(info: &[u8], key: &[u8], expected: &[u8]) -> ApiResult<()> {
let mut hmac = Hmac::<Sha256>::new_varkey(key)?;
let mut hmac = Hmac::<Sha256>::new_from_slice(key)?;
hmac.update(info);
hmac.verify(expected).map_err(From::from)
}
Expand Down
2 changes: 1 addition & 1 deletion src/web/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl From<Context<ValidationErrorKind>> for ValidationError {
_ => StatusCode::BAD_REQUEST,
};

Self { inner, status }
Self { status, inner }
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/web/extractors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ mod tests {
) -> String {
let salt = payload.salt.clone();
let payload = serde_json::to_string(payload).unwrap();
let mut hmac = Hmac::<Sha256>::new_varkey(&state.secrets.signing_secret).unwrap();
let mut hmac = Hmac::<Sha256>::new_from_slice(&state.secrets.signing_secret).unwrap();
hmac.update(payload.as_bytes());
let payload_hash = hmac.finalize().into_bytes();
let mut id = payload.as_bytes().to_vec();
Expand Down
8 changes: 3 additions & 5 deletions src/web/middleware/sentry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ where
fn call(&mut self, sreq: ServiceRequest) -> Self::Future {
let mut tags = Tags::from(sreq.head());
sreq.extensions_mut().insert(tags.clone());
let metrics = if let Some(state) = sreq.app_data::<Data<ServerState>>() {
Some(Metrics::from(state.get_ref()))
} else {
None
};
let metrics = sreq
.app_data::<Data<ServerState>>()
.map(|state| Metrics::from(state.get_ref()));

Box::pin(self.service.call(sreq).and_then(move |mut sresp| {
// handed an actix_error::error::Error;
Expand Down
2 changes: 1 addition & 1 deletion src/web/tokenserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub fn get_sync(
}

fn fxa_metrics_hash(value: &str, hmac_key: &[u8]) -> String {
let mut mac = Hmac::<Sha256>::new_varkey(hmac_key).unwrap();
let mut mac = Hmac::<Sha256>::new_from_slice(hmac_key).unwrap();
let v = value.split('@').next().unwrap();
mac.update(v.as_bytes());

Expand Down
16 changes: 14 additions & 2 deletions vendor/mozilla-rust-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[workspace]
members = [
"googleapis",
"googleapis-raw",
]

# ci kick -- can be deleted
4 changes: 0 additions & 4 deletions vendor/mozilla-rust-sdk/LICENSE.md

This file was deleted.

26 changes: 25 additions & 1 deletion vendor/mozilla-rust-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
# Rust bindings for Google APIs
# GoogleApis

This repository contains client libraries to interact with Google APIs.

**NOTE: These generated clients are under development and should be considered
experimental!**


## Usage

### Installation# Rust bindings for Google APIs

See [`googleapis-raw`](googleapis-raw) for raw bindings based on
[`grpcio`](https://github.com/pingcap/grpc-rs).

See [`googleapis`](googleapis) for high-level bindings (not ready for use yet).

## Contributing

Contributions to this library are always welcome and highly encouraged.

See [CONTRIBUTING](CONTRIBUTING.md) for more information on how to get started.

## License

Apache 2.0 - See [LICENSE](LICENSE) for more information.

## Disclaimer

This is not an officially supported Google product.
14 changes: 14 additions & 0 deletions vendor/mozilla-rust-sdk/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM rust:1.36.0

RUN apt-get update -qq && apt-get install -y clang
Expand Down
4 changes: 2 additions & 2 deletions vendor/mozilla-rust-sdk/googleapis-raw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ edition = "2018"

[dependencies]
futures = "0.3.5"
grpcio = "0.8.0"
protobuf = "2.16.2"
grpcio = "0.8.2"
protobuf = "2.23.0"

[dev-dependencies]
slog = "2.5"
Expand Down
16 changes: 16 additions & 0 deletions vendor/mozilla-rust-sdk/googleapis-raw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ pub(crate) use crate::{
```
_(which was taken from `src/rpc/spanner/admin/instance/v1/mod.rs`)_

Please note that the source grpc repo may contiain one or more older submodule references that may
need to be updated (e.g. `.grpc/third_party/googleapis`). This may require manual updating as well
as manunal updating/correction of the various, `mod.rs` files. Pay close attention to interdependencies.
These may need to be specified in the directory mods (see `.src/storage/v1/mod.rs` for an example.
Remember, you can use the `r#` prefix in rust to except a reserved name for use, e.g.
`use mod crate::r#type`)

### When Updating

Remember to update the dependent submodules by calling

`git submodule update --init --recursive`

**NOTE**: this may alter the pre-generated mod files requiring old
modules to be dropped or new modules to be added. Ensure that the
various `mod.rs` files capture these changes.

## Google Cloud Console

Expand Down
Loading

0 comments on commit f25e4e0

Please sign in to comment.