Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resolver = "3"
version = "0.1.0"
edition = "2024"
rust-version = "1.91.1"
license-file = "./LICENSE.md"
license = "Apache-2.0"
keywords = ["mcp", "gateway", "rust", "contextforge", "a2a", "ai", "llm"]
homepage = "https://github.com/contextforge-gateway-rs/contextforge-gateway-rs"
readme = "./README.md"
Expand All @@ -37,7 +37,7 @@ serde = {version= "1.0"}
serde_json = "1.0"
tracing = "0.1"
tracing-appender = "0.2.3"
tracing-opentelemetry = "0.32"
tracing-opentelemetry = "0.32.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tokio = { version = "1.48.0", features = ["full"] }
tokio-stream = "0.1.17"
Expand Down Expand Up @@ -70,6 +70,7 @@ reqwest = "0.13"
itertools = "0.14"
typed-builder = "0.23.2"
rustls = "0.23"
rustls-pki-types = "1.14.1"

[profile.release]
codegen-units = 1
Expand Down
2 changes: 1 addition & 1 deletion crates/contextforge-gateway-rs-apis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "contextforge-gateway-rs-apis"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license-file.workspace = true
license.workspace = true
keywords.workspace = true


Expand Down
6 changes: 3 additions & 3 deletions crates/contextforge-gateway-rs-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "contextforge-gateway-rs-lib"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license-file.workspace = true
license.workspace = true
keywords.workspace = true


Expand Down Expand Up @@ -46,8 +46,8 @@ lru_time_cache = "0.11.11"
hyper-util = "0.1.20"
hyper = { version = "1.4.0" }
rustls.workspace = true
rustls-pki-types = { version = "1.14.1", features = ["std"] }
rustls-pemfile = "2.2.0"
rustls-pki-types = { version = "1.14.1", features = ["std","alloc"] }

tokio-rustls = "0.26.4"
typed-builder.workspace = true

Expand Down
24 changes: 10 additions & 14 deletions crates/contextforge-gateway-rs-lib/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use clap::{Parser, ValueEnum};
use http::uri::Authority;
use openid::{CompactJson, CustomClaims, StandardClaims};
use redis::{ConnectionAddr, IntoConnectionInfo, RedisError};

use rustls_pki_types::{CertificateDer, PrivatePkcs8KeyDer, pem::PemObject};
use serde::{Deserialize, Serialize};
use thiserror::Error;
use url::Url;
Expand Down Expand Up @@ -246,14 +248,11 @@ fn validate_certs(path: &PathBuf) -> Result<Vec<u8>, ConfigValidationError> {
.map_err(|e| ConfigValidationError::RedisConfigurationError(e.to_string()))?;
let mut cursor = Cursor::new(buf);

let mut count = 0;
for cert in rustls_pemfile::certs(&mut cursor) {
if let Err(e) = cert {
return Err(ConfigValidationError::RedisConfigurationError(e.to_string()));
}
count += 1;
}
if count == 0 {
let certs = CertificateDer::pem_reader_iter(&mut cursor)
.collect::<Result<Vec<_>, _>>()
.map_err(|e| ConfigValidationError::RedisConfigurationError(e.to_string()))?;

if certs.is_empty() {
Err(ConfigValidationError::RedisConfigurationError("No certificates provided".to_owned()))
} else {
Ok(cursor.into_inner())
Expand All @@ -266,13 +265,10 @@ fn validate_key(path: &PathBuf) -> Result<Vec<u8>, ConfigValidationError> {
.map_err(|e| ConfigValidationError::RedisConfigurationError(e.to_string()))?
.read_to_end(&mut buf)
.map_err(|e| ConfigValidationError::RedisConfigurationError(e.to_string()))?;
let mut cursor = Cursor::new(buf);

if let Ok(Some(_)) = rustls_pemfile::private_key(&mut cursor) {
Ok(cursor.into_inner())
} else {
Err(ConfigValidationError::RedisConfigurationError("Private key is wrong".to_owned()))
}
let _ = PrivatePkcs8KeyDer::from_pem_slice(&buf)
.map_err(|_| ConfigValidationError::RedisConfigurationError("Private key is invalid".to_owned()))?;
Ok(buf)
}

impl TryFrom<&Config> for reqwest::Client {
Expand Down
2 changes: 1 addition & 1 deletion crates/contextforge-gateway-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "contextforge-gateway-rs"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license-file.workspace = true
license.workspace = true
keywords.workspace = true


Expand Down
2 changes: 1 addition & 1 deletion crates/contextforge-load-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "contextforge-load-test"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license-file.workspace = true
license.workspace = true
keywords.workspace = true
homepage.workspace = true
readme.workspace = true
Expand Down
Loading