Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

re-introduce the coordinator public key in the message header #514

Merged
merged 1 commit into from
Sep 1, 2020

Conversation

little-dude
Copy link
Contributor

This key is actually necessary for security reasons (see 0 Donald
T. Davis, "Defective Sign & Encrypt in S/MIME, PKCS#7, MOSS, PEM, PGP,
and XML.", Proc. Usenix Tech. Conf. 2001 (Boston, Mass., June 25-30,
2001))

However we still need to implement these checks in the coordinator

This key is actually necessary for security reasons (see [0] Donald
T. Davis, "Defective Sign & Encrypt in S/MIME, PKCS#7, MOSS, PEM, PGP,
and XML.", Proc. Usenix Tech. Conf. 2001 (Boston, Mass., June 25-30,
2001))

However we still need to implement these checks in the coordinator

[0]: http://world.std.com/~dtd/#sign_encrypt
@codecov
Copy link

codecov bot commented Sep 1, 2020

Codecov Report

Merging #514 into multipart-message will increase coverage by 0.18%.
The diff coverage is 40.74%.

Impacted file tree graph

@@                  Coverage Diff                  @@
##           multipart-message     #514      +/-   ##
=====================================================
+ Coverage              58.02%   58.21%   +0.18%     
=====================================================
  Files                     63       63              
  Lines                   3021     2996      -25     
=====================================================
- Hits                    1753     1744       -9     
+ Misses                  1268     1252      -16     
Impacted Files Coverage Δ
rust/xaynet-client/src/lib.rs 13.46% <0.00%> (-0.27%) ⬇️
rust/xaynet-client/src/mobile_client/client.rs 0.00% <0.00%> (ø)
...xaynet-client/src/mobile_client/participant/sum.rs 27.27% <0.00%> (ø)
...aynet-client/src/mobile_client/participant/sum2.rs 14.28% <0.00%> (-0.43%) ⬇️
...net-client/src/mobile_client/participant/update.rs 41.66% <ø> (ø)
rust/xaynet-server/src/state_machine/phases/sum.rs 69.84% <ø> (ø)
...ust/xaynet-server/src/state_machine/phases/sum2.rs 79.03% <ø> (ø)
...t/xaynet-server/src/state_machine/phases/update.rs 63.39% <ø> (ø)
rust/xaynet-client/src/participant.rs 87.95% <100.00%> (+0.14%) ⬆️
rust/xaynet-core/src/message/message.rs 77.57% <100.00%> (+1.60%) ⬆️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba6a16e...89c4670. Read the comment docs.

Base automatically changed from multipart-message to master September 1, 2020 09:44
@little-dude little-dude merged commit 4bb2f7e into master Sep 1, 2020
@little-dude little-dude deleted the re-add-coordinator-pk-in-messages branch September 1, 2020 12:04
little-dude added a commit that referenced this pull request Sep 15, 2020
This refactoring started when I tried to split the message parsing
service in several components, some which I could re-use for
implementing a multipart message service. I tried to make some
simplification, and after some yak shaving ended up making quite a lot
of changes. This should make it much easier to implement the multipart
message service though.

### Add a coordinator public key validation service

This is a check we forgot to implement in the past. See also:

- http://world.std.com/~dtd/#sign_encrypt
- #514

### `PetError` removal

`xaynet_core::PetError` does not exist anymore, so we removed all uses
of it.

### Remove the tracing machinery

Removed `Request<T>` and the `Traceable` traits. These abstractions
were too pervasive and made the code difficult to maintain. Moreover,
out tracing implementation relied on `tower_tracing` which still
hasn't been released. Removing all these abstractions does makes the
code much more readable, and should make it easier to implement the
multipart service.

### Flatten the service error type

Many services were defined as follow:

```rust
impl Service<MyReq> for MyType {
  type Response = Result<MyResp, MyError>;
  type Error = MyServiceError;
  type Future = MyFuture

  // ..
}
```

The future returned by the service then resolved into a
`Result<Result<MyResp, MyError>, MyServiceError>`. The idea was that
the outer result would be for errors that are specific to the service
machinery, while the inner result type would be for business logic
only.

There are several problems this approach. First it induces complexity
and we quickly end up fighting the type checker when we start messing
around with the services. Second, there's not always a clear
distinction between what is business logic and what is a service
implementation detail. Finally, that's a maintenance burden because it
forces us to maintain several error types, and convert between them.

Therefore, for message services, we unified the error type under
`ServiceError`. Now services are defined as:

```rust
impl Service<MyReq> for MyType {
  type Response = MyResp;
  type Error = MyError;
  type Future = MyFuture

  // ..
}
```

### Split out the decryption service

Our work for supporting multipart messages led us to consider
delegating the encryption layer to TLS at some point. Although there
is no short term plan for that, moving the decryption logic into its
own service lays the ground for this. Moreover, it allowed us to
simplify our tests, because we can now test the message parsing
services with non-encrypted messages
little-dude added a commit that referenced this pull request Sep 15, 2020
This refactoring started when I tried to split the message parsing
service in several components, some which I could re-use for
implementing a multipart message service. I tried to make some
simplification, and after some yak shaving ended up making quite a lot
of changes. This should make it much easier to implement the multipart
message service though.

### Add a coordinator public key validation service

This is a check we forgot to implement in the past. See also:

- http://world.std.com/~dtd/#sign_encrypt
- #514

### `PetError` removal

Only one out of the three variants is used in `xaynet_core` and
`xaynet_server`, and two in `xaynet_client`, so there is no point
sharing that error type accross the crates.

### Remove the tracing machinery

Removed `Request<T>` and the `Traceable` traits. These abstractions
were too pervasive and made the code difficult to maintain. Moreover,
out tracing implementation relied on `tower_tracing` which still
hasn't been released. Removing all these abstractions does makes the
code much more readable, and should make it easier to implement the
multipart service.

### Flatten the service error type

Many services were defined as follow:

```rust
impl Service<MyReq> for MyType {
  type Response = Result<MyResp, MyError>;
  type Error = MyServiceError;
  type Future = MyFuture

  // ..
}
```

The future returned by the service then resolved into a
`Result<Result<MyResp, MyError>, MyServiceError>`. The idea was that
the outer result would be for errors that are specific to the service
machinery, while the inner result type would be for business logic
only.

There are several problems this approach. First it induces complexity
and we quickly end up fighting the type checker when we start messing
around with the services. Second, there's not always a clear
distinction between what is business logic and what is a service
implementation detail. Finally, that's a maintenance burden because it
forces us to maintain several error types, and convert between them.

Therefore, for message services, we unified the error type under
`ServiceError`. Now services are defined as:

```rust
impl Service<MyReq> for MyType {
  type Response = MyResp;
  type Error = MyError;
  type Future = MyFuture

  // ..
}
```

### Split out the decryption service

Our work for supporting multipart messages led us to consider
delegating the encryption layer to TLS at some point. Although there
is no short term plan for that, moving the decryption logic into its
own service lays the ground for this. Moreover, it allowed us to
simplify our tests, because we can now test the message parsing
services with non-encrypted messages
little-dude added a commit that referenced this pull request Sep 16, 2020
This refactoring started when I tried to split the message parsing
service in several components, some which I could re-use for
implementing a multipart message service. I tried to make some
simplification, and after some yak shaving ended up making quite a lot
of changes. This should make it much easier to implement the multipart
message service though.

### Add a coordinator public key validation service

This is a check we forgot to implement in the past. See also:

- http://world.std.com/~dtd/#sign_encrypt
- #514

### `PetError` removal

Only one out of the three variants is used in `xaynet_core` and
`xaynet_server`, and two in `xaynet_client`, so there is no point
sharing that error type accross the crates.

### Remove the tracing machinery

Removed `Request<T>` and the `Traceable` traits. These abstractions
were too pervasive and made the code difficult to maintain. Moreover,
out tracing implementation relied on `tower_tracing` which still
hasn't been released. Removing all these abstractions does makes the
code much more readable, and should make it easier to implement the
multipart service.

### Flatten the service error type

Many services were defined as follow:

```rust
impl Service<MyReq> for MyType {
  type Response = Result<MyResp, MyError>;
  type Error = MyServiceError;
  type Future = MyFuture

  // ..
}
```

The future returned by the service then resolved into a
`Result<Result<MyResp, MyError>, MyServiceError>`. The idea was that
the outer result would be for errors that are specific to the service
machinery, while the inner result type would be for business logic
only.

There are several problems this approach. First it induces complexity
and we quickly end up fighting the type checker when we start messing
around with the services. Second, there's not always a clear
distinction between what is business logic and what is a service
implementation detail. Finally, that's a maintenance burden because it
forces us to maintain several error types, and convert between them.

Therefore, for message services, we unified the error type under
`ServiceError`. Now services are defined as:

```rust
impl Service<MyReq> for MyType {
  type Response = MyResp;
  type Error = MyError;
  type Future = MyFuture

  // ..
}
```

### Split out the decryption service

Our work for supporting multipart messages led us to consider
delegating the encryption layer to TLS at some point. Although there
is no short term plan for that, moving the decryption logic into its
own service lays the ground for this. Moreover, it allowed us to
simplify our tests, because we can now test the message parsing
services with non-encrypted messages
little-dude added a commit that referenced this pull request Sep 17, 2020
This refactoring started when I tried to split the message parsing
service in several components, some which I could re-use for
implementing a multipart message service. I tried to make some
simplification, and after some yak shaving ended up making quite a lot
of changes. This should make it much easier to implement the multipart
message service though.

### Add a coordinator public key validation service

This is a check we forgot to implement in the past. See also:

- http://world.std.com/~dtd/#sign_encrypt
- #514

### `PetError` removal

Only one out of the three variants is used in `xaynet_core` and
`xaynet_server`, and two in `xaynet_client`, so there is no point
sharing that error type accross the crates.

### Remove the tracing machinery

Removed `Request<T>` and the `Traceable` traits. These abstractions
were too pervasive and made the code difficult to maintain. Moreover,
out tracing implementation relied on `tower_tracing` which still
hasn't been released. Removing all these abstractions does makes the
code much more readable, and should make it easier to implement the
multipart service.

### Flatten the service error type

Many services were defined as follow:

```rust
impl Service<MyReq> for MyType {
  type Response = Result<MyResp, MyError>;
  type Error = MyServiceError;
  type Future = MyFuture

  // ..
}
```

The future returned by the service then resolved into a
`Result<Result<MyResp, MyError>, MyServiceError>`. The idea was that
the outer result would be for errors that are specific to the service
machinery, while the inner result type would be for business logic
only.

There are several problems this approach. First it induces complexity
and we quickly end up fighting the type checker when we start messing
around with the services. Second, there's not always a clear
distinction between what is business logic and what is a service
implementation detail. Finally, that's a maintenance burden because it
forces us to maintain several error types, and convert between them.

Therefore, for message services, we unified the error type under
`ServiceError`. Now services are defined as:

```rust
impl Service<MyReq> for MyType {
  type Response = MyResp;
  type Error = MyError;
  type Future = MyFuture

  // ..
}
```

### Split out the decryption service

Our work for supporting multipart messages led us to consider
delegating the encryption layer to TLS at some point. Although there
is no short term plan for that, moving the decryption logic into its
own service lays the ground for this. Moreover, it allowed us to
simplify our tests, because we can now test the message parsing
services with non-encrypted messages
little-dude added a commit that referenced this pull request Sep 17, 2020
This refactoring started when I tried to split the message parsing
service in several components, some which I could re-use for
implementing a multipart message service. I tried to make some
simplification, and after some yak shaving ended up making quite a lot
of changes. This should make it much easier to implement the multipart
message service though.

### Add a coordinator public key validation service

This is a check we forgot to implement in the past. See also:

- http://world.std.com/~dtd/#sign_encrypt
- #514

### `PetError` removal

Only one out of the three variants is used in `xaynet_core` and
`xaynet_server`, and two in `xaynet_client`, so there is no point
sharing that error type accross the crates.

### Remove the tracing machinery

Removed `Request<T>` and the `Traceable` traits. These abstractions
were too pervasive and made the code difficult to maintain. Moreover,
out tracing implementation relied on `tower_tracing` which still
hasn't been released. Removing all these abstractions does makes the
code much more readable, and should make it easier to implement the
multipart service.

### Flatten the service error type

Many services were defined as follow:

```rust
impl Service<MyReq> for MyType {
  type Response = Result<MyResp, MyError>;
  type Error = MyServiceError;
  type Future = MyFuture

  // ..
}
```

The future returned by the service then resolved into a
`Result<Result<MyResp, MyError>, MyServiceError>`. The idea was that
the outer result would be for errors that are specific to the service
machinery, while the inner result type would be for business logic
only.

There are several problems this approach. First it induces complexity
and we quickly end up fighting the type checker when we start messing
around with the services. Second, there's not always a clear
distinction between what is business logic and what is a service
implementation detail. Finally, that's a maintenance burden because it
forces us to maintain several error types, and convert between them.

Therefore, for message services, we unified the error type under
`ServiceError`. Now services are defined as:

```rust
impl Service<MyReq> for MyType {
  type Response = MyResp;
  type Error = MyError;
  type Future = MyFuture

  // ..
}
```

### Split out the decryption service

Our work for supporting multipart messages led us to consider
delegating the encryption layer to TLS at some point. Although there
is no short term plan for that, moving the decryption logic into its
own service lays the ground for this. Moreover, it allowed us to
simplify our tests, because we can now test the message parsing
services with non-encrypted messages
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants