Skip to content

Commit 4c163b8

Browse files
CopilotCBenoit
andcommitted
Address reviewer feedback: typo fix, error classification, libsodium docs
Co-authored-by: CBenoit <3809077+CBenoit@users.noreply.github.com>
1 parent e99236e commit 4c163b8

4 files changed

Lines changed: 24 additions & 6 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@ immediately, without going through the acceptance testing process of our quality
2020

2121
### From sources
2222

23-
Ensure that you have [the Rust toolchain installed][install_rust], then clone this repository and run:
23+
Ensure that you have [the Rust toolchain installed][install_rust] and [libsodium][libsodium] installed on your system, then clone this repository and run:
2424

2525
```shell
2626
cargo install --path ./devolutions-gateway
2727
```
2828

29+
> **Note:** `libsodium` is required as a native dependency for in-memory credential protection.
30+
> On Windows, it is vendored automatically via vcpkg.
31+
> On Linux and macOS, install it using your system package manager (e.g., `apt install libsodium-dev` or `brew install libsodium`).
32+
2933
## Configuration
3034

3135
Devolutions Gateway is configured using a JSON document.
@@ -339,6 +343,7 @@ See the dedicated [README.md file](./.github/workflows/README.md) in the `workfl
339343
[official_website]: https://devolutions.net/gateway/download/
340344
[github_release]: https://github.com/Devolutions/devolutions-gateway/releases
341345
[install_rust]: https://www.rust-lang.org/tools/install
346+
[libsodium]: https://libsodium.org/
342347
[psmodule]: https://www.powershellgallery.com/packages/DevolutionsGateway/
343348
[rustls]: https://crates.io/crates/rustls
344349
[microsoft_tls]: https://learn.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings

devolutions-gateway/src/api/preflight.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,11 @@ async fn handle_operation(
337337
});
338338
}
339339

340+
// Validate the token JTI up front so that a bad/missing JTI is reported as
341+
// InvalidParams (client error) rather than InternalServerError.
342+
crate::token::extract_jti(&token)
343+
.map_err(|e| PreflightError::new(PreflightAlertStatus::InvalidParams, format!("{e:#}")))?;
344+
340345
let previous_entry = credential_store
341346
.insert(token, mapping, time_to_live)
342347
.inspect_err(|error| warn!(%operation.id, error = format!("{error:#}"), "Failed to insert credentials"))

devolutions-gateway/src/rd_clean_path.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use std::sync::Arc;
44

55
use anyhow::Context as _;
66
use ironrdp_connector::sspi;
7-
use secrecy::ExposeSecret as _;
87
use ironrdp_pdu::nego;
98
use ironrdp_rdcleanpath::RDCleanPathPdu;
9+
use secrecy::ExposeSecret as _;
1010
use tap::prelude::*;
1111
use thiserror::Error;
1212
use tokio::io::{AsyncRead, AsyncReadExt as _, AsyncWrite, AsyncWriteExt as _};
@@ -405,7 +405,11 @@ async fn handle_with_credential_injection(
405405
} = user;
406406

407407
// The username is in the FQDN format. Thus, the domain field can be empty.
408-
sspi::CredentialsBuffers::AuthIdentity(sspi::AuthIdentityBuffers::from_utf8(fqdn, "", password.expose_secret()))
408+
sspi::CredentialsBuffers::AuthIdentity(sspi::AuthIdentityBuffers::from_utf8(
409+
fqdn,
410+
"",
411+
password.expose_secret(),
412+
))
409413
});
410414

411415
Some(sspi::KerberosServerConfig {

devolutions-gateway/src/rdp_proxy.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use std::sync::Arc;
33

44
use anyhow::Context as _;
55
use ironrdp_acceptor::credssp::CredsspProcessGenerator as CredsspServerProcessGenerator;
6-
use secrecy::ExposeSecret as _;
76
use ironrdp_connector::credssp::CredsspProcessGenerator as CredsspClientProcessGenerator;
87
use ironrdp_connector::sspi;
98
use ironrdp_connector::sspi::generator::{GeneratorState, NetworkRequest};
109
use ironrdp_pdu::{mcs, nego, x224};
10+
use secrecy::ExposeSecret as _;
1111
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt};
1212
use typed_builder::TypedBuilder;
1313

@@ -131,8 +131,12 @@ where
131131
salt: _,
132132
} = user;
133133

134-
// The username is an the FQDN format. Thus, the domain field can be empty.
135-
sspi::CredentialsBuffers::AuthIdentity(sspi::AuthIdentityBuffers::from_utf8(fqdn, "", password.expose_secret()))
134+
// The username is in the FQDN format. Thus, the domain field can be empty.
135+
sspi::CredentialsBuffers::AuthIdentity(sspi::AuthIdentityBuffers::from_utf8(
136+
fqdn,
137+
"",
138+
password.expose_secret(),
139+
))
136140
});
137141

138142
Some(sspi::KerberosServerConfig {

0 commit comments

Comments
 (0)